-
-
Notifications
You must be signed in to change notification settings - Fork 607
feat(Android): Add support for different Top App Bar styles #1874
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
Conversation
…sition of screens even better
b4b31b9 to
cf32cbc
Compare
… CollapsingToolbarLayout
…`headerTopInsetEnabled` to false
…top, fix positioning of header items
…terial 3 into app
WoLewicki
left a comment
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 |
|
Could we possibly create a new |
|
could this be published in a beta version until the upstream changes are shipped, and not requiring |
|
With the new App Bar styles introduced in Material Expressive, this is going to become even more relevant. Their behavior is quite complex, and it would be a pain to re-create in pure RN instead of using the native controls. |
|
I wonder if this also supports the TopAppBarScrollBheaviour modifier of the material 3 App Bars. |
|
We won't proceed with this PR. Expect new one coming soon with new implementation of the native stack. |
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,mediumandlargeheader 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
mediumorlargetheheaderCenterproperty 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
headerLeftandheaderRightprop)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
Test1874attached to this branch to test the changes inTestsExample&FabricTestExample.Checklist