React native deep linking routing not working - react-native

I am using dynamic links for deep linking.
const linking = {
prefixes: [
www.example.com
],
config: {
screens: {
Chat: {
path: ":id",
parse: {
id: (id) => `${id}`,
},
},
Profile: 'user',
},
},
};
function App() {
return (
<NavigationContainer linking={linking} fallback={<Text>Loading...</Text>}>
<Stack.Screen name="Chat" component={ChatScreen} />
<Stack.Screen name="Profile" component={ProfileScreen} />
</NavigationContainer>
);
}
www.example.com/user always route to the ChatScreen screen. I want to route in ProfileScreen. How to handle config file in linking?

Set your config as
const config = {
screens: {
Profile: '/user',
Chat:'/chat/:id'
},
};
your linking should be
const linking = {
prefixes: [
'www.example.com',
],
config,
};
By doing so, www.example.com/user will be routed to ProfileScreen component. www.example.com/chat/:<some id> will take you to ChatScreen with route param as id.
Update: It seems you are trying to go to ChatScreen by www.example.com/<some id> and also have www.example.com/user to load ProfileScreen. The problem is React navigation considers string "user" as param id and takes you to ChatScreen itself. That is the reason I added "chat" in the path of ChatScreen.
If you really want to use www.example.com/<some id> to load ChatScreen, you can use getStateFromPath and write your own logic to differentiate between ids and path names. To do that, your linking will be
const linking = {
prefixes: [
'www.example.com',
],
config,
getStateFromPath: (path, options) => {
if (path ==='/user') {
return {routes: [{ name: 'Profile' }],
} ;
} else {
return {routes: [{ name: 'Chat',params:{id:getIdFromPath(path)} }],
} ;
}
},
};
here checkIfValidPath is for checking whether the url path is an actual id or "user". getIdFromPath is to extract id from the url. I havent tested this, but this should work.
const checkIfValidPath=(path)=>{
return path !=='www.example.com/user';
}
const getIdFromPath =(path)=>{
return path.slice(1, path.length);
}

This worked for me
const getIdFromPath = (path) => { return path.slice(1, path.length); }
const linking = {
prefixes: [
www.example.com
],
config: {
screens: {
Chat: {
path: ":id",
parse: {
id: (id) => `${id}`,
},
},
Profile: 'user',
},
},
getStateFromPath: (path, options) => {
if (path === '/user') {
return { routes: [{ name: 'Profile' }], };
}
else {
return { routes: [{ name: 'Chat', params: { id: getIdFromPath(path) } }], };
}
}
};
function App() {
return (
<NavigationContainer linking={linking} fallback={<Text>Loading...</Text>}>
<Stack.Screen name="Chat" component={ChatScreen} />
<Stack.Screen name="Profile" component={ProfileScreen} />
</NavigationContainer>
);
}

Related

How reset tab history in Tabs on tab click using ReactNavigation 5?

