Skip to content

Commit 14b667a

Browse files
committed
fix: empty state component was falsely inverted (#1971)
1 parent e000474 commit 14b667a

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

package/src/components/MessageList/MessageList.tsx

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -956,10 +956,19 @@ const MessageListWithContext = <
956956
});
957957
}
958958

959-
const renderListEmptyComponent = () => (
960-
<View style={[styles.flex, styles.invert]} testID='empty-state'>
961-
<EmptyStateIndicator listType='message' />
962-
</View>
959+
const shouldApplyAndroidWorkaround =
960+
inverted && Platform.OS === 'android' && Platform.Version >= 33;
961+
962+
const renderListEmptyComponent = useCallback(
963+
() => (
964+
<View
965+
style={[styles.flex, shouldApplyAndroidWorkaround ? styles.invertAndroid : styles.invert]}
966+
testID='empty-state'
967+
>
968+
<EmptyStateIndicator listType='message' />
969+
</View>
970+
),
971+
[EmptyStateIndicator, shouldApplyAndroidWorkaround],
963972
);
964973

965974
if (!FlatList) return null;
@@ -979,9 +988,6 @@ const MessageListWithContext = <
979988
return null;
980989
};
981990

982-
const shouldApplyAndroidWorkaround =
983-
inverted && Platform.OS === 'android' && Platform.Version >= 33;
984-
985991
return (
986992
<View
987993
style={[styles.container, { backgroundColor: white_snow }, container]}

0 commit comments

Comments
 (0)