question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

BottomNavigation SafeArea inconsistent

See original GitHub issue

Current behaviour

My bottom navigation has inconsistent padding at the bottom depending on whether it runs on an iPhone 11 or iPhone 12 Max simulator:

  • if enclosed in a SaveAreaView, it looks good on the 12 Max, but has a huge bottom-padding on the 11
  • without a SaveAreaView, it looks good on the 11, but is placed outside the safe area on the 12

It appears that the component tries to do some safe area calculations by itself, but fails at the more recent and bigger 12 Max.

Expected behaviour

This should be consistent. I would prefer it to not try and be smart about safe areas. After all, I have to take care of those on every screen, whether it contains a bottom navigation or not.

Code sample

Really just a simple bottom navigation. Every other control aligns properly on the bottom (if I use a SaveAreaView).

                <BottomNavigation shifting={false}
                                  style={{position: "absolute", bottom: 0, left: 0, right: 0,}}
                                  navigationState={{index: viewModel.pageIndex, routes}}
                                  onIndexChange={changePageIndex}
                                  renderScene={renderScene}

Screenshots (if applicable)

Without a SafeArewView around. 11 left, 12 Pro Max on the right:

image

Your Environment

react-native: 0.63.4 react-native-paper: 4.4.1 react-native-vector-icons: 0.0.0 expo: 40.0.0

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
hardcodetcommented, Dec 15, 2020

yup, 4.5.0 seems to fix the issue, thanks! Good timing! 😉

1reaction
reimibetacommented, Jul 25, 2022

style={{position: “absolute”, bottom: 0, left: 0, right: 0,}}

add this one to your BottomNavigation, you will love it.

safeAreaInsets={{ bottom: 0 }}

Read more comments on GitHub >

github_iconTop Results From Across the Web

Bottom navigation part on iPhone X doesn't fill
That being said it is inconsistent to have the Top navigation fill extend to the ... The layout's background will respect the iPhone...
Read more >
bundling failed: Error: Unable to resolve module `react-native ...
I had to add react-native-safe-area-context to my package.json file. I don't understand why this isn't a peer dependency of React Navigation.
Read more >
Troubleshooting | React Navigation
This and some similar errors might occur if you have a bare React Native project and the library react-native-safe-area-context library isn't linked.
Read more >
124.2.0 - Google Git
In this major release we have updated BottomNavigation safe area calculations and removed the deprecated sizeThatFitsIncludesSafeArea API, including a minor ...
Read more >
[Solved]-GKTurnBasedMatch push notifications are very inconsistent
[Solved]-GKTurnBasedMatch push notifications are very inconsistent ... Flutter SafeArea: avoid notches, but ignore rounded corners · Flutter -> Persistent ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found