'Prevent react-navigation to use browser history API when using linking

We have a use case where <NavigationContainer/> is in a seperate panel (ie. subapp) in our React app. Our navigation container has a linking prop but we do not want to sync the navigation state to the browser's URL as we want to have seperate navigation functionality on the top level app.

Is there a way to prevent the URL syncing?

React Router has this functionality: https://v5.reactrouter.com/web/api/MemoryRouter



Solution 1:[1]

Pass enabled: false for web in linking prop:

<NavigationContainer
  linking={{
    enabled: Platform.OS !== "web",
    // other stuff
  }}
>

https://reactnavigation.org/docs/navigation-container/#linkingenabled

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 satya164