简体   繁体   中英

How to write Deep link in React Native

I have Implemented Deep Linking in react native. My routing is done like this.

AuthNavigator (Stack Navigator)

  • Login
  • Signup
  • Home (Stack Navigator)

Home navigator (Stack Navigator)

  • EquipmentBooking
  • EquipmentStatus

I want to navigate to EquipmentStatus screen , so I created deep linking config like this

 const config = { screens: { Home: { screens: { EquipmentStatus: 'equipmentstatus' } } } }

but when I click on the notification, it is opening the app (when it is closed) but it's not navigating to a particular screen. when the app is in open, it does nothing.

so can anyone suggest to me how to write a deep linking config for this scenario?

To navigate particular screen

render() {
   return (
      <AppNavigator
         // ...
         uriPrefix={‘demo://’}
       />
   );
}




 export default createStackNavigator(
  {
    First: {
      screen: First,
      path: 'first/:firstId',
    },
    Second: {screen: Second, path: 'second/:secondId'},
    Third: {screen: Third, path: 'third'},
  },
  {
    initialRouteName: 'First',
  },
);
        

Paste this url to browser: demo://home/second/42

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM