Fixed proximo list sorting not working

This commit is contained in:
keplyx 2020-03-10 17:18:02 +01:00
parent 651435dfc6
commit 35948ddfba
2 changed files with 15 additions and 0 deletions

View file

@ -1,9 +1,23 @@
import * as React from 'react'; import * as React from 'react';
import {FlatList} from "react-native"; import {FlatList} from "react-native";
type Props = {
data: Array<Object>,
keyExtractor: Function,
renderItem: Function,
updateData: number,
}
/**
* This is a pure component, meaning it will only update if a shallow comparison of state and props is different.
* To force the component to update, change the value of updateData.
*/
export default class PureFlatList extends React.PureComponent<Props>{ export default class PureFlatList extends React.PureComponent<Props>{
static defaultProps = {
updateData: null,
};
render() { render() {
return ( return (
<FlatList <FlatList

View file

@ -318,6 +318,7 @@ class ProximoListScreen extends React.Component<Props, State> {
data={this.state.currentlyDisplayedData} data={this.state.currentlyDisplayedData}
keyExtractor={this.keyExtractor} keyExtractor={this.keyExtractor}
renderItem={this.renderItem} renderItem={this.renderItem}
updateData={this.state.currentSortMode}
/> />
</View> </View>
); );