mirror of
https://github.com/zhigang1992/react-navigation.git
synced 2026-01-12 22:51:18 +08:00
fix: use correct tint and background color from drawer items
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user