mirror of
https://github.com/zhigang1992/react-navigation.git
synced 2026-05-10 22:04:13 +08:00
committed by
Satyajit Sahoo
parent
c5720cafb4
commit
123bce5402
3
.gitignore
vendored
3
.gitignore
vendored
@@ -2,6 +2,9 @@
|
||||
.vscode/
|
||||
jsconfig.json
|
||||
|
||||
# IntelliJ/Webstorm
|
||||
.idea
|
||||
|
||||
# NodeJS
|
||||
npm-debug.log
|
||||
node_modules
|
||||
|
||||
@@ -82,6 +82,7 @@ DrawerNavigator(RouteConfigs, DrawerNavigatorConfig)
|
||||
### Drawer Navigator Options
|
||||
|
||||
- `drawerWidth` - Width of the drawer
|
||||
- `drawerPosition` - Options are `left` or `right`. Default is `left` position.
|
||||
- `contentComponent` - Component to use to render the navigation items. Receives the `navigation` prop for the drawer. Defaults to `DrawerView.Items`.
|
||||
- `contentOptions` - Configure the drawer content, see below.
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@ const DefaultDrawerConfig = {
|
||||
*/
|
||||
drawerWidth: Dimensions.get('window').width - (Platform.OS === 'android' ? 56 : 64),
|
||||
contentComponent: DrawerView.Items,
|
||||
drawerPosition: 'left',
|
||||
};
|
||||
|
||||
const DrawerNavigator = (
|
||||
@@ -43,6 +44,7 @@ const DrawerNavigator = (
|
||||
drawerWidth,
|
||||
contentComponent,
|
||||
contentOptions,
|
||||
drawerPosition,
|
||||
...tabsConfig
|
||||
} = mergedConfig;
|
||||
const contentRouter = TabRouter(routeConfigs, tabsConfig);
|
||||
@@ -64,6 +66,7 @@ const DrawerNavigator = (
|
||||
drawerWidth={drawerWidth}
|
||||
contentComponent={contentComponent}
|
||||
contentOptions={contentOptions}
|
||||
drawerPosition={drawerPosition}
|
||||
/>
|
||||
), containerConfig);
|
||||
};
|
||||
|
||||
@@ -24,6 +24,7 @@ export type DrawerScene = {
|
||||
|
||||
export type DrawerViewConfig = {
|
||||
drawerWidth: number,
|
||||
drawerPosition: 'left' | 'right',
|
||||
contentComponent: ReactClass<*>,
|
||||
contentOptions?: {},
|
||||
style?: any;
|
||||
@@ -119,7 +120,10 @@ export default class DrawerView extends PureComponent<void, Props, void> {
|
||||
onDrawerOpen={this._handleDrawerOpen}
|
||||
onDrawerClose={this._handleDrawerClose}
|
||||
renderNavigationView={this._renderNavigationView}
|
||||
drawerPosition={DrawerLayout.positions.Left}
|
||||
drawerPosition={
|
||||
this.props.drawerPosition === 'right' ?
|
||||
DrawerLayout.positions.Right : DrawerLayout.positions.Left
|
||||
}
|
||||
>
|
||||
<DrawerScreen
|
||||
screenProps={this.props.screenProps}
|
||||
|
||||
Reference in New Issue
Block a user