Skip to content

Conversation

maciekstosio
Copy link
Contributor

To have styles and all features described in https://github.com/material-components/material-components-android/blob/master/docs/components/BottomNavigation.md, we should change the theme of the app to inherit from material design theme (the is one of getting started steps https://github.com/material-components/material-components-android/blob/master/docs/getting-started.md#7-material3-theme-inheritance). We don't want force users to do that in each project, thus we wrap reactContext using ContextWrapperThemed and pass a custom theme there.

Additionally, after adding the items, layout was broken, so I force layout using the pattern from https://github.com/software-mansion/react-native-screens/pull/2332/files.

Screenshots / GIFs

image

Test code and steps to reproduce

See TestBottomTabs/index.tsx

Checklist

  • Included code example that can be used to test this change
  • Ensured that CI passes

@kkafar kkafar changed the title feat(Android, Tabs): pass material theme using context wrapper feat(Android, Tabs): pass material theme using context wrapper & update the layout flow Jul 17, 2025
Copy link
Member

@kkafar kkafar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one nitpick & we're good. Thank you!

Great that the approach with ContextThemeWrapper worked out.

<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Base application theme. -->
<style name="custom" parent="Theme.Material3.DayNight.NoActionBar">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<style name="custom" parent="Theme.Material3.DayNight.NoActionBar">
<style name="material_base" parent="Theme.Material3.DayNight.NoActionBar">

or something more informative.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed that in #3026 anyway

@kkafar
Copy link
Member

kkafar commented Jul 17, 2025

Also if there is a ticket for this on a board, let's link it.

@maciekstosio maciekstosio merged commit f6fb72d into main Jul 17, 2025
3 checks passed
@maciekstosio maciekstosio deleted the @maciekstosio/Setup-material-3-theme-for-bottom-navigaiton branch July 17, 2025 15:37
maciekstosio added a commit that referenced this pull request Jul 21, 2025
)

## Description
Resolves:
software-mansion/react-native-screens-labs#225

This PR adjust our default (fallback) values with material values, based
on https://m3.material.io/components/navigation-bar/specs and package
resources.

In #3015 I introduced custom theme so we can pass it to context wrapper
- because I wanted the theme to inherit from
`Theme_Material3_DayNight_NoActionBar`. Now I realized that I can just
pass `Theme_Material3_DayNight_NoActionBar` 😅, so I removed unnecessary
custom theme.

## Screenshots / GIFs

<img width="426" height="917" alt="image"
src="https://github.com/user-attachments/assets/1aa01712-0ce8-41bf-aa69-4a0f73636cc6"
/>

## Test code and steps to reproduce

See `TestBottomTabs/index.tsx`

## Checklist

- [ ] Included code example that can be used to test this change
- [ ] Ensured that CI passes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants