From 048ff446903559543cbe5ed92b9baf2c973a512e Mon Sep 17 00:00:00 2001 From: bang9 Date: Wed, 16 Aug 2023 10:21:58 +0900 Subject: [PATCH 1/2] chore: update inverted flatlist warning condition --- .../src/components/ChatFlatList/index.tsx | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/packages/uikit-react-native/src/components/ChatFlatList/index.tsx b/packages/uikit-react-native/src/components/ChatFlatList/index.tsx index e102fc4d9..29a071e87 100644 --- a/packages/uikit-react-native/src/components/ChatFlatList/index.tsx +++ b/packages/uikit-react-native/src/components/ChatFlatList/index.tsx @@ -6,7 +6,18 @@ import { NOOP, SendbirdMessage, getMessageUniqId, useFreshCallback } from '@send import FlatListInternal from './FlatListInternal'; -let ANDROID_BUG_ALERT_SHOWED = Platform.OS !== 'android'; +function isInvertedFlatListFixedVersion() { + if (Platform.constants.reactNativeVersion?.major < 1) { + if (Platform.constants.reactNativeVersion?.minor < 73) { + if (Platform.constants.reactNativeVersion?.patch < 4) { + return false; + } + } + } + return true; +} + +let ANDROID_BUG_ALERT_SHOWED = Platform.OS !== 'android' || isInvertedFlatListFixedVersion(); const BOTTOM_DETECT_THRESHOLD = 50; const UNREACHABLE_THRESHOLD = Number.MIN_SAFE_INTEGER; @@ -44,7 +55,8 @@ const ChatFlatList = forwardRef(function ChatFlatList( ANDROID_BUG_ALERT_SHOWED = true; // eslint-disable-next-line no-console console.warn( - 'UIKit Warning: The inverted FlatList has a performance issue on Android. Maybe this is a bug.\n' + + 'UIKit Warning: The Inverted FlatList had performance issues on Android.\n' + + 'This issue was fixed in 0.72.4+\n' + 'Please refer to the link: https://github.com/facebook/react-native/issues/30034', ); } From 9c65d7d6295de2d73475182b2ea14d121669962c Mon Sep 17 00:00:00 2001 From: bang9 Date: Wed, 16 Aug 2023 10:41:05 +0900 Subject: [PATCH 2/2] chore: remove fixme comment from ChatFlatList --- .../uikit-react-native/src/components/ChatFlatList/index.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/uikit-react-native/src/components/ChatFlatList/index.tsx b/packages/uikit-react-native/src/components/ChatFlatList/index.tsx index 29a071e87..241610007 100644 --- a/packages/uikit-react-native/src/components/ChatFlatList/index.tsx +++ b/packages/uikit-react-native/src/components/ChatFlatList/index.tsx @@ -26,7 +26,6 @@ type Props = Omit, 'onEndReached'> & { onTopReached: () => void; onScrolledAwayFromBottom: (value: boolean) => void; }; -// FIXME: Inverted FlatList performance issue on Android {@link https://github.com/facebook/react-native/issues/30034} const ChatFlatList = forwardRef(function ChatFlatList( { onTopReached, onBottomReached, onScrolledAwayFromBottom, onScroll, ...props }, ref,