Expose useNativeAnimations for Drawer navigator (#2568)

* Expose useNativeAnimations for Drawer navigator

* Default useNativeAnimations to true
This commit is contained in:
Jonathan Kim
2017-09-12 09:03:37 -07:00
committed by Lorenzo Sciandra
parent fe4b1e2379
commit 23da6aebff
2 changed files with 5 additions and 0 deletions

View File

@@ -32,6 +32,7 @@ const DefaultDrawerConfig = {
Dimensions.get('window').width - (Platform.OS === 'android' ? 56 : 64), Dimensions.get('window').width - (Platform.OS === 'android' ? 56 : 64),
contentComponent: DrawerItems, contentComponent: DrawerItems,
drawerPosition: 'left', drawerPosition: 'left',
useNativeAnimations: true,
}; };
const DrawerNavigator = ( const DrawerNavigator = (
@@ -45,6 +46,7 @@ const DrawerNavigator = (
contentComponent, contentComponent,
contentOptions, contentOptions,
drawerPosition, drawerPosition,
useNativeAnimations,
...tabsConfig ...tabsConfig
} = mergedConfig; } = mergedConfig;
@@ -80,6 +82,7 @@ const DrawerNavigator = (
)((props: *) => )((props: *) =>
<DrawerView <DrawerView
{...props} {...props}
useNativeAnimations={useNativeAnimations}
drawerWidth={drawerWidth} drawerWidth={drawerWidth}
contentComponent={contentComponent} contentComponent={contentComponent}
contentOptions={contentOptions} contentOptions={contentOptions}

View File

@@ -34,6 +34,7 @@ export type DrawerViewConfig = {
contentComponent: ReactClass<*>, contentComponent: ReactClass<*>,
contentOptions?: {}, contentOptions?: {},
style?: ViewStyleProp, style?: ViewStyleProp,
useNativeAnimations: boolean,
}; };
type Props = DrawerViewConfig & { type Props = DrawerViewConfig & {
@@ -145,6 +146,7 @@ export default class DrawerView<T: *> extends PureComponent<void, Props, void> {
drawerWidth={this.props.drawerWidth} drawerWidth={this.props.drawerWidth}
onDrawerOpen={this._handleDrawerOpen} onDrawerOpen={this._handleDrawerOpen}
onDrawerClose={this._handleDrawerClose} onDrawerClose={this._handleDrawerClose}
useNativeAnimations={this.props.useNativeAnimations}
renderNavigationView={this._renderNavigationView} renderNavigationView={this._renderNavigationView}
drawerPosition={ drawerPosition={
this.props.drawerPosition === 'right' this.props.drawerPosition === 'right'