Closed skizzo closed 11 months ago
Is it possible that you have enabled "reduce motion" option in system preferences?
Oh my god, you're a life saver. This was absolutely the case, I just turned it back on and everything works as it should!
Stupid question, but is there any way to force animations even when this reduced motion is enabled in system settings?
@skizzo You can force animation with ReduceMotion.Never
, see more details in the docs here.
@piaskowyk @tomekzaw thank you, but is there any way to set ReduceMotion.Never as default, some packages that rely on react-native-reanimated will have many strange behaviors like react-native-bottom-sheet, and many exist projects have a lot of animations, if I can set ReduceMotion.Never as default in only one place, the repair would be less invasive.
but is there any way to set ReduceMotion.Never as default, some packages that rely on react-native-reanimated will have many strange behaviors like https://github.com/gorhom/react-native-bottom-sheet/issues/1560, and many exist projects have a lot of animations, if I can set ReduceMotion.Never as default in only one place, the repair would be less invasive.
Agreed, I wasn't able to understand from the docs if there exists a way with reanimated to set global defaults?
did you find any solution for this?
did you find any solution for this?
Yes, just read the comments above
sorry, I meant is there any way to disable reducedMotion globally?
sorry, I meant is there any way to disable reducedMotion globally?
I don't think so, you need to specify it every time you define an animation. But I agree, would be super handy to have a global setting..
sorry, I meant is there any way to disable reducedMotion globally?
A patch is possible (you can apply via patch directly, or via patch-package)
--- a/react-native-reanimated/lib/module/reanimated2/PlatformChecker.js
+++ b/react-native-reanimated/lib/module/reanimated2/PlatformChecker.js
@@ -33,6 +33,6 @@ export function isWindowAvailable() {
export function isReducedMotion() {
return isWeb() ? isWindowAvailable() ?
// @ts-ignore Fallback if `window` is undefined.
- !window.matchMedia('(prefers-reduced-motion: no-preference)').matches : false : global._REANIMATED_IS_REDUCED_MOTION ?? false;
+ !window.matchMedia('(prefers-reduced-motion: no-preference)').matches : false : false;
}
-//# sourceMappingURL=PlatformChecker.js.map
\ No newline at end of file
+//# sourceMappingURL=PlatformChecker.js.map
diff --git a/react-native-reanimated/src/reanimated2/PlatformChecker.ts b/react-native-reanimated/src/reanimated2/PlatformChecker.ts
index 9b3fcb1..0111380 100644
--- a/react-native-reanimated/src/reanimated2/PlatformChecker.ts
+++ b/react-native-reanimated/src/reanimated2/PlatformChecker.ts
@@ -49,5 +49,5 @@ export function isReducedMotion() {
? // @ts-ignore Fallback if `window` is undefined.
!window.matchMedia('(prefers-reduced-motion: no-preference)').matches
: false
- : (global as localGlobal)._REANIMATED_IS_REDUCED_MOTION ?? false;
+ : false;
}
Is it possible that you have enabled "reduce motion" option in system preferences?
Still faces with this problem, is there any updates to get adjust motion globally, as warning indicaces, this can only visible on the development mode but it would be super to make changes on app level.
Description
Animating styles, e.g. with
useAnimatedStyle
, works fine on Android (emulator & physical device) and iOS Simulator, but not on actual iOS device.There is no animation at all, the state is just changed instantly.
I'm using
react-native-vision-camera
2.15.6
, also, the error does not reproduce in the Snack provided, I don't know why.My Podfile, just in case:
Steps to reproduce
Install react-native-reanimated 3.4.1 and react-native-vision-camera 2.15.6
Define animated style:
Use in an
Animated.View
:Snack or a link to a repository
https://snack.expo.dev/p7GpSPR_6
Reanimated version
3.4.1
React Native version
0.71.11
Platforms
iOS
JavaScript runtime
Hermes
Workflow
React Native
Architecture
Paper (Old Architecture)
Build type
Debug mode
Device
Real device
Device model
iPhone 7
Acknowledgements
Yes