react-native-navigation icon indicating copy to clipboard operation
react-native-navigation copied to clipboard

Deep links don't finish when crossing roots

Open HoogsterInc opened this issue 8 years ago • 2 comments

This is my first post - I'm a shy noob. But for the life of me I can't figure this out. Any help is greatly appreciated.

My project uses redux and has several "root" changes with both tabBasedApps and singleScreenApps. When using the drawer to deep link to a specific tab, if you are in the current tabBasedApp root, it will correctly go to the right tab with what I am using (below). But if you are in a different root of the application (tabs or single app) and have to change the root and then try to link to the correct tab - it doesn't work. It seems to skip over any navigator method and just print the console logs.

Below is my event listener for the deep link. Figured I'd leave the console logs in so you could see what I was trying to see. "appRoot" and "navigator" aren't "this.props..." because I am passing the nav event into a separate handler to reduce code duplication - it works with everything else I have tested, just not this (which I am assuming is not the handlers fault but I could be wrong).

Warning I get on iOS: Possible Unhandled Promise Rejection (id:0) Error: could not find UITabBarController Nothing on Android, it just doesn't work.

I'm putting all the below in "insert code" but only part is going in.. ? sorry

` if(event.type === 'DeepLink') { console.log('deeplink from nav'); const parts = event.link.split('/'); if(parts[0] === 'profile') { console.log('profile was hit'); appRoot('profile');

        if(parts[1] === 'friends'){
            console.log('friends was hit');

            navigator.toggleDrawer({
                side: 'left',
                animated: true,
            });
            console.log('drawer toggle from nav');
            navigator.switchToTab({
                tabIndex: 1,
            });
            console.log('tab switched from nav');
        }
    }

}`

Steps to Reproduce

Build project using the redux example to be able to switch between roots. Have drawer with a button to go to a specific tab in one of the root tabBasedApps Handle the deep link from the drawer


Environment

  • React Native Navigation version: ^1.1.352
  • React Native version: 0.51.0
  • Platform(s) (iOS, Android, or both?): both
  • Device info (Simulator/Device? OS version? Debug/Release?): simulators on both. iphone 6 and Pixel 2

HoogsterInc avatar Feb 10 '18 00:02 HoogsterInc

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you believe the issue is still relevant, please test on the latest version and report back. Thank you for your contributions.

stale[bot] avatar Jun 02 '18 07:06 stale[bot]

The issue has been closed for inactivity.

stale[bot] avatar Jun 09 '18 07:06 stale[bot]