Skip to content

Commit

Permalink
fix inverted horizontal list performance laggy (#851)
Browse files Browse the repository at this point in the history
  • Loading branch information
SherifMega authored Jun 9, 2023
1 parent f91bcb1 commit e2854a5
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/FlashList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ class FlashList<T> extends React.PureComponent<
private stickyContentContainerRef?: PureComponentWrapper;
private listFixedDimensionSize = 0;
private transformStyle = PlatformConfig.invertedTransformStyle;
private transformStyleHorizontal = { transform: [{ scaleX: -1 }] };
private transformStyleHorizontal =
PlatformConfig.invertedTransformStyleHorizontal;

private distanceFromWindow = 0;
private contentStyle: ContentStyleExplicit = {
paddingBottom: 0,
Expand Down
1 change: 1 addition & 0 deletions src/native/config/PlatformHelper.android.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const PlatformConfig = {
defaultDrawDistance: 250,
// Using rotate instead of scaleY on Android to avoid performance issues. Issue: https://github.com/Shopify/flash-list/issues/751
invertedTransformStyle: { transform: [{ rotate: "180deg" }] },
invertedTransformStyleHorizontal: { transform: [{ rotate: "180deg" }] },
};
const getCellContainerPlatformStyles = (
inverted: boolean,
Expand Down
1 change: 1 addition & 0 deletions src/native/config/PlatformHelper.ios.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { BaseItemAnimator } from "recyclerlistview";
const PlatformConfig = {
defaultDrawDistance: 250,
invertedTransformStyle: { transform: [{ scaleY: -1 }] },
invertedTransformStyleHorizontal: { transform: [{ scaleX: -1 }] },
};
const getCellContainerPlatformStyles = (
inverted: boolean,
Expand Down
1 change: 1 addition & 0 deletions src/native/config/PlatformHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { DefaultJSItemAnimator } from "recyclerlistview/dist/reactnative/platfor
const PlatformConfig = {
defaultDrawDistance: 250,
invertedTransformStyle: { transform: [{ scaleY: -1 }] },
invertedTransformStyleHorizontal: { transform: [{ scaleX: -1 }] },
};
const getCellContainerPlatformStyles = (
inverted: boolean,
Expand Down
1 change: 1 addition & 0 deletions src/native/config/PlatformHelper.web.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { DefaultJSItemAnimator } from "recyclerlistview/dist/reactnative/platfor
const PlatformConfig = {
defaultDrawDistance: 2000,
invertedTransformStyle: { transform: [{ scaleY: -1 }] },
invertedTransformStyleHorizontal: { transform: [{ scaleX: -1 }] },
};
const getCellContainerPlatformStyles = (
inverted: boolean,
Expand Down

0 comments on commit e2854a5

Please sign in to comment.