Reputation: 486
I am in a proyect and I need to filter some information in some diferent ways like ascendent, most recent and some other. For that, I have to refresh the page and send that info to the same page. This is the code where I want to put it:
<TouchableOpacity
key='privacy'
onPress={() => Actions.quicksearch({ searchval: this.state.searchval, searchlable: this.state.searchlab, text: this.state.text, order: 'asc' })}
>
<Text style={styles.navmenuTitle}>
Name (A-Z)
</Text>
</TouchableOpacity>
I am redirecting it to the same page couse its the easiest way to do it but it opens as many pages as you want and all are the same pages with different filters. I also tried to use action.refresh but nothing happens.
Thank you!
Upvotes: 1
Views: 13930
Reputation: 16287
Directly calling this.state.someVar =... does not trigger the refresh action. You can manually call:
this.forceUpdate();
But this is not recommended.
A better way is to call setState(...):
this.setState(...); //Prefered
this.state.someVar = ... //Not recommended
this.forceUpdate()/ //Not recommended
Upvotes: 6