I'm setting my integer array on selectedStyleIds. Why is my this.props.navigaion.setParams not working?
_setSelectedStyleIds = (selectedStyleIds) => {
const action = NavigationActions.setParams({
params: {selectedStyleIds},
key: 'id-1509842157447-6' <- got this from console
});
this.props.navigation.dispatch(action);
this.props.navigation.setParams({styleIds:selectedStyleIds});
this.setState({selectedStyleIds});
}
onCheck = ({selectedStyleIds}) => {
console.log('onCheck');
console.log(selectedStyleIds); <- [1,2,3,4,5]
this.props._setSelectedStyleIds(selectedStyleIds);
this.setState({selectedStyleIds}); <- working
}
_handleTagStylePress = () => {
this.props.navigation.navigate('TagStyle', {onCheck: this.onCheck, selectedStyleIds: this.state.selectedStyleIds});
}
on onNavigatioOptions (just for debugging)
onPress={() => {
let {image, text, ..., selectedSeasonIds,
gender, selectedSizeIds, selectedColorIds, selectedStyleIds,
brand, ..., base64 } = navigation.state.params;
console.log('onsave')
console.log(navigation.state.params.selectedStyleIds) <<-- []
I've been checking these lines more than 50 times but apparently this.props.navigation.setParams({selectedStyleIds}); is not working.
All other things have no problem on setting state and params but ONLY the selectedStyleIds can't be set to navigation.state.params.