Drawer defaultStatus="closed" not honoured on initial load
georgevicbell opened this issue · comments
Which package manager are you using? (Yarn is recommended)
npm
Summary
When defaultStatus="closed" is set on a Drawer, the drawer starts open, then immediately animates closed...expected behaviour is that the drawer should start closed - with no animation...
Minimal reproducible example
<Drawer
initialRouteName="home"
defaultStatus="closed"
screenOptions={{
headerStyle: {},
headerTintColor: "#000",
headerTitleStyle: {
fontWeight: "bold",
},
header: (props) => {
return (
<Pressable onPress={() => { props.navigation.toggleDrawer() }}>
);
},
}}
<Drawer.Screen
name="index" // This is the name of the page and must match the url from root
options={{
drawerLabel: "Home",
title: "overview",
}}
/>
Note this seems to happen in both web and mobile...
👍
Same issue
This needs to be fixed upstream in react-navigation react-navigation/react-navigation#11398
We attempted to fix this in the linked commits, but we needed to revert due to other issues it caused. https://github.com/expo/expo/pull/24362/files
I have this problem with react-native-drawer-layout. or very nearly the same. The right drawer is stuck open, while the left drawer works fine. And it's weird, I didn't have the issue for months, and suddenly it was there while I a bunch of drawers. I tried going back to find out where the behavior started, but it will get better and then not be there until the project is completely cleaned and restarted. But it shows up 100% of the time on deploy...
[UPDATE] I got it to go away by downgrading to react-native-drawer-layout version 3.0.0.
Same problem here, any solutions?