-
-
Couldn't load subscription status.
- Fork 907
fix: Math.floor animatedIndex value in BottomSheetBackdrop to fix And… #2342
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: master
Are you sure you want to change the base?
Conversation
…roid freeze issue
|
Confirmed this fixed issues on my Pixel 9a making device unresponsive. Inspecting the elements showed the BottomSheetBackdrop was covering the entire screen, consuming pointer events. The issue would occur randomly with animations turned on. Turning animations off however made the issue appear 100% of the time. Although Math.floor() fixes the blocked pointer events, I noticed it introduced a new behavior where you can tap through the backdrop until the bottom sheet is completely done opening.
Both Math.floor() & Math.round() leave too big of a window where the backdrop can still be touched through. If you need the bottom sheet to restrict page interaction, that can be a serious issue. I do not think this package is inherently doing anything wrong & the bug is at a much lower level since its so device & OS specific. Even though its a 'magic number' solution, I will probably use this workaround until the root issue is solved. |
|
thanks @margreen94 for submitting this PR and detailing the issue. For me based on the information provided, it seems to me that we need to address the issue with no-animation accessibility issue on Android devices to be handled properly. Unfortunately accessibility is not my strong skill to solve this issue. Let me investigate it first, then i'll decide either it worth investing the root cause or accept the short term solution. |
425b6ec to
a123b17
Compare
|
Seeing this issue on rn 0.81.4 with new arch but noting this is with reanimated v4 which I realize is not listed as supported by bottom sheet. Several users reported the issue on Android with various OS versions and different devices. Not sure what is the common denominator but I was able to reproduce it with a Pixel 9 sdk 36 emulator. I did not see this issue on 0.75.5 old arch with reanimated v3. The PR does solve the issue for me. Thanks! |
|
Hello, is it going to be merged? im facing freezing issue on android device using expo sdk53, reanimated v4 |
|
+1 |
|
@gorhom Hello again! Any update on this being merged? |
Motivation
On some Android devices, with disabled animations, any screen with the component appears to "freeze". No component on the screen is able to be interacted with. The user cannot open the bottom sheet, click any buttons, or even scroll.
Steps to reproduce
backdropComponent.Problem
The root of the issue appears to be the
useAnimatedReactionhook in theBottomSheetBackdrop.tsxcomponent. The screen appears to "freeze" because although the backdrop is not visible, the backdrop logic is incorrectly disabling the touchability of the screen. On certain Android devices with reduced animations "on", the sharedValue ofanimatedIndex.valueonly reaches the value of -0.999… and never crosses the threshold of -1 which is thedisappearsOnIndexvalue. Thus, the return value on line 118 will always equal "false" and cause thehandleContainerTouchabilityfunction to disable the pointerEvents and appear to "freeze" the screen.Solution
The proposed solution is to Math.floor() the
animatedIndexsharedValue before comparing it to thedisappearsOnIndexvalue. This will ensure that if the sharedValue does not quite reach thedisappearsOnIndexvalue, it will not incorrectly disable touchability. In my app, I have this fixed as a local patch but am looking for a more long-term solution with this PR.Listed below are previous closed issues related to this fix:
#807
#1882
#527
#566