Open Siyavoshi opened 4 years ago
I'm using React Navigation v5 and have homepage: https://mydomain.com/subdirectory
which works initially but still, the routing immediately goes to the NotFound
route. Even with the below prefix it does not work:
const linking = {
prefixes: ['https://mydomain.com/subdirectory', 'myapp://'],
};
This page describes the situation a bit, but not directly: https://reactnavigation.org/docs/configuring-links#mapping-path-to-route-names
@AlexGrafe this repo is for old versions of React Navigation. For anything related to latest versions React Navigation, you should open an issue in the main repo.
Regarding your problem, as mentioned in docs, prefixes
is only used on Android and iOS. https://reactnavigation.org/docs/navigation-container#linkingprefixes
You should make subdirectory/
part of your path config itself. For example: instead of Home: 'home'
, use Home: 'subdirectory/home'
Hi, I've opened this same issue on Expo's repo as well to no avail.
I'm using react-navigation v4 + @react-navigation/web alongside Expo 38 bare workflow. I added "homepage": "http://localhost/mypwa/" to the package.json file. I run expo build:web then copy the contents of web-build to WAMP's www/mypwa/ folder.
When I open up my PWA, the project starts just fine but the URL is incorrect. Same results for when I run yarn web. I expect the first URL to be localhost/mypwa/LoginScreen but it's actually localhost/LoginScreen. Now this doesn't ruin my pwa or anything since I can navigate through the app just fine. The problem is when I "Add to Home Screen" the URL, my website's main page is added to the homescreen instead of the PWA.
I also implemented react navigation's web container: const AppContainer = isWeb ? createBrowserApp(AppSwitchNavigator) : createAppContainer(AppSwitchNavigator);
I haven't modified webpack.config.js since I don't know enough about webpack.