-
-
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
Inconsistency with navigationBarColor Transparency on react-native-screens versions >= 3.30.0" #2122
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'm facing the same problem, after expo upgrade, the navigation bar is not longer transparent using that approach. A way you can turn around that is to use
Although I would prefer to do not have absolute position there, because I have to change all my screens that doesn't take that into account. |
@klethonio I didn't test it but by reading the documentation it looks like maybe the same result? On my case i do not want to use |
@klethonio I just test your solution and works great as a workaround, i thought it was the same result as using I as well would prefer to not have absolute position there, but the solution works nice. One thing i detected is that ios is not affected, setting // App.tsx
if (Platform.OS === "android") {
NavigationBar.setPositionAsync("absolute");
}
|
Yeah, I don't know what was the structure before, because it seemed to work like that but dynamically, always taking into account the bar height. Now it looks like the navigation bar being set as transparent, without absolute, its working, but below we have a black/white background, or it's not that, anyway, I'm lost. That's out of my league at the moment. For example, I have a FAB and previously the bottom padding was related to the top of the navigation bar, and the bar was transparent and the content of the app was behind it, it was perfect. After the update the bar was opaque and after applying Summing up... I think this should just work as before! By the way, thank you for your thoughts. |
## 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
@yunarch thanks for reporting! It looks like the issue was created while resolving another issue a while ago, feel free to read a description of my PR if you're interested to find out more about it. |
…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
Before version
3.30.0
, when thenavigationBarColor
was set to transparent on a Stack navigator, the navigation bar would preserve transparency, adopting the color defined on SafeAreaView. However, in version3.30.0
and onwards, this behavior has changed: the navigation bar no longer maintains transparency but instead defaults to a white color (or black ifnavigationBarColor
is not explicitly defined).Steps to reproduce
Setting a stack navigator with
navigationBarColor
set as transparent:Snack or a link to a repository
https://github.com/software-mansion/react-native-screens
Screens version
>= 3.30.0
React Native version
0.74.1
Platforms
Android
JavaScript runtime
None
Workflow
Expo managed workflow
Architecture
None
Build type
None
Device
Android emulator
Device model
Pixel_3a_API_34
Acknowledgements
Yes
The text was updated successfully, but these errors were encountered: