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

Is there a way to navigate to a default screen (Profile) if the path name does not match a route that I define explicitly?

$
0
0

I have tried writing the config object for my react native app according to the react-navigation configuring links docs.

I defined a series of path --> route mappings including Chat:'feed' and Explore:'news'

My goal is for the app to default to the Profile screen when resolving https://example.com/someusername and pass 'someusername' as the id param. Similar to how https://instagram.com/apple maps directly to the profile screen for @apple's account.

const linking = {  prefixes: ['https://example.com', 'example://'],  config: {    Home: {      path: '',      screens: {        Chat: 'feed',        Explore: 'news',        Profile: ':id',      },    },  },}

I will not allow users to make accounts @feed, @news, etc. to avoid conflict. I also display "user not found" message if 'someusername' does not exist yet

Is there a correct way to do this config object? Or if I need to write custom getStateFromPath / getPathFromState functions, does anyone have an example?


Viewing all articles
Browse latest Browse all 16552

Trending Articles



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