I'm working on a React Native project using React Navigation. We have 5 bottom tabs, and each tab contains a large number of nested stacks. To navigate to frequently used screens, we have to add many stacks, which makes the navigation structure complex and hard to manage.
To simplify this, I’m thinking of grouping frequently used screens into a single stack. When accessing these screens from different bottom tabs, I plan to use React Navigation’s deep link listener for internal navigation.
export let listenerFn = null;
subscribe(listener) {
const unsubscribeFirebase = dynamicLinks().onLink(({ url }) => {
listenerFn = listener;
listener(url);
});
}
Would using the deep link listener like this for internal navigation cause any issues in the app? Is this an acceptable practice, or could it lead to potential problems?
Does exposing the listener for internal use cause issues with the stack history?
I'm working on a React Native project using React Navigation. We have 5 bottom tabs, and each tab contains a large number of nested stacks. To navigate to frequently used screens, we have to add many stacks, which makes the navigation structure complex and hard to manage.
To simplify this, I’m thinking of grouping frequently used screens into a single stack. When accessing these screens from different bottom tabs, I plan to use React Navigation’s deep link listener for internal navigation.
export let listenerFn = null;
subscribe(listener) {
const unsubscribeFirebase = dynamicLinks().onLink(({ url }) => {
listenerFn = listener;
listener(url);
});
}
Would using the deep link listener like this for internal navigation cause any issues in the app? Is this an acceptable practice, or could it lead to potential problems?
Does exposing the listener for internal use cause issues with the stack history?
Share Improve this question asked Feb 5 at 12:33 shjishji 11 Answer
Reset to default 0While using a deep link listener internally might work in a pinch, it can lead to subtle bugs and stack history issues. It’s generally better to rely on the navigation methods provided by React Navigation, which are designed to work with its state management. This approach will result in a more predictable and maintainable navigation experience in your app.