0
I’m developing a App
in ReactNative
using Expo, but I can’t update the useEffect(() => {}, [])
of the previous route from navigation.goBack()
.
Example:
Here time the Index page.
function Index(){
const navigation = useNavigation();
useEffect({
...
}, []);
return(
<View>
<TouchableOpacity onPress={() => navigation.navigate('Info')}>
Index
</TouchableOpacity>
</View>
)
}
Here comes the Info page
function Info(){
const navigation = useNavigation();
return(
<View>
<TouchableOpacity onPress={() => navigation.goBack()}>
Info
</TouchableOpacity>
</View>
)
}
It happens that the moment you return to Index from the page Info the useEffect
page Index does not update.
Is there any way to make these hooks
upgrade?
Installed packages:
- expo: 37.0.3,
- expo-cli: 3.18.0,
- @React-navigation/Native: 5.1.5,
- Ode: v12.13.0,
Have you read about Navigation Events? I’ve never developed in React Native, but maybe this will do for you
– Rafael Tavares