-
-
Notifications
You must be signed in to change notification settings - Fork 540
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
navigationBarColor props breaking safeArea / textinput & more #1719
Comments
Hey! 👋 The issue doesn't seem to contain a minimal reproduction. Could you provide a snack or a link to a GitHub repository under your username that reproduces the problem? |
I have the same problem. Adding "react-native": "0.71.1", |
Wondering if anyone has a work around. Experiencing exactly this. It's not the end of the world if the app doesn't bleed to the edges with the color I want, but trying to work around this with manual adjustments has a very obvious pitfalls. Thanks again for all the hard work everyone, I get what it takes to maintain a package like this. |
I'm also getting this - took me a while to figure out what was messing up the layouts so thanks for the issue! |
the same problem. SafeAreaView just not working with navigationBarColor... bottom: 0 starts from bottom of nav bar since this moment. How to play around it???? |
I am having the same issue as well. I suspect this is a deeper problem in android. I think what this lib is trying to do is make the real nav bar transparent and cover up that area with the color we provide (could be wrong tho). Couple months ago when i was using another package react-native-navigation-bar-color wheneven i would set the nav bar to transparent (or any value with transparency for that matter) it always have the buggy behaviour but solid colors work fine. For now a solution (if you don't mind installing the library) is to install react-native-navigation-bar-color and change the nav bar color with that |
The workaround is to install Expo's "NavigationBar" module, which is specific to Android, and can fix this issue: npx expo install expo-navigation-bar Then remove your use of import * as NavigationBar from 'expo-navigation-bar';
// ...
NavigationBar.setBackgroundColorAsync('red'); Yes, the culprit is indeed when you set the following code: <AppSwitcherStack.Navigator
initialRouteName={initialRouteName}
screenOptions={{
header: (props) => <MyHeader {...props} />,
navigationBarColor: 'red', // remove this - causes statusbar and navigationbar to become overlays/take no space
}}
/> The Expo module does not have this issue. I peeked the code for react-native-screens and I don't fully understand why the statusbar and navigationbar would change like it does, but it's clear that it does. |
Please check this PR #1988 |
…tionBarHidden (#1988) ## Description Currently when user tries to change the appearance of the navigation bar (using navigationBarHidden / navigationBarColor props) the content of the screen jumps to the place that does not respect safeAreaView. This PR fixes it by removing `decorFitsSystemWindow` declaration, as it breaks the interface by matching it to `fit system window`. Resolves #1719. ## Changes - Removed `decorFitsSystemWindow` call from `ScreenWindowTraits.kt` ## Checklist - [X] Ensured that CI passes
## Description Once upon a time there was an [issue](#1719) regarding navigation bar. The problem was that the background color set to the navigation bar covered the content behind, see examples: <table> <tr> <th>navigationBarColor: 'transparent'</th> <th>navigationBarColor: 'yellow'</th> </tr> <tr> <td> ![Screenshot 2024-05-22 at 10 33 28](https://github.com/software-mansion/react-native-screens/assets/91994767/eb3ea5a5-4617-4547-a052-ab0612872697) </td> <td> ![Screenshot 2024-05-22 at 10 34 08](https://github.com/software-mansion/react-native-screens/assets/91994767/805fa199-b90c-40aa-9ef5-b5ab8abef71a) </td> </tr> </table> Then [PR 1988](#1988) solved the issue, but introduced another problem: sometimes it may be intended to have content behind the navigation bar. <table> <tr> <th>navigationBarColor: 'transparent' after PR 1988</th> <th>navigationBarColor: 'transparent' before PR 1988</th> </tr> <tr> <td> ![Screenshot 2024-05-21 at 13 00 23](https://github.com/software-mansion/react-native-screens/assets/91994767/76ec2fa1-e212-4725-a1da-32bcf8c5eb84) </td> <td> ![Screenshot 2024-05-21 at 13 07 19](https://github.com/software-mansion/react-native-screens/assets/91994767/8fa15e57-7168-4fec-b8e7-3cce29eeebdc) </td> </tr> </table> This PR intents to add a new screen option, enabling navigation bar translucency control, so that the developers can decide if they want to show content behind the navigation bar independently. Fixes #2122 #1719 ## Changes - added navigationBarTranslucent option ## Test code and steps to reproduce <!-- Please include code that can be used to test this change and short description how this example should work. This snippet should be as minimal as possible and ready to be pasted into editor (don't exclude exports or remove "not important" parts of reproduction example) --> ## Checklist - [ ] Included code example that can be used to test this change - [ ] Updated TS types - [ ] Updated documentation: <!-- For adding new props to native-stack --> - [ ] https://github.com/software-mansion/react-native-screens/blob/main/guides/GUIDE_FOR_LIBRARY_AUTHORS.md - [ ] https://github.com/software-mansion/react-native-screens/blob/main/native-stack/README.md - [ ] https://github.com/software-mansion/react-native-screens/blob/main/src/types.tsx - [ ] https://github.com/software-mansion/react-native-screens/blob/main/src/native-stack/types.tsx - [ ] Ensured that CI passes
…tionBarHidden (software-mansion#1988) ## Description Currently when user tries to change the appearance of the navigation bar (using navigationBarHidden / navigationBarColor props) the content of the screen jumps to the place that does not respect safeAreaView. This PR fixes it by removing `decorFitsSystemWindow` declaration, as it breaks the interface by matching it to `fit system window`. Resolves software-mansion#1719. ## Changes - Removed `decorFitsSystemWindow` call from `ScreenWindowTraits.kt` ## Checklist - [X] Ensured that CI passes
…n#2152) ## Description Once upon a time there was an [issue](software-mansion#1719) regarding navigation bar. The problem was that the background color set to the navigation bar covered the content behind, see examples: <table> <tr> <th>navigationBarColor: 'transparent'</th> <th>navigationBarColor: 'yellow'</th> </tr> <tr> <td> ![Screenshot 2024-05-22 at 10 33 28](https://github.com/software-mansion/react-native-screens/assets/91994767/eb3ea5a5-4617-4547-a052-ab0612872697) </td> <td> ![Screenshot 2024-05-22 at 10 34 08](https://github.com/software-mansion/react-native-screens/assets/91994767/805fa199-b90c-40aa-9ef5-b5ab8abef71a) </td> </tr> </table> Then [PR 1988](software-mansion#1988) solved the issue, but introduced another problem: sometimes it may be intended to have content behind the navigation bar. <table> <tr> <th>navigationBarColor: 'transparent' after PR 1988</th> <th>navigationBarColor: 'transparent' before PR 1988</th> </tr> <tr> <td> ![Screenshot 2024-05-21 at 13 00 23](https://github.com/software-mansion/react-native-screens/assets/91994767/76ec2fa1-e212-4725-a1da-32bcf8c5eb84) </td> <td> ![Screenshot 2024-05-21 at 13 07 19](https://github.com/software-mansion/react-native-screens/assets/91994767/8fa15e57-7168-4fec-b8e7-3cce29eeebdc) </td> </tr> </table> This PR intents to add a new screen option, enabling navigation bar translucency control, so that the developers can decide if they want to show content behind the navigation bar independently. Fixes software-mansion#2122 software-mansion#1719 ## Changes - added navigationBarTranslucent option ## Test code and steps to reproduce <!-- Please include code that can be used to test this change and short description how this example should work. This snippet should be as minimal as possible and ready to be pasted into editor (don't exclude exports or remove "not important" parts of reproduction example) --> ## Checklist - [ ] Included code example that can be used to test this change - [ ] Updated TS types - [ ] Updated documentation: <!-- For adding new props to native-stack --> - [ ] https://github.com/software-mansion/react-native-screens/blob/main/guides/GUIDE_FOR_LIBRARY_AUTHORS.md - [ ] https://github.com/software-mansion/react-native-screens/blob/main/native-stack/README.md - [ ] https://github.com/software-mansion/react-native-screens/blob/main/src/types.tsx - [ ] https://github.com/software-mansion/react-native-screens/blob/main/src/native-stack/types.tsx - [ ] Ensured that CI passes
Description
Seems like the issue I posted here: react-navigation/react-navigation#11139
is actually due to react native screens, so I will post the bug here instead.
On android, when using react navigation, adding navigationBarColor in the screenOptions of a @react-navigation/native-stack will completely mess up the display of the app.
TextInput will no longer be pulled up above the keyboard and the view doesn't adjust naturally
SafeAreaView turns out messed up and needs to be manually added on some screens, while removed on others and it seems random.
Steps to reproduce
Have a basic native-stack, with a basic screen, use the screen option navigationBarColor on it, and see the whole display being messed up.
Snack or a link to a repository
https://reactnavigation.org/docs/native-stack-navigator
Screens version
3.18.2
React Native version
0.69.7
Platforms
Android
JavaScript runtime
None
Workflow
None
Architecture
None
Build type
None
Device
None
Device model
No response
Acknowledgements
Yes
The text was updated successfully, but these errors were encountered: