@@ -75,6 +75,11 @@ const styles = StyleSheet.create({
7575 } ,
7676 flex : { flex : 1 } ,
7777 invert : { transform : [ { scaleY : - 1 } ] } ,
78+ invertAndroid : {
79+ // Invert the Y AND X axis to prevent a react native issue that can lead to ANRs on android 13
80+ // details: https://github.com/Expensify/App/pull/12820
81+ transform : [ { scaleX : - 1 } , { scaleY : - 1 } ] ,
82+ } ,
7883 listContainer : {
7984 flex : 1 ,
8085 width : '100%' ,
@@ -88,6 +93,10 @@ const styles = StyleSheet.create({
8893 } ,
8994} ) ;
9095
96+ const InvertedCellRendererComponent = ( props : React . PropsWithChildren < unknown > ) => (
97+ < View { ...props } style = { styles . invertAndroid } />
98+ ) ;
99+
91100const keyExtractor = <
92101 StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics ,
93102> (
@@ -970,17 +979,23 @@ const MessageListWithContext = <
970979 return null ;
971980 } ;
972981
982+ const shouldApplyAndroidWorkaround =
983+ inverted && Platform . OS === 'android' && Platform . Version >= 33 ;
984+
973985 return (
974986 < View
975987 style = { [ styles . container , { backgroundColor : white_snow } , container ] }
976988 testID = 'message-flat-list-wrapper'
977989 >
978990 < FlatList
991+ CellRendererComponent = {
992+ shouldApplyAndroidWorkaround ? InvertedCellRendererComponent : undefined
993+ }
979994 contentContainerStyle = { [ styles . contentContainer , contentContainer ] }
980995 data = { messageList }
981996 /** Disables the MessageList UI. Which means, message actions, reactions won't work. */
982997 extraData = { disabled || ! hasNoMoreRecentMessagesToLoad }
983- inverted = { inverted }
998+ inverted = { shouldApplyAndroidWorkaround ? false : inverted }
984999 keyboardShouldPersistTaps = 'handled'
9851000 keyExtractor = { keyExtractor }
9861001 ListEmptyComponent = { renderListEmptyComponent }
@@ -1000,7 +1015,12 @@ const MessageListWithContext = <
10001015 ref = { refCallback }
10011016 renderItem = { renderItem }
10021017 scrollEnabled = { overlay === 'none' }
1003- style = { [ styles . listContainer , listContainer ] }
1018+ showsVerticalScrollIndicator = { ! shouldApplyAndroidWorkaround }
1019+ style = { [
1020+ styles . listContainer ,
1021+ listContainer ,
1022+ shouldApplyAndroidWorkaround ? styles . invertAndroid : undefined ,
1023+ ] }
10041024 testID = 'message-flat-list'
10051025 viewabilityConfig = { flatListViewabilityConfig }
10061026 { ...additionalFlatListProps }
0 commit comments