-
-
Notifications
You must be signed in to change notification settings - Fork 22
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
Content doesn't render under navigation bar on first launch, but corrects itself after backgrounding #45
Comments
Until this PR is merged, you need to add export default function RootLayout() {
return (
<ThemeProvider value={DefaultTheme}>
<Stack
screenOptions={{
// You need to add this
statusBarTranslucent: true,
navigationBarTranslucent: true,
navigationBarColor: "transparent",
statusBarBackgroundColor: "transparent",
}}
>
<Stack.Screen
name="(tabs)"
options={{
headerShown: false,
}}
/>
<Stack.Screen
name="modal"
options={{
presentation: "formSheet",
sheetAllowedDetents: "fitToContents",
// You need to add this
statusBarTranslucent: true,
navigationBarTranslucent: true,
navigationBarColor: "transparent",
statusBarBackgroundColor: "transparent",
}}
/>
</Stack>
</ThemeProvider>
);
} And even with that, it blinks and sometimes, it doesn't apply the navigation bar color (one time out of two, looks like a race condition): Screen.Recording.2024-11-13.at.09.38.02.movI will work on a patch for |
@doughsay Opening the same issue on their repository could be a good idea, as the issue come from there. EDIT: Got it! It's not directly in To explain the race condition in the video / my suspicions about
|
Amazing, thank you so much for digging into this, I wouldn't have been able to figure all that out 😅. I'll keep an eye on that expo-router issue and in the meantime I'll apply your suggested patch. Thanks! |
# Why Currently, `expo-router` is mounting react-native `StatusBar` components, at init they call [this line](https://github.com/facebook/react-native/blob/v0.76.1/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/view/WindowUtil.kt#L59), and it disables [edge-to-edge display](https://developer.android.com/develop/ui/views/layout/edge-to-edge). Related issue: zoontek/react-native-edge-to-edge#45 # How I added `react-native-is-edge-to-edge` to detect if edge-to-edge is enabled, prevent the `StatusBar` use when this is the case. People are expected to use the package `SystemBars` component, which doesn't suffer from this issue. There's also no need for `AutoStatusBar` when the package is installed, as this is the default theme (`Theme.EdgeToEdge`) behavior. # Test Plan - Create an expo project with `expo-router` - Add `react-native-edge-to-edge`, start the app - Apply the fix - Rebuild, restart the app
@doughsay expo-router 4.0.5 has been released with the fix, could you try it? |
Yep, it works! Thanks a lot for such a quick turnaround! |
Before submitting a new issue
Bug summary
When you first launch the app, the navigation bar is opaque and content does not render under it. If you background the app, and then open it again, then content is rendered under it.
I've created a minimal Expo 52 app to show this. The content I'm trying to render under the navigation bar is the expo router tab bar, and a formsheet modal.
I've also recorded video demonstrating the issue:
rn-edge-to-edge.webm
Library version
1.1.1
Environment info
Steps to reproduce
Reproducible sample code
Repo is here: https://github.com/doughsay/expo-edge-to-edge
The text was updated successfully, but these errors were encountered: