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

Not able to set custom BottomNavigation backgroundColor with v3 theme. #3290

Closed
DomiR opened this issue Aug 4, 2022 · 4 comments · Fixed by #3298
Closed

Not able to set custom BottomNavigation backgroundColor with v3 theme. #3290

DomiR opened this issue Aug 4, 2022 · 4 comments · Fixed by #3298

Comments

@DomiR
Copy link

DomiR commented Aug 4, 2022

As you can see in the reference below, if the v3 theme is used it uses theme surface color no matter what backgroundColor one passes through the barStyle prop.

The NavigationBar Guidelines says:

The container can have a color fill to provide separation from the content behind it.

const backgroundColor = isV3
? theme.colors.surface
: shifting
? indexAnim.interpolate({

Also the elevation should probably be adjustable. According to the NavigationBar Spec it should actually have a default elevation of 2 but it is currently hardcoded to 0:

{...(theme.isV3 && { elevation: 0 })}

One can barely see it in the example picture:
Bildschirmfoto 2022-08-04 um 12 37 25

@github-actions
Copy link

github-actions bot commented Aug 4, 2022

Couldn't find version numbers for the following packages in the issue:

  • react-native
  • react-native-paper
  • react-native-vector-icons

Can you update the issue to include version numbers for those packages? The version numbers must match the format 1.2.3.

@github-actions
Copy link

github-actions bot commented Aug 4, 2022

Hey! Thanks for opening the issue. The issue doesn't seem to contain a link to a repro (a snack.expo.dev link or link to a GitHub repo under your username).

Can you provide a minimal repro which demonstrates the issue? A repro will help us debug the issue faster. Please try to keep the repro as small as possible and make sure that we can run it without additional setup.

@lukewalczak
Copy link
Member

lukewalczak commented Aug 4, 2022

Hey @DomiR, thanks for your feedback!

If you want to use a custom background color you can always override it by the theme prop:

      <BottomNavigation
		...
        theme={{ colors: { surface: 'aquamarine' } }}
      />

Also the elevation should probably be adjustable. According to the NavigationBar Spec it should actually have a default elevation of 2 but it is currently hardcoded to 0:

In that case, the elevation prop applies background color and shadows, which in terms of BottomNavigation is hardcoded to 0, since there should be no shadow:

Zrzut ekranu 2022-08-4 o 12 55 18

However, based on that information you provided and figma kit, the default background color should be theme.colors.elevation.level2, which I will correct in the next week along with passing custom bg color via barStyle

@DomiR
Copy link
Author

DomiR commented Aug 4, 2022

Hey @lukewalczak. Thanks for looking into this 😊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants