Try to fix LayoutAnimation on RoomsListView

This commit is contained in:
Diego Mello 2022-11-29 16:11:50 -03:00
parent 34a30214c2
commit 4aeda3f778
2 changed files with 21 additions and 24 deletions

View File

@ -368,6 +368,7 @@ class RoomsListView extends React.Component<IRoomsListViewProps, IRoomsListViewS
callback?: () => void callback?: () => void
) => { ) => {
if (this.animated) { if (this.animated) {
this.scroll?.prepareForLayoutAnimationRender();
animateNextTransition(); animateNextTransition();
} }
this.setState(state, callback); this.setState(state, callback);
@ -774,10 +775,7 @@ class RoomsListView extends React.Component<IRoomsListViewProps, IRoomsListViewS
}; };
onEndReached = () => { onEndReached = () => {
// Run only when we're not grouping by anything this.getSubscriptions();
if (!this.isGrouping) {
this.getSubscriptions();
}
}; };
getScrollRef = (ref: any) => (this.scroll = ref); getScrollRef = (ref: any) => (this.scroll = ref);
@ -870,23 +868,25 @@ class RoomsListView extends React.Component<IRoomsListViewProps, IRoomsListViewS
} }
return ( return (
<FlashList <View style={[styles.container, { backgroundColor: themes[theme].backgroundColor }]}>
ref={this.getScrollRef} <FlashList
data={searching ? search : chats} ref={this.getScrollRef}
extraData={theme || refreshing || displayMode} data={searching ? search : chats}
keyExtractor={keyExtractor} extraData={theme || refreshing || displayMode}
// @ts-ignore keyExtractor={keyExtractor}
contentContainerStyle={[styles.list, { backgroundColor: themes[theme].backgroundColor }]} renderItem={this.renderItem}
renderItem={this.renderItem} ListHeaderComponent={this.renderListHeader}
ListHeaderComponent={this.renderListHeader} estimatedItemSize={height}
estimatedItemSize={height} keyboardShouldPersistTaps='always'
keyboardShouldPersistTaps='always' refreshControl={
refreshControl={ searching ? undefined : (
<RefreshControl refreshing={refreshing} onRefresh={this.onRefresh} tintColor={themes[theme].auxiliaryText} /> <RefreshControl refreshing={refreshing} onRefresh={this.onRefresh} tintColor={themes[theme].auxiliaryText} />
} )
onEndReached={this.onEndReached} }
onEndReachedThreshold={0.5} onEndReached={this.isGrouping ? this.onEndReached : undefined}
/> onEndReachedThreshold={this.isGrouping ? 0.5 : undefined}
/>
</View>
); );
}; };

View File

@ -6,9 +6,6 @@ export default StyleSheet.create({
container: { container: {
flex: 1 flex: 1
}, },
list: {
width: '100%'
},
dropdownContainerHeader: { dropdownContainerHeader: {
height: 41, height: 41,
borderBottomWidth: StyleSheet.hairlineWidth, borderBottomWidth: StyleSheet.hairlineWidth,