Skip to content

Instantly share code, notes, and snippets.

@kiok46
Created July 15, 2017 01:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kiok46/260d062cfbdb931eb9c214637f2cfb59 to your computer and use it in GitHub Desktop.
Save kiok46/260d062cfbdb931eb9c214637f2cfb59 to your computer and use it in GitHub Desktop.
Customising Drawer and Drawer items.

CustomDrawer

In order to figure it out I searched react-navigation issues and found this

export default DrawerNavigator(
  {
      Map: {
        path: '/',
        screen: MapScreen,
      },
      Compass: {
        path: '/compass',
        screen: CompassScreen,
      },
  },
  {
    initialRouteName: 'Map',
    contentOptions: {
      activeTintColor: Colors.tabIconSelected,
    },
    contentComponent: props => <ScrollView><DrawerItems {...props} /></ScrollView>
  }
);

now editing contentComponent

contentComponent: props => (
        <ScrollView>
            <View>
                <DrawerItems
                  {...props}
                  getLabel = {(scene) => (
                    <View>
                      <Text>{props.getLabel(scene)}</Text>
                    </View>
                  )}
                />
            </View>
        </ScrollView>
    )

now I can customize the entire Drawer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment