From d514d701260536251be799802b2ecd0949e1605b Mon Sep 17 00:00:00 2001 From: keplyx Date: Sun, 8 Mar 2020 14:29:57 +0100 Subject: [PATCH] Improved proximo list loading --- screens/Proximo/ProximoListScreen.js | 32 ++++++++++++++-------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/screens/Proximo/ProximoListScreen.js b/screens/Proximo/ProximoListScreen.js index d57cf16..e4b78b5 100644 --- a/screens/Proximo/ProximoListScreen.js +++ b/screens/Proximo/ProximoListScreen.js @@ -61,9 +61,9 @@ export default class ProximoListScreen extends React.Component { 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: , + modalCurrentDisplayItem: null, }; this.onSearchStringChange = this.onSearchStringChange.bind(this); @@ -72,6 +72,20 @@ export default class ProximoListScreen extends React.Component { 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 { } } - /** - * 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 (