Skip to content
This repository was archived by the owner on May 20, 2021. It is now read-only.
This repository was archived by the owner on May 20, 2021. It is now read-only.

Expo Web App in a Subdirectory Results in Wrong URL #52

Open

Description

@Siyavoshi

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.

Activity

  1. AlexGrafe commented on Oct 17, 2020

    @AlexGrafe

    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

  2. satya164 commented on Oct 18, 2020

    @satya164
    Member

    @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'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions