Posts

Showing posts with the label react-navigation

componentDidMount not being called after goBack navigation call

componentDidMount not being called after goBack navigation call I've set up a StackNavigator which will fire a redux action to fetch data on componentDidMount , after navigating to another screen and going back to the previous screen, componentDidMount is no longer firing and I'm presented with a white screen. I've tried to reset the StackNavigator using StackActions.reset but that just leads to my other screens not mounting as well and in turn presenting an empty screen. Is there a way to force componentDidMount after this.props.navigation.goBack() ? componentDidMount componentDidMount StackActions.reset componentDidMount this.props.navigation.goBack() Go Back Function _goBack = () => { this.props.navigation.goBack(); }; Navigation function to new screen _showQuest = (questId, questTitle ) => { this.props.navigation.navigate("Quest", { questId, questTitle, }); }; How are you rendering your components? It might be...

using states in a react-navigation without redux

using states in a react-navigation without redux as written in the react-navigation page: Warning: in the next major version of React Navigation, to be released in Fall 2018, we will no longer provide any information about how to integrate with Redux and it may cease to work. In the next version of react-navigation it could be hard to use redux with react-navigation. My question is: what can I do to use states (and passing states between screens) in a react-navigation app without using redux? 2 Answers 2 For children of navigator react-navigation gives you an withNavigation HOC, so you can easily wrap the component inside it to access the navigation state and navigate. withNavigation Why you integrate react navigation with redux? For me, I want to be able to perform navigation actions from outside of my components(screens). Eg: Redux-saga. If we don't integrate, we can't navigate via red...