I'm calling custom sidebar inside DrawerNavigator. I'm trying to set active tint color and active background color for selected menu.
const DrawerStack = DrawerNavigator(
{
ProfileScreen: { screen: ProfileScreen },
Home: { screen: DashboardScreen },
},
{
contentOptions: {
activeTintColor: "#e91e63",
activeBackgroundColor : 'purple',
},
gesturesEnabled: false,
swipeEnabled: false,
contentComponent: SideDrawer
});
1) Pass props to SideDrawer.
2) Use props.navigation.state.routes[props.navigation.state.index].routeName
to detect the current route in SideDrawer and apply styles accordingly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With