-
-
Notifications
You must be signed in to change notification settings - Fork 575
refactor(Android): replace inset listeners on decor with multiple insets listeners on screen #2938
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
base: main
Are you sure you want to change the base?
Conversation
android/src/main/java/com/swmansion/rnscreens/InsetsObserver.kt
Outdated
Show resolved
Hide resolved
## Description Review notes for #2938. Please note that I've described each change in commit details. ## Changes - **refactor insets managment for sheets** - **Update android/src/main/java/com/swmansion/rnscreens/InsetsObserver.kt** - **Remove secondary constructor & add context as first parameter** - **Update callsite** - **Make use of ctor param instead of introducing additional variable** - **Rename systemListener -> externalListener** - **Add a comment explaining semantics of `Screen.setOnApplyWindowInsetsListener`** - **Renmae setOnApplyWindowListener -> setExternalOnApplyWindowInsetsListener** - **Rename rollingInsets -> currentInsets & assert nullability** - **Add comment explaining what is being returned there** ## Test code and steps to reproduce <!-- Please include code that can be used to test this change and short description how this example should work. This snippet should be as minimal as possible and ready to be pasted into editor (don't exclude exports or remove "not important" parts of reproduction example) --> ## Checklist - [ ] Included code example that can be used to test this change - [ ] Updated TS types - [ ] Updated documentation: <!-- For adding new props to native-stack --> - [ ] https://github.com/software-mansion/react-native-screens/blob/main/guides/GUIDE_FOR_LIBRARY_AUTHORS.md - [ ] https://github.com/software-mansion/react-native-screens/blob/main/native-stack/README.md - [ ] https://github.com/software-mansion/react-native-screens/blob/main/src/types.tsx - [ ] https://github.com/software-mansion/react-native-screens/blob/main/src/native-stack/types.tsx - [ ] Ensured that CI passes
Found a bug on API 29, that does not happen on API 35. Dunno on what version it starts. I also don't know whether this is a regression or it also occurs in main. Will check this. Video recorded on Screen.Recording.2025-05-28.at.12.05.19.movCaution This works fine on main. |
Found another bug on API 29, that does not happen on API 35 Screen.Recording.2025-05-28.at.12.06.46.movVideo recorded on Caution This works on main. |
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.
Found two pretty big regressions ☝🏻
I'll try to look into them now.
Description
Currently we have one singleton proxy listener that is attached to decor and we use that to listen for keyboard events. That sometimes may leads to problems, that some underlying view will consume insets and we won't get notified about this. This PR fixes is by allowing to add multiple events listeners on screen and using it for foresheets.
We keep the systemListener and ownListeeners separately, as the first one can be attached temporarily but we wouldn't be able to distinguish it and our own. Additional "own" listeners suppose to be attache through the insetObserver
Test code and steps to reproduce
Checklist