Improved proximo list loading

This commit is contained in:
keplyx 2020-03-08 14:29:57 +01:00
parent e48b319e8c
commit d514d70126

View file

@ -61,9 +61,9 @@ export default class ProximoListScreen extends React.Component<Props, State> {
this.originalData = this.props.route.params['data']['data'];
this.shouldFocusSearchBar = this.props.route.params['shouldFocusSearchBar'];
this.state = {
currentlyDisplayedData: this.originalData,
currentlyDisplayedData: this.originalData.sort(sortPrice),
currentSortMode: 1,
modalCurrentDisplayItem: <View/>,
modalCurrentDisplayItem: null,
};
this.onSearchStringChange = this.onSearchStringChange.bind(this);
@ -72,6 +72,20 @@ export default class ProximoListScreen extends React.Component<Props, State> {
this.onModalRef = this.onModalRef.bind(this);
}
/**
* Set the sort mode from state when components are ready
*/
componentDidMount() {
const button = this.getSortMenu.bind(this);
const title = this.getSearchBar.bind(this);
this.props.navigation.setOptions({
headerRight: button,
headerTitle: title,
headerTitleContainerStyle: {marginHorizontal: 0, right: 50, left: 50},
});
}
/**
* Set the current sort mode.
*
@ -101,20 +115,6 @@ export default class ProximoListScreen extends React.Component<Props, State> {
}
}
/**
* Set the sort mode from state when components are ready
*/
componentDidMount() {
const button = this.getSortMenu.bind(this);
const title = this.getSearchBar.bind(this);
this.props.navigation.setOptions({
headerRight: button,
headerTitle: title,
headerTitleContainerStyle: {marginHorizontal: 0, right: 50, left: 50},
});
this.setSortMode(1);
}
getSearchBar() {
return (
<Searchbar