Skip to content

Commit b86a3b8

Browse files
author
aksonov
committed
fix case when drawerWidth is not defined, add drawerLockMode option
1 parent 96d6c28 commit b86a3b8

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

dist/navigationStore.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ return null;
390390
}
391391
var res={};
392392
var order=[];var _scene$props=
393-
scene.props,navigator=_scene$props.navigator,contentComponent=_scene$props.contentComponent,drawerWidth=_scene$props.drawerWidth,lazy=_scene$props.lazy,duration=_scene$props.duration,parentProps=_objectWithoutProperties(_scene$props,['navigator','contentComponent','drawerWidth','lazy','duration']);var
393+
scene.props,navigator=_scene$props.navigator,contentComponent=_scene$props.contentComponent,drawerWidth=_scene$props.drawerWidth,drawerLockMode=_scene$props.drawerLockMode,lazy=_scene$props.lazy,duration=_scene$props.duration,parentProps=_objectWithoutProperties(_scene$props,['navigator','contentComponent','drawerWidth','drawerLockMode','lazy','duration']);var
394394
tabs=parentProps.tabs,modal=parentProps.modal,lightbox=parentProps.lightbox,overlay=parentProps.overlay,tabBarPosition=parentProps.tabBarPosition,drawer=parentProps.drawer,tabBarComponent=parentProps.tabBarComponent,transitionConfig=parentProps.transitionConfig;
395395
if(scene.type===_Modal2.default){
396396
modal=true;
@@ -520,7 +520,14 @@ tabBarPosition=_reactNative.Platform.OS==='android'?'top':'bottom';
520520
return(0,_reactNavigation.TabNavigator)(res,_extends({lazy:lazy,tabBarComponent:tabBarComponent,tabBarPosition:tabBarPosition,initialRouteName:initialRouteName,initialRouteParams:initialRouteParams,order:order},commonProps,{
521521
tabBarOptions:createTabBarOptions(commonProps),navigationOptions:createNavigationOptions(commonProps)}));
522522
}else if(drawer){
523-
return(0,_reactNavigation.DrawerNavigator)(res,_extends({initialRouteName:initialRouteName,contentComponent:contentComponent,drawerWidth:drawerWidth,order:order},commonProps));
523+
var config=_extends({initialRouteName:initialRouteName,contentComponent:contentComponent,order:order},commonProps);
524+
if(drawerWidth){
525+
config.drawerWidth=drawerWidth;
526+
}
527+
if(drawerLockMode){
528+
config.drawerLockMode=drawerLockMode;
529+
}
530+
return(0,_reactNavigation.DrawerNavigator)(res,config);
524531
}else if(overlay){
525532
return(0,_OverlayNavigator2.default)(res,_extends({lazy:lazy,initialRouteName:initialRouteName,contentComponent:contentComponent,initialRouteParams:initialRouteParams,order:order},commonProps,{
526533
tabBarOptions:createTabBarOptions(commonProps),navigationOptions:createNavigationOptions(commonProps)}));

src/navigationStore.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ class NavigationStore {
390390
}
391391
const res = {};
392392
const order = [];
393-
const { navigator, contentComponent, drawerWidth, lazy, duration, ...parentProps } = scene.props;
393+
const { navigator, contentComponent, drawerWidth, drawerLockMode, lazy, duration, ...parentProps } = scene.props;
394394
let { tabs, modal, lightbox, overlay, tabBarPosition, drawer, tabBarComponent, transitionConfig } = parentProps;
395395
if (scene.type === Modal) {
396396
modal = true;
@@ -520,7 +520,14 @@ class NavigationStore {
520520
return TabNavigator(res, { lazy, tabBarComponent, tabBarPosition, initialRouteName, initialRouteParams, order, ...commonProps,
521521
tabBarOptions: createTabBarOptions(commonProps), navigationOptions: createNavigationOptions(commonProps) });
522522
} else if (drawer) {
523-
return DrawerNavigator(res, { initialRouteName, contentComponent, drawerWidth, order, ...commonProps });
523+
const config = { initialRouteName, contentComponent, order, ...commonProps };
524+
if (drawerWidth) {
525+
config.drawerWidth = drawerWidth;
526+
}
527+
if (drawerLockMode) {
528+
config.drawerLockMode = drawerLockMode;
529+
}
530+
return DrawerNavigator(res, config);
524531
} else if (overlay) {
525532
return OverlayNavigator(res, { lazy, initialRouteName, contentComponent, initialRouteParams, order, ...commonProps,
526533
tabBarOptions: createTabBarOptions(commonProps), navigationOptions: createNavigationOptions(commonProps) });

0 commit comments

Comments
 (0)