Skip to content
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

[v4] Add ReduceMotion option for Reanimated v3 #1582

Closed
cancit opened this issue Oct 20, 2023 · 1 comment
Closed

[v4] Add ReduceMotion option for Reanimated v3 #1582

cancit opened this issue Oct 20, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@cancit
Copy link

cancit commented Oct 20, 2023

Bug

Note: This issue happens with Reanimated v3 - feel free to close this issue as this library supports Reanimated v2

Reanimated has introduced ReduceMotion settings and by default it follows the system settings: https://docs.swmansion.com/react-native-reanimated/docs/guides/accessibility/

When we run E2E tests on android devices, we disable animations to speed up tests and prevent flakiness:

adb shell settings put global window_animation_scale 0.0
adb shell settings put global transition_animation_scale 0.0
adb shell settings put global animator_duration_scale 0.0

Because of this change in Reanimated, bottom sheet doesn't show up at all if the animations are disabled on the device and BottomSheet's onClose prop is called immediately.

I managed to fix it by adding reduceMotion: "never" to ANIMATION_CONFIGS_ANDROID https://github.com/gorhom/react-native-bottom-sheet/blob/master/src/constants.ts#L77-L80 - and I expect it will work as before with Reanimated v2

Environment info

Android API 34 - Emulator

Library Version
@gorhom/bottom-sheet 4.5.1
react-native 0.72.5
react-native-reanimated 3.5.4
react-native-gesture-handler 2.10.0

Steps To Reproduce

  1. Disable animations on Android device
adb shell settings put global window_animation_scale 0.0
adb shell settings put global transition_animation_scale 0.0
adb shell settings put global animator_duration_scale 0.0
  1. Try to open a bottom sheet
  2. Bottom sheet gets dismissed immediately

Describe what you expected to happen:

  1. Bottom sheet should be displayed even though the animations are disabled

Reproducible sample code

@cancit cancit added the bug Something isn't working label Oct 20, 2023
@cancit
Copy link
Author

cancit commented Oct 20, 2023

This looks like a better solution: #1560 (comment)

@cancit cancit closed this as completed Oct 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant