-
-
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
fix(Android): header shadow not hidden on go back #2216
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.
I think this change is ok, because it improves the situation.
However:
Important
We should research whether setting stateListAnimator to null here and in the other setters do not remove some system/material defined appbar animations. Let's put a task on our board for that.
## Description This PR intents to fix header shadow not being hidden after navigating back to a screen. The bug was visible when using `headerTransparent: true` option. The origin of this bug is [This PR](#2116) fixing build depracations. Setting the `elevation` on appBarLayout requires resetting the `stateListAnimator` to work properly, as opossed to deprecated `targetElevation` used before. For more info visit: https://developer.android.com/reference/com/google/android/material/appbar/AppBarLayout#setTargetElevation(float) Fixes #2212 . ## Changes - added missing `appBarLayout?.stateListAnimator` reset. ## Screenshots / GIFs Here you can add screenshots / GIFs documenting your change. You can add before / after section if you're changing some behavior. ### Before ![Screenshot 2024-06-27 at 11 39 50](https://github.com/software-mansion/react-native-screens/assets/91994767/78c42cd3-4523-46f2-93ea-2aa4a6f4da4f) ### After ![Screenshot 2024-06-27 at 11 39 29](https://github.com/software-mansion/react-native-screens/assets/91994767/b0d32daa-ee98-438e-90cb-621bb6b13ad0) ## Test code and steps to reproduce 1. use `Test1097.tsx` repro 2. navigate into second or third screen 3. go back to the first screen ## Checklist - [x] Included code example that can be used to test this change - [x] Ensured that CI passes
Just a small comment from me, that's a great change! Good catch, Alex 💪 I was wondering why header has such an ugly shadow after setting its style to transparent. |
- Repro on Android only by navigating to the Discuss tab, tapping a post or new discussion button, then navigating back to the Discuss tab and seeing that the top tabs shadow is no longer hidden, despite still having `headerShadowVisible: false` - Fix by updating react-native-screens from 3.32.0 to 3.34.0 - `npm update react-native-screens` - react-navigation/react-navigation#12063 software-mansion/react-native-screens#2216
) ## Description This PR intents to fix header shadow not being hidden after navigating back to a screen. The bug was visible when using `headerTransparent: true` option. The origin of this bug is [This PR](software-mansion#2116) fixing build depracations. Setting the `elevation` on appBarLayout requires resetting the `stateListAnimator` to work properly, as opossed to deprecated `targetElevation` used before. For more info visit: https://developer.android.com/reference/com/google/android/material/appbar/AppBarLayout#setTargetElevation(float) Fixes software-mansion#2212 . ## Changes - added missing `appBarLayout?.stateListAnimator` reset. ## Screenshots / GIFs Here you can add screenshots / GIFs documenting your change. You can add before / after section if you're changing some behavior. ### Before ![Screenshot 2024-06-27 at 11 39 50](https://github.com/software-mansion/react-native-screens/assets/91994767/78c42cd3-4523-46f2-93ea-2aa4a6f4da4f) ### After ![Screenshot 2024-06-27 at 11 39 29](https://github.com/software-mansion/react-native-screens/assets/91994767/b0d32daa-ee98-438e-90cb-621bb6b13ad0) ## Test code and steps to reproduce 1. use `Test1097.tsx` repro 2. navigate into second or third screen 3. go back to the first screen ## Checklist - [x] Included code example that can be used to test this change - [x] Ensured that CI passes
Description
This PR intents to fix header shadow not being hidden after navigating back to a screen. The bug was visible when using
headerTransparent: true
option.The origin of this bug is This PR fixing build depracations. Setting the
elevation
on appBarLayout requires resetting thestateListAnimator
to work properly, as opossed to deprecatedtargetElevation
used before.For more info visit: https://developer.android.com/reference/com/google/android/material/appbar/AppBarLayout#setTargetElevation(float)
Fixes #2212 .
Changes
appBarLayout?.stateListAnimator
reset.Screenshots / GIFs
Here you can add screenshots / GIFs documenting your change.
You can add before / after section if you're changing some behavior.
Before
After
Test code and steps to reproduce
Test1097.tsx
reproChecklist