I am new to React Native. How can we refresh/reload previous screen when returning to it by calling goBack()
?
Lets say we have 3 screens A, B, C:
<
How about using useIsFocused hook?
https://reactnavigation.org/docs/function-after-focusing-screen/#re-rendering-screen-with-the-useisfocused-hook
const componentB = (props) => {
// check if screen is focused
const isFocused = useIsFocused();
// listen for isFocused, if useFocused changes
// call the function that you use to mount the component.
useEffect(() => {
updateSomeFunction()
},[isFocused]);
}