gorhom / react-native-bottom-sheet

A performant interactive bottom sheet with fully configurable options 🚀
https://gorhom.dev/react-native-bottom-sheet/
MIT License
7.07k stars 777 forks source link

[Bug]: onAnimate executed 2 times if autofocus is set true on the BottomSheetTextInput #2012

Open kawasakime opened 3 weeks ago

kawasakime commented 3 weeks ago

Version

v5

Reanimated Version

v3

Gesture Handler Version

v2

Platforms

iOS, Android

What happened?

If you set the prop autoFocus={true} in the BottomSheetTextInput, then due to the opening of the keyboard, onAnimate executed twice, which leads to backdrop lags (the appearance animation occurs twice). Android suffers to a greater extent, since iOS does not have such a visual problem.

We currently have version 4.6.4 in the project and there is no such problem.

https://github.com/user-attachments/assets/877522cd-1c5e-417a-afba-b74f438738ea

Reproduction steps

Reproduction sample

https://snack.expo.dev/q8k_w0qzlr4rouvpqrsum

Relevant log output

No response

kawasakime commented 3 days ago

In version 5.0.6 the problem remained. At the same time, funny behavior results. 1) If you do autofocus with a delay (in my case 200ms), then the bottom sheet will most likely close immediately. Sometimes there is no lag with the backdrop, but more often there is lag, or even more likely the bottom sheet simply closes. 2) If autofocus is without a delay, then onAnimate still fires twice, which causes backdrop lag

Only Android

https://github.com/user-attachments/assets/ef570507-565f-48f4-a7c1-d3323404ef77

https://github.com/user-attachments/assets/21580822-6f54-49d9-83c4-57ffc92b0899