New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
React.Strict breaks react-navigation Linking on Web #10988
Comments
I am having the same issue, but I believe the problem is related to my configurations. Did you have any progress here? |
I found no solution besides removing the <React.StrictMode/> element. |
Same here but I'm on Here is my code function App() {
const scheme = useColorScheme();
return (
<NavigationContainer
linking={{
prefixes: ["devez://"],
config: {
screens: {
Home: { path: "" },
About: { path: "about" },
},
},
}}
theme={scheme === "dark" ? DarkTheme : DefaultTheme}
>
<Stack.Navigator>
<Stack.Screen name="Home" component={HomeScreen} />
<Stack.Screen name="About" component={AboutScreen} />
</Stack.Navigator>
</NavigationContainer>
);
} When I wrap this with |
I encountered this too, and with some well-placed I believe the issue stems from logic surrounding My team is working around the issue by disabling strict mode. |
We encountered this as well, but only when using Only after upgrading to |
Is there any update on this issue? I'd rather not disable strict mode. |
Are there any updates? |
Maybe better to switch to expo-router or some other library/framework if you really need the strict mode. It doesn't seem to be a high prio issue here. Up to you if it's worth the effort for your project. |
This is definitely not an issue on v6.x but using the v7.x Static Router does introduce this bug. |
I have also experienced this issue. Glad someone found the cause as I was faffing for ages... I can confirm that removing either the |
Btw expo-router doesn't use strict mode because of this same issue. I'm digging into it currently, if anyone has any idea of where exactly the issue is that'd be hugely helpful. |
Tried making as much of useLinking and other hooks not rely on unsafe refs and have the right dependencies in their effect arrays without luck. |
Current behavior
Given a basic app generated via 'Create React App' with React-Navigation integrated does not support Linkage on Web. When running locally links do not work properly on page load. Whatever path is passed to the location bar is ignored, the first ( default ) route is loaded. Attached is a screen cast of the behavior.
Screen.Recording.2022-11-08.at.4.06.56.PM.mov
Expected behavior
I except the path provided in the location bar to be used for the initial navigation route.
I narrowed the issue down to <React.StrictMode/> This Component is incorporated in the Create React App template. Unwrapping the main app from that component fixes the issue. With it removed, the initial path is being used to load the initial route.
Reproduction
https://github.com/floataboat/cuddly-invention
Platform
Packages
Environment
The text was updated successfully, but these errors were encountered: