Quantcast
Channel: Active questions tagged react-native+ios - Stack Overflow
Viewing all articles
Browse latest Browse all 16552

React Native Deep Linking not redirecting to specified Screen

$
0
0

I'm trying to implement deep linking in React Native folowing this doc: https://reactnavigation.org/docs/configuring-links.

The main problem here is that i'm not able to open a specific screen, it always open the main screen.

I'm currently only testing in iOS, but in Android same occurs.

I defined custom url scheme

<dict><key>CFBundleURLName</key><string>com.react_native_starter_kit</string><key>CFBundleURLSchemes</key><array><string>test</string></array></dict>

Defined linking obj

const linking = {  prefixes: ['test://'],  config: {    screens: {      App: {        screens: {          Settings: 'settings/:id',        },      },    },  },};

And Navigation

export const Router = () => {  ...  return (<NavigationContainer linking={linking}><Main /></NavigationContainer>  );};const Main = (props) => {  ...  return (<Stack.Navigator      screenOptions={{ headerShown: false }}      initialRouteName={routesName.App}>      {userToken ? (<Stack.Screen name={routesName.App} component={TabNavigator} />      ) : (<Stack.Screen name={routesName.Auth} component={AuthStack} />      )}</Stack.Navigator>  );};const TabNavigator = () => {  ...  return (<Tab.Navigator><Tab.Screen        name={routesName.Home}        component={HomeStack}        options={navigationOptions(routesName.Home, theme)}      /><Tab.Screen        name={routesName.Settings}        component={SettingsStack}        options={navigationOptions(routesName.Settings, theme)}      /></Tab.Navigator>  );};

When i type test://settings/123, inside safari, or xcrun simctl openurl booted test://settings/123 it should open settings tab, but it always only open main screen. I've tryied a lot of linkin obj combinations, same result always. Even when i remove linking={linking} the behavior is the same, app opens main screen. It is like navigation is ignoring linking={linking}.


Viewing all articles
Browse latest Browse all 16552

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>