-
-
Notifications
You must be signed in to change notification settings - Fork 521
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): Add support for different Top App Bar styles #1874
base: main
Are you sure you want to change the base?
feat(Android): Add support for different Top App Bar styles #1874
Conversation
…sition of screens even better
b4b31b9
to
cf32cbc
Compare
… CollapsingToolbarLayout
…`headerTopInsetEnabled` to false
…top, fix positioning of header items
…terial 3 into app
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.
Hey, I added a review. Let's make sure not to introduce bugs with this 🚀
android/src/main/java/com/swmansion/rnscreens/ScreenStackFragment.kt
Outdated
Show resolved
Hide resolved
android/src/main/java/com/swmansion/rnscreens/ScreenStackFragment.kt
Outdated
Show resolved
Hide resolved
// Reattach the header, when the developer tries to change the header type | ||
if (screenStackHeader?.loadedHeaderType != screen?.headerType) { | ||
screenStackHeader?.updateHeaderType() | ||
screenFragment?.removeToolbar() |
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.
Why do we remove it here?
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.
That's because of updating the layoutParams
of appBarLayout. Basically, when we're changing the type of appBar, its layout is being changed, resulting in wrong position of the views. For that reason we're removing all of its views (they will be added further in onUpdate) and setting references of toolbar and collapsingtoolbarlayout to null to ensure that we won't use old toolbars
This is very exciting! Awesome work! |
Currently, this PR is blocked by changes from facebook/react-native#44099 (we may skip requiring setting the prop |
That could make sense! We already set |
Description
Since the beginning of time...
Since the first version of react-native-screens...
There was a toolbar.
But toolbar have always been...
Small and non-expandable...
Nowadays...
times have changed.
This Pull Request introduces not 3, not 3.5, but 4 types of headers -
center-aligned
,small
,medium
andlarge
header types, where the last two of them can collapse.From now the toolbar will always be nested in
CollapsingToolbarLayout
, but this shouldn't have an impact on the experience overall.Unfortunately, while having header type set to
medium
orlarge
theheaderCenter
property does not work for now.For the best experience of using new header types it is recommended to have Material 3 bundled into the application, while using new header types.
For more information about the header types, please visit official Material 3 documentation.
Changes
headerLeft
andheaderRight
prop)Screenshots / GIFs
Before
Screen.Recording.2023-09-01.at.17.22.13.mov
After
8mb.video-WMw-Zz1dZmWl.mp4
Test code and steps to reproduce
Use
Test1874
attached to this branch to test the changes inTestsExample
&FabricTestExample
.Checklist