Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(Android): fix formSheet-keyboard interaction (#2511)
## Description I've investigated the regression on form sheet keyboard behaviour. It has stopped respecting allowed detents when keyboard was opened. https://github.com/user-attachments/assets/42d393c8-a50b-40f4-a8cc-41bca122b4aa I tracked down the regression to #2371. I do not understand the interactions completely, as the regression happens only when `statusBarTranslucent` is explicitly set to `false`. `true` or `undefined` make the formsheet-keyboard interaction work correctly. This is especially baffling that I'm testing this on Fabric, therefore `false` is always provided What I understand is that *setting insets observer* to `null` in `ScreenWindowTraits.setTranslucent` effectively removes **any** listener currently attached to decor view, thus preventing other functionalities from work (such as `StatusBar.setTranslucent`). Right now all inset listeners on decor view in our lib are supposed to be managed via `InsetObserverProxy` and I want to keep it that way. The "invalid behaviour" #2371 was supposed to fix, was caused by call to `StatusBar.setTranslucent` in Example app, which started to work after I've removed "nulling any listener" in `ScreenWindowTraits.setTranslucent`. I am not sure what is the intended interaction, but earlier we simply prevented `StatusBar` api to work correctly (it could work if user had a lucky timing...). I guess we'll be better off with what I'm proposing now. Bottomline is I want to get rid of these props from the lib anyway. @WoLewicki I'm gonna proceed, but I want you to provide me with your opinion, especially in case your assessment is different from mine. ## Changes * Clearing only our observer if it has been registered with proxy, * Removed the call to `StatusBar.setTranslucent` in Example app making it work correctly. I don't know why call to `setTranslucent` was there in first place, most likely some left over after `statusBarTranslucent` prop had been introduced. This is how this works now: https://github.com/user-attachments/assets/baa5ed34-11ab-4549-b35b-b86d5ef0b471 ## Test code and steps to reproduce `TestAndroirdTransitions` ## 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
- Loading branch information