Skip to content

How to use a hook with screenOptions with v7 Static Router? #11624

Closed Answered by bnussman
bnussman asked this question in Q&A
Discussion options

You must be logged in to vote

Oh wow. Turns out you can just use a hook directly in screenOptions 🎉

export const Drawer = createDrawerNavigator({
  screenOptions: () => {
    const { colorMode } = useColorMode();
    return {
      headerTintColor: colorMode === "dark" ? "white" : "black",
      drawerType: "front",
    }
  },
  drawerContent: (props: DrawerContentComponentProps) => <CustomDrawerContent {...props} />,
  screens: {
    Ride: MainFindBeepScreen,
    Beep: StartBeepingScreen,
    Cars: Cars,
    'Edit Profile': EditProfileScreen,
    Beeps: BeepsScreen,
    Ratings: RatingsScreen,
    Feedback: Feedback,
  },
});

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by bnussman
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant