Access to pages directly after expo build:web

I have make a project with expo.
I need to access directly to a subpage (such as https://example.com/backoffice)

In the App.js I have make this:

...
const linking = {
    prefixes: ['https:/example.com'],
    config: {
      screens: {
        Home: '',
        Backoffice: '/backoffice',
      }
    },
  };

  return (
    <NavigationContainer linking={linking}>
...

If I execute the code in development mode and I call the site to :19006 port, I can access directly to subpages. (https://example.com:19006/backoffice)

If I execute the code after expo build:web and npx serve web-build I can’t access to subpage (I receive a 404 not found).
This is my serve.json

{
  "headers": [
     {
        "source": "static/**/*.js",
        "headers": [
           {
              "key": "Cache-Control",
              "value": "public, max-age=300, immutable"
           }
        ]
     }
  ]
}

Hi. I’ve not used NavigationContainer before, so I’m not sure if this is the problem, but you’re missing a / from your prefix.

Also, based on the documentation, I don’t think your Screens are supposed to have a leading /.

Thanks, now works.

1 Like