Skip to content

Instantly share code, notes, and snippets.

@emeraldsanto
Last active September 4, 2021 03:42
Show Gist options
  • Select an option

  • Save emeraldsanto/08ff182e93ec2e446a71c83d08565128 to your computer and use it in GitHub Desktop.

Select an option

Save emeraldsanto/08ff182e93ec2e446a71c83d08565128 to your computer and use it in GitHub Desktop.
Achieving type safe deep linking in React Native with react-navigation #2
import { NavigationContainer } from '@react-navigation/native';
const config = {
screens: {
Home: {
initialRouteName: 'Feed',
screens: {
Profile: 'users/:id',
Feed: 'feed',
},
},
Settings: 'settings',
},
};
function Home() {
return (
<Tab.Navigator>
<Tab.Screen name="Profile" component={Profile} />
<Tab.Screen name="Feed" component={Feed} />
</Tab.Navigator>
);
}
function App() {
return (
<NavigationContainer linking={linking} fallback={<Text>Loading...</Text>}>
<Stack.Navigator>
<Stack.Screen name="Home" component={Home} />
<Stack.Screen name="Settings" component={Settings} />
</Stack.Navigator>
</NavigationContainer>
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment