diff --git a/patches/@react-navigation+core+6.4.11+001+fix-react-strict-mode.patch b/patches/@react-navigation+core+6.4.11+001+fix-react-strictmode.patch similarity index 83% rename from patches/@react-navigation+core+6.4.11+001+fix-react-strict-mode.patch rename to patches/@react-navigation+core+6.4.11+001+fix-react-strictmode.patch index 5a141ef2d4f8..8941bb380a79 100644 --- a/patches/@react-navigation+core+6.4.11+001+fix-react-strict-mode.patch +++ b/patches/@react-navigation+core+6.4.11+001+fix-react-strictmode.patch @@ -1,8 +1,8 @@ diff --git a/node_modules/@react-navigation/core/lib/module/useNavigationBuilder.js b/node_modules/@react-navigation/core/lib/module/useNavigationBuilder.js -index 051520b..0ac7357 100644 +index 051520b..6fb49e0 100644 --- a/node_modules/@react-navigation/core/lib/module/useNavigationBuilder.js +++ b/node_modules/@react-navigation/core/lib/module/useNavigationBuilder.js -@@ -174,10 +174,7 @@ export default function useNavigationBuilder(createRouter, options) { +@@ -174,10 +174,6 @@ export default function useNavigationBuilder(createRouter, options) { getIsInitial } = React.useContext(NavigationStateContext); const stateCleanedUp = React.useRef(false); @@ -10,11 +10,10 @@ index 051520b..0ac7357 100644 - setCurrentState(undefined); - stateCleanedUp.current = true; - }, [setCurrentState]); -+ const setState = React.useCallback(state => { if (stateCleanedUp.current) { // State might have been already cleaned up due to unmount -@@ -291,6 +288,9 @@ export default function useNavigationBuilder(createRouter, options) { +@@ -291,6 +287,9 @@ export default function useNavigationBuilder(createRouter, options) { // So we override the state object we return to use the latest state as soon as possible state = nextState; React.useEffect(() => { @@ -24,11 +23,10 @@ index 051520b..0ac7357 100644 setKey(navigatorKey); if (!getIsInitial()) { // If it's not initial render, we need to update the state -@@ -299,15 +299,10 @@ export default function useNavigationBuilder(createRouter, options) { - setState(nextState); +@@ -300,14 +299,10 @@ export default function useNavigationBuilder(createRouter, options) { } return () => { -- // We need to clean up state for this navigator on unmount + // We need to clean up state for this navigator on unmount - // We do it in a timeout because we need to detect if another navigator mounted in the meantime - // For example, if another navigator has started rendering, we should skip cleanup - // Otherwise, our cleanup step will cleanup state for the other navigator and re-initialize it @@ -37,7 +35,6 @@ index 051520b..0ac7357 100644 - cleanUpState(); - } - }, 0); -+ // We need to clean up state for this navigator on unmount + if (getCurrentState() !== undefined && getKey() === navigatorKey) { + setCurrentState(undefined); + stateCleanedUp.current = true;