Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drawer defaultStatus="closed" not honoured on initial load #837

Open
georgevicbell opened this issue Aug 12, 2023 · 7 comments
Open

Drawer defaultStatus="closed" not honoured on initial load #837

georgevicbell opened this issue Aug 12, 2023 · 7 comments

Comments

@georgevicbell
Copy link

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",
  }}
/>
@georgevicbell
Copy link
Author

Note this seems to happen in both web and mobile...

@moedeveloper
Copy link

moedeveloper commented Aug 13, 2023

I also have the same issue, and I have been struggling with it like two days now. I don't find any solution for it! this is the site map

image

RPReplay_Final1691876094.mov

that's what exactly happening at startup!

@bkasten-rbi
Copy link

👍

EvanBacon pushed a commit to expo/expo that referenced this issue Sep 4, 2023
# Why

expo/router#837

ExpoRouter provides a `SafeAreaContextProvider` with an initial value of
`0` for all dimensions. The `drawer` layout uses these dimensions to
calculate the necessary x offset for its 'closed' state. These
calculations assume a minimum screen size, so having `0` caused it to
initially render on the screen

# How

We only need these initial values for static rendering, so now we only
provide them when rendering SSR.

# Test Plan

Tested manually by creating a new project.

# Checklist

- [ ] Documentation is up to date to reflect these changes (eg:
https://docs.expo.dev and README.md).
- [ ] Conforms with the [Documentation Writing Style
Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md)
- [ ] This diff will work correctly for `npx expo prebuild` & EAS Build
(eg: updated a module plugin).
@WKampel
Copy link

WKampel commented Nov 2, 2023

Same issue

@marklawlor
Copy link
Contributor

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

@jehillert
Copy link

jehillert commented Feb 26, 2024

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.

@LucasTrombim
Copy link

Same problem here, any solutions?

DavidAmyot pushed a commit to Villeco-inc/expo-router that referenced this issue Oct 16, 2024
# Why

expo/router#837

ExpoRouter provides a `SafeAreaContextProvider` with an initial value of
`0` for all dimensions. The `drawer` layout uses these dimensions to
calculate the necessary x offset for its 'closed' state. These
calculations assume a minimum screen size, so having `0` caused it to
initially render on the screen

# How

We only need these initial values for static rendering, so now we only
provide them when rendering SSR.

# Test Plan

Tested manually by creating a new project.

# Checklist

- [ ] Documentation is up to date to reflect these changes (eg:
https://docs.expo.dev and README.md).
- [ ] Conforms with the [Documentation Writing Style
Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md)
- [ ] This diff will work correctly for `npx expo prebuild` & EAS Build
(eg: updated a module plugin).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants