Skip to content

Conversation

maciekstosio
Copy link
Contributor

@maciekstosio maciekstosio commented May 23, 2025

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

  • Test2774.tsx
  • Test2895.tsx
  • TestFormSheet.tsx

Checklist

  • Included code example that can be used to test this change
  • Ensured that CI passes

@kkafar kkafar mentioned this pull request May 27, 2025
8 tasks
## 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
@kkafar
Copy link
Member

kkafar commented May 28, 2025

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 TestFormSheet screen.

Screen.Recording.2025-05-28.at.12.05.19.mov

Caution

This works fine on main.

@kkafar
Copy link
Member

kkafar commented May 28, 2025

Found another bug on API 29, that does not happen on API 35

Screen.Recording.2025-05-28.at.12.06.46.mov

Video recorded on TestFormSheet

Caution

This works on main.

Copy link
Member

@kkafar kkafar left a 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants