fix: use correct tint and background color from drawer items

This commit is contained in:
Satyajit Sahoo
2021-08-12 01:32:59 +02:00
parent 89e8271927
commit f8fddac79d
2 changed files with 16 additions and 6 deletions

View File

@@ -9,8 +9,11 @@ export default function DrawerContent({
state,
...rest
}: DrawerContentComponentProps) {
const { drawerContentStyle, drawerContentContainerStyle } =
descriptors[state.routes[state.index].key].options;
const focusedRoute = state.routes[state.index];
const focusedDescriptor = descriptors[focusedRoute.key];
const focusedOptions = focusedDescriptor.options;
const { drawerContentStyle, drawerContentContainerStyle } = focusedOptions;
return (
<DrawerContentScrollView

View File

@@ -26,16 +26,23 @@ export default function DrawerItemList({
}: Props) {
const buildLink = useLinkBuilder();
const focusedRoute = state.routes[state.index];
const focusedDescriptor = descriptors[focusedRoute.key];
const focusedOptions = focusedDescriptor.options;
const {
drawerActiveTintColor,
drawerInactiveTintColor,
drawerActiveBackgroundColor,
drawerInactiveBackgroundColor,
} = focusedOptions;
return state.routes.map((route, i) => {
const focused = i === state.index;
const {
title,
drawerLabel,
drawerIcon,
drawerActiveTintColor,
drawerInactiveTintColor,
drawerActiveBackgroundColor,
drawerInactiveBackgroundColor,
drawerLabelStyle,
drawerItemStyle,
} = descriptors[route.key].options;