-
-
Notifications
You must be signed in to change notification settings - Fork 575
feat(Android, Tabs): pass material theme using context wrapper & update the layout flow #3015
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
feat(Android, Tabs): pass material theme using context wrapper & update the layout flow #3015
Conversation
There was a problem hiding this 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"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<style name="custom" parent="Theme.Material3.DayNight.NoActionBar"> | |
<style name="material_base" parent="Theme.Material3.DayNight.NoActionBar"> |
or something more informative.
There was a problem hiding this comment.
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
Also if there is a ticket for this on a board, let's link it. |
) ## 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
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
usingContextWrapperThemed
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
Test code and steps to reproduce
See
TestBottomTabs/index.tsx
Checklist