I am using React Navigation5.
I have a tab navigator and want to clear history of tab on click tab.
For example, I am on tab 1, and go to tab 2.
From tab2, i navigate
screen1->screen2->screen3
Now If i click on tab, it should come to initial screen (screen1).
but its not working, it working in wrong way.
here is my code.
import React from 'react';
import { createStackNavigator } from '#react-navigation/stack';
import { createBottomTabNavigator } from '#react-navigation/bottom-tabs';
import { CommonActions, StackActions } from '#react-navigation/native';
// Custom imports:
import StartScreen from '../screens/start/StartScreen';
import ProductsScreen from '../screens/products/ProductsScreen';
import AddCustomerScreen from '../screens/customers/AddCustomerScreen';
import CustomersScreen from '../screens/customers/CustomersScreen';
import WebviewScreen from '../screens/webview/WebviewScreen';
// Menu Screen
import MenuScreen from '../screens/menu/MenuScreen';
import CurrentAccountScreen from '../screens/menu/CurrentAccountScreen';
import AccountDetailScreen from '../screens/menu/AccountDetailScreen';
import AppInfoScreen from '../screens/menu/AppInfoScreen';
import MessagesScreen from '../screens/menu/MessagesScreen';
import { Colors, GlobalStyles } from '../constants';
import { Badge, CustomIcon } from '../components/icons';
import {
iconStart,
iconProducts,
iconCustomers,
iconMenu
} from '../components/icons/TabBarIcons';
import {
IconLowbarAddOrder,
} from '../components/IconFiles';
const Stack = createStackNavigator();
// Initial Parameters for WebView
let initParamsForWebView = {
url: '',
screenName: '',
haveUser: false,
user: false
};
/**
* Start Stack Navigator
**/
const INIT_START_ROUTE = 'Start';
function StartStack() {
return (
<Stack.Navigator screenOptions={{ headerShown: false }} initialRouteName={INIT_START_ROUTE}>
<Stack.Screen name="Start" component={StartScreen} />
<Stack.Screen name="Webview"
component={WebviewScreen}
initialParams={initParamsForWebView}
/>
</Stack.Navigator>
);
}
/**
* Products Stack Navigator
**/
const INIT_PRODUCTS_ROUTE = 'Products';
function ProductsStack() {
return (
<Stack.Navigator screenOptions={{ headerShown: false }} initialRouteName={INIT_PRODUCTS_ROUTE}>
<Stack.Screen name="Products" component={ProductsScreen} />
<Stack.Screen name="Webview"
component={WebviewScreen}
initialParams={initParamsForWebView}
/>
</Stack.Navigator>
);
}
/**
* Menu Stack Navigator
**/
const INIT_MENU_ROUTE = 'Menu';
function MenuStack() {
return (
<Stack.Navigator screenOptions={{ headerShown: false }} initialRouteName={INIT_CUSTOMERS_ROUTE}>
<Stack.Screen name="Menu" component={MenuScreen} />
<Stack.Screen name="CurrentAccount" component={CurrentAccountScreen} />
<Stack.Screen name="AccountDetail" component={AccountDetailScreen} />
<Stack.Screen name="AppInfo" component={AppInfoScreen} />
<Stack.Screen name="Messages" component={MessagesScreen} />
<Stack.Screen name="Webview"
component={WebviewScreen}
initialParams={initParamsForWebView}
/>
</Stack.Navigator>
);
}
function resetStack(navigation, _route, _stack, _screen){
console.log(_route);
console.log(navigation);
console.log('ResetStack Called');
navigation.dispatch(
CommonActions.reset({
index: 0,
routes: [
{ name: _stack}
]
})
);
}
const BottomTab = createBottomTabNavigator();
const INITIAL_ROUTE_NAME = 'StartStack';
export default function ParticipantNavigator({ navigation, route }) {
// screenOptions={{ headerShown: false }}
return (
<BottomTab.Navigator
screenOptions={{ headerShown: false }}
initialRouteName={INITIAL_ROUTE_NAME}
lazy='false'
tabBarOptions={{}}>
<BottomTab.Screen
name="StartStack"
component={StartStack}
options={{
title: 'Start'
}}
listeners={{
tabPress: e => {
resetStack(navigation, route, 'StartStack', INIT_START_ROUTE);
}
}}
/>
<BottomTab.Screen
name="ProductsStack"
component={ProductsStack}
options={{
title: 'Products'
}}
listeners={{
tabPress: e => {
resetStack(navigation, route, 'ProductsStack', INIT_PRODUCTS_ROUTE);
}
}}
/>
<BottomTab.Screen
name="MenuStack"
component={MenuStack}
options={{
title: 'Menu'
}}
listeners={{
tabPress: e => {
resetStack(navigation, route, 'MenuStack', INIT_MENU_ROUTE);
}
}}
/>
</BottomTab.Navigator>
);
}
Two issues in this code i am facing.
When I click on Tab, it goes to first tab instead of moving to first screen of Clicked tab.
When i come back to old tab, History not reset on that tab too.
any one can help me in this, Thanks.
if you are wroking on tabs and then want to reset the tab then try this React Navigation 5 here is the linksee the documentation React Navigation 5
<BottomTab.Screen
name="Post"
component={PostStack}
options={{
unmountOnBlur: true,// set this props in your tab screen options
title: 'Post',
tabBarIcon: focused => <TabBarIcon focused={focused} name="Post" />,
}}
/>
you can try this porp:unmountOnBlur
when you from ProductsStack to MenuStack,the ProductsStack will Unmount,
link is here
Here is the solution with React Navigation 5.x
https://stackoverflow.com/a/66982007/10672805
The code below is for resetting multiple tabs.
TabNavigator
Tab1: 'tab1_name'
StackNavigator
- ScreenA
- ScreenB
Tab2: 'tabs_name'
StackNavigator
- ScreenC
- ScreenD
Tab3: 'tab3_name'
StackNavigator
- ScreenE
- ScreenF
navigation.dispatch(
CommonActions.reset({
routes: [
{
name: 'tab1_name',
state: {
routes: [
{ name: 'ScreenA' },
{ name: 'ScreenB' },
]
}
},
{
name: 'tab2_name',
state: {
routes: [
{ name: 'ScreenC' },
]
}
},
{
name: 'tab3_name',
state: {
routes: [
{ name: 'ScreenE' },
{ name: 'ScreenF' },
]
}
},
]
})
)
And with this code, the first page you see is tab1_name tab's ScreenB screen.
So, if you want to see tab3_name tab's ScreenF screen first after running the dispatch function, the code should be something like:
navigation.dispatch(
CommonActions.reset({
routes: [
{
name: 'tab3_name',
state: {
routes: [
{ name: 'ScreenE' },
{ name: 'ScreenF' },
]
}
},
{
name: 'tab1_name',
state: {
routes: [
{ name: 'ScreenA' },
{ name: 'ScreenB' },
]
}
},
{
name: 'tab2_name',
state: {
routes: [
{ name: 'ScreenC' },
]
}
},
]
})
)
By the way, when you write down the routes of tab's state, it should follow the sequence of page stack. So that it would work as you expected.
navigation.dispatch(
CommonActions.reset({
routes: [
{
name: 'tab3_name',
state: {
routes: [
// { name: 'ScreenE' }, // removed
{ name: 'ScreenF' },
]
}
},
...
If you omit the first stack page as above, ScreenE is not accessible but only ScreenF after running the dispatch function.
Hope this works for you.

React Navigation: How to invoke method inside main page from custom header in navigation

I have created createMaterialTopTabNavigator :
const topSurvayorsNavigator = createMaterialTopTabNavigator({
ActiveSurveyor: {
screen: MomayezanScreen,
params: { status: 1 },
},
DeActiveSurveyor: {
screen: MomayezanScreen,
params: { status: 0 },
}
}, {
swipeEnabled: true,
tabBarOptions: {
labelStyle: {
fontSize: 12
},
activeTintColor: Colors.darkGray
}
});
I added this navigator into stack navigation :
const AuditMomayezanNavigator = createStackNavigator({
Dashboard: DashboardScreen,
ListSurveyor: {
screen: topSurvayorsNavigator,
navigationOptions: ({ navigation }) => {
switch (navigation.state.routes[navigation.state.index]["routeName"]) {
case "ActiveSurveyor":
console.log("ActiveSurveyor")
return {
header: () => <CustomHeader
title='page1'
onTermSubmit={() => searchApi(0)}
/>
}
case "DeActiveSurveyor":
console.log("DeActiveSurveyor")
return {
header: () => <CustomHeader
title='page2'
onTermSubmit={() => searchApi(1)}
/>
}
default:
return { title: (navigation.state.routes[navigation.state.index]["routes"])[(navigation.state.routes[navigation.state.index]["index"])].routeName }
}
}
},
Detail: SurveyorDetailsScreen,
}, {
defaultNavigationOptions: defaultNavOptions
});
As you can see i use custom header to stack navigation :
header: () => <CustomHeader
title='page1'
onTermSubmit={() => searchApi(1)}
/>
In custom view i have to send a method as onTermSubmit prop like searchApi with a parameter.How could i invoke searchApi(number) inside MomayezanScreen page from navigator?
https://reactnavigation.org/docs/en/header-buttons.html
See the section of
header interaction with component

should I set the state in compoenentDidMount?

I have AppContainer, which is other screen is render in:
class AppContainer extends Component {
state= {
Home: false
}
renderFooterTab = () => {
return this.footerItems.map((tabBarItem, index) => {
return (
<GlobalFooterTab
key={index}
title={tabBarItem.title}
selected={tabBarItem.selected}
/>
);
});
};
render() {
return (
<Container>
<StatusBar />
{this.renderHeader(this.props)}
<Content {...this.props} contentContainerStyle={{ flexGrow: 1 }}>
{this.props.children}
</Content>
{this.renderFooter(this.props)}
</Container>
);
footerItems = [
{
screen: 'home',
title: 'Home,
selected: this.state.isHome
}...
]
}
Using react navigation, I can get the screne using this.props.navigation.state;
How can I change the state when I get the this.props.navigation.state value and NOT render the page twice?
I did this, the state is change, but the tab is not render:
componentDidMount() {
this.setState({
isHome: false
});
}
There is really no need to use state for this and it's discouraged by the React team (Search for "Avoid copying props into state"). Instead, just continue to use the props.
const { routeName } = this.props.navigation.state;
footerItems = [
{
screen: 'home',
title: 'Home,
selected: routeName === 'Home'
}...
]
If you really want to, you can use "derived state" like this:
const { routeName } = this.props.navigation.state;
const isHome = routeName === 'Home';
...
footerItems = [
{
screen: 'home',
title: 'Home,
selected: isHome
}...
]

Deeplink with nested DrawerNavigator, TabNavigator and StackNavigator

I'm trying to configure deeplinks for my React Native app, following the official documentation, but I haven't been able to make it work. I mean, the app does open if I run adb shell am start -W -a android.intent.action.VIEW -d “crf://" packageName or xcrun simctl openurl booted crf:// but I haven't been able to open a specific screen; it always launches to the app home screen. I'm almost sure it has to do with the nested navigators, since I have a TabbarNavigator inside a DrawerNavigator and a StackNavigator inside all of that. I followed the instructions regarding nested navigators in the documentation and also this post, amongst other things, but no luck. I want to go to the EventHomeScreen, PersonDetailScreen and ProgramSessionDetail
Here is my code:
NavigatorRouter
const mainNavigator = createStackNavigator(
{ 
[Constants.APP_HOME_SCENE_KEY]:{
screen: AppHomeScreen,
navigationOptions: {
title: 'App Home',
showBack: false,
showSearch: false,
},
path: ''
},
[Constants.EVENT_HOME_SCENE_KEY]:{
screen: navPropMapper()(EventHomeScreen),
navigationOptions:{
title: 'Home',
path: 'event'
}
},
[Constants.ATTENDEE_DETAIL_SCENE_KEY]:{
screen: navPropMapper()(PersonDetailScreen),
navigationOptions:{
title: 'Attendee Detail',
// path: 'person/:user'
path: 'person'
}
},
[Constants.PROGRAM_DETAIL_SCENE_KEY]:{
screen: navPropMapper()(ProgramSessionDetail),
navigationOptions:{
title: 'Program',
path: 'program/:idLecture'
}
}
},
{
initialRouteName: `${Constants.APP_HOME_SCENE_KEY}`,
defaultNavigationOptions: {
header: props => <NavBar {...props} />,
gesturesEnabled: false,
showBack: true,
showHome: false,
showSearch: true,
showWebExplorer: false
}
});
const tabbarNavigator = createBottomTabNavigator({
Main: {
screen: mainNavigator,
path: 'tabs'
},
}, {
tabBarComponent: Tabbar,
});
const drawerNavigator = createDrawerNavigator({
Drawer: {
screen: tabbarNavigator,
navigationOptions:{
drawerLockMode: 'locked-closed',
},
path: 'drawer'
},
}, {
contentComponent: ({ props }) => <DrawerContainer {...props}/>,
drawerPosition: 'right',
unmountInactiveRoutes: true,
defaultNavigationOptions: {
header: null,
}
});
const wraperNavigator = createStackNavigator({
MainComponents: {
screen: drawerNavigator,
path: 'main'
},
[Constants.MODAL_FEEDBACK]:{
screen: navPropMapper()(Modal),
navigationOptions:{
title: 'Feedback',
}
},
[Constants.MODAL_LOGIN]:{
screen: navPropMapper()(ModalLogin),
navigationOptions:{
title: 'Login',
}
},
}, {
mode: 'modal',
cardStyle:{
backgroundColor: 'transparent',
opacity: 1,
},
cardShadowEnabled: true,
cardOverlayEnabled: true,
transparentCard: true,
defaultNavigationOptions: {
header: null,
gesturesEnabled: false,
},
});
export default createAppContainer(wraperNavigator)
App.js
class App extends Component {
render () {
return (
<Provider store={store}>
<RootContainer />
</Provider>
)
}
}
export default App
RootContainer
class CRrootContainer extends Component {
render () {
return (
<View style={styles.applicationView}>
<NavigationRouter uriPrefix={'crf://'}/>
</View>
)
}
}
const mapStateToProps = (state) => {
return {
navState: state.navigation,
}
}
// wraps redux integration
const mapDispatchToProps = (dispatch) => ({
startup: () => dispatch(StartupActions.startup()),
})
export default connect(mapStateToProps, mapDispatchToProps)(rootContainer)
iOS Uri and Scheme
AppDelegate.m
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url
sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
{
return [RCTLinkingManager application:application openURL:url
sourceApplication:sourceApplication annotation:annotation];
}
URL Types:
Android Scheme:
AndroidManifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="packageName">
<application
android:name=".MainApplication"
android:allowBackup="true"
android:label="#string/app_name"
android:icon="#mipmap/ic_launcher"
android:roundIcon="#mipmap/ic_launcher_round"
android:theme="#style/AppTheme">
<activity
android:name=".MainActivity"
android:label="#string/app_name"
android:screenOrientation="portrait"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:launchMode="singleTask">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="crf"/>
</intent-filter>
</activity>
</application>
</manifest>
The commands I'm trying are:
xcrun simctl openurl booted crf://main/drawer/tabs/event for iOS.
and
adb shell am start -W -a android.intent.action.VIEW -d “crf://main/drawer/tabs/event" packageName for Android (packageName is the name of my app package`
My react-navigation version is 3.6.1 and react-native: 0.59.9.
can you try setting an event listener ?
class CRrootContainer extends Component {
async componentDidMount(){
if (Platform.OS === "android") {
let url = await Linking.getInitialURL();
if(url) this._setDeepLink(url);
} else {
Linking.addEventListener("url", this._handleOpenURL);
}
};
_handleOpenURL = event => {
this._setDeepLink(event.url);
};
_setDeepLink = url => {
const { navigate } = this.props.navigation;
const route = url.replace(/.*?:\/\//g, "");
const routeName = route.split("/")[0];
console.log("root====>", routeName);
if (routeName === "foo") {
navigate("fooRoute"); // to navigate route based on deep link url
}
};
componentWillUnmount() {
Linking.removeEventListener("url");
}
render () {
return (
<View style={styles.applicationView}>
<NavigationRouter uriPrefix={'crf://'}/>
</View>
)
}
}
const mapStateToProps = (state) => {
return {
navState: state.navigation,
}
}
// wraps redux integration
const mapDispatchToProps = (dispatch) => ({
startup: () => dispatch(StartupActions.startup()),
})
export default connect(mapStateToProps, mapDispatchToProps)(rootContainer)
So it ended up beeing a rookie mistake, putting the path: keyword on the wrong place; it needs to go outside the navigationOptions, not inside. Also, path value on drawer navigator and tabbar navigator should be empty.
const mainNavigator = createStackNavigator(
{
[Constants.APP_HOME_SCENE_KEY]:{
screen: AppHomeScreen,
navigationOptions: {
title: 'App Home',
showBack: false,
showSearch: false,
},
path: ''
},
[Constants.EVENT_HOME_SCENE_KEY]:{
screen: navPropMapper()(EventHomeScreen),
navigationOptions:{
title: 'Home',
},
path: 'event'
},
[Constants.ATTENDEE_DETAIL_SCENE_KEY]:{
screen: navPropMapper()(PersonDetailScreen),
navigationOptions:{
title: 'Attendee Detail'
},
path: 'person'
},
[Constants.PROGRAM_DETAIL_SCENE_KEY]:{
screen: navPropMapper()(ProgramSessionDetail),
navigationOptions:{
title: 'Program'
},
path: 'program/:idLecture'
}
},
{
initialRouteName: `${Constants.APP_HOME_SCENE_KEY}`,
defaultNavigationOptions: {
header: props => <NavBar {...props} />,
gesturesEnabled: false,
showBack: true,
showHome: false,
showSearch: true,
showWebExplorer: false
}
});
const tabbarNavigator = createBottomTabNavigator({
Main: {
screen: mainNavigator,
path: ''
},
}, {
tabBarComponent: Tabbar,
});
const drawerNavigator = createDrawerNavigator({
Drawer: {
screen: tabbarNavigator,
navigationOptions:{
drawerLockMode: 'locked-closed',
},
path: ''
},
}, {
contentComponent: ({ props }) => <DrawerContainer {...props}/>,
drawerPosition: 'right',
unmountInactiveRoutes: true,
defaultNavigationOptions: {
header: null,
}
});
const wraperNavigator = createStackNavigator({
MainComponents: {
screen: drawerNavigator,
path: ''
},
[Constants.MODAL_FEEDBACK]:{
screen: navPropMapper()(Modal),
navigationOptions:{
title: 'Feedback',
}
},
[Constants.MODAL_LOGIN]:{
screen: navPropMapper()(ModalLogin),
navigationOptions:{
title: 'Login',
}
},
}, {
mode: 'modal',
cardStyle:{
backgroundColor: 'transparent',
opacity: 1,
},
cardShadowEnabled: true,
cardOverlayEnabled: true,
transparentCard: true,
defaultNavigationOptions: {
header: null,
gesturesEnabled: false,
},
});
export default createAppContainer(wraperNavigator)

Perspective Animation Drawer with React Native?

I want to create perspective animation like following -
I am using react-native-scaling-drawer & have currently done -
My App.js is the root file which is as follows -
App.js
const AppNavigator = StackNavigator(
{
walkthroughStack: {
screen: WalkthroughStack,
},
drawerStack: {
screen: DrawerStack,
},
},
{
initialRouteName: 'walkthroughStack',
headerMode: 'none',
},
);
export default AppNavigator;
My Walkthrough.js file is the file which shows the Walkthrough of the app & is as follows -
WalkthroughStack.js
const WalkthroughStack = StackNavigator(
{
Walkthrough: {
screen: Walkthrough,
},
},
{
headerMode: 'none',
navigationOptions: {
headerVisible: false,
},
initialRouteName: 'Walkthrough',
},
);
export default WalkthroughStack;
My DrawerStack.js is the file which has the animation shown in the repo -
DrawerStack.js
let defaultScalingDrawerConfig = {
scalingFactor: 0.6,
minimizeFactor: 0.6,
swipeOffset: 20
};
class CustomDrawerView extends Component {
constructor(props) {
super(props);
}
componentWillReceiveProps(nextProps) {
/** Active Drawer Swipe **/
if (nextProps.navigation.state.index === 0)
this._drawer.blockSwipeAbleDrawer(false);
if (nextProps.navigation.state.index === 0 && this.props.navigation.state.index === 0) {
this._drawer.blockSwipeAbleDrawer(false);
this._drawer.close();
}
/** Block Drawer Swipe **/
if (nextProps.navigation.state.index > 0) {
this._drawer.blockSwipeAbleDrawer(true);
}
}
setDynamicDrawerValue = (type, value) => {
defaultScalingDrawerConfig[type] = value;
/** forceUpdate show drawer dynamic scaling example **/
this.forceUpdate();
};
render() {
const {routes, index} = this.props.navigation.state;
const ActiveScreen = this.props.router.getComponentForState(this.props.navigation.state);
return (
<ScalingDrawer
ref={ref => this._drawer = ref}
content={<LeftMenu navigation={this.props.navigation}/>}
{...defaultScalingDrawerConfig}
onClose={() => console.log('close')}
onOpen={() => console.log('open')}
>
<ActiveScreen
navigation={addNavigationHelpers({
...this.props.navigation,
state: routes[index],
openDrawer: () => this._drawer.open(),
})}
dynamicDrawerValue={ (type, val) => this.setDynamicDrawerValue(type, val) }
/>
</ScalingDrawer>
)
}
}
const AppNavigator = StackRouter({
{
Main: {
screen: Main,
},
Walkthrough: {
screen: Walkthrough,
},
Typography: {
screen: Typography,
},
},
{
headerMode: 'none',
gesturesEnabled: false,
navigationOptions: {
headerVisible: false,
},
initialRouteName: 'Main',
},
);
const CustomDrawer = createNavigationContainer(createNavigator(AppNavigator)(CustomDrawerView));
export default CustomDrawer;
But this isn't working as shown in the README of the repo. How to do it ?
Example given works with React-Navigation's v1. Make sure you are using v1 for react-navigation