Bluesky app fork with some witchin' additions 💫
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Implement prefersReducedMotion on native (#4039)

* implement prefersReducedMotion on native

* just take the function from the reanimated source

* use patch-package to export internal function

authored by

Samuel Newman and committed by
GitHub
aded49f6 3674c8ab

+32 -4
+30
patches/react-native-reanimated+3.6.0.patch
··· 1 + diff --git a/node_modules/react-native-reanimated/lib/module/reanimated2/index.js b/node_modules/react-native-reanimated/lib/module/reanimated2/index.js 2 + index 91e49f4..c10d3fc 100644 3 + --- a/node_modules/react-native-reanimated/lib/module/reanimated2/index.js 4 + +++ b/node_modules/react-native-reanimated/lib/module/reanimated2/index.js 5 + @@ -45,4 +45,5 @@ export { getUseOfValueInStyleWarning } from './pluginUtils'; 6 + export { withReanimatedTimer, advanceAnimationByTime, advanceAnimationByFrame, setUpTests, getAnimatedStyle } from './jestUtils'; 7 + export { LayoutAnimationConfig } from './component/LayoutAnimationConfig'; 8 + export { startMapper, stopMapper } from './mappers'; 9 + +export { isReducedMotion } from './PlatformChecker'; 10 + //# sourceMappingURL=index.js.map 11 + \ No newline at end of file 12 + diff --git a/node_modules/react-native-reanimated/lib/typescript/reanimated2/index.d.ts b/node_modules/react-native-reanimated/lib/typescript/reanimated2/index.d.ts 13 + index 96bd913..ad63a09 100644 14 + --- a/node_modules/react-native-reanimated/lib/typescript/reanimated2/index.d.ts 15 + +++ b/node_modules/react-native-reanimated/lib/typescript/reanimated2/index.d.ts 16 + @@ -33,3 +33,4 @@ export type { Adaptable, AdaptTransforms, AnimateProps, AnimatedProps, AnimatedT 17 + export type { AnimatedScrollViewProps } from './component/ScrollView'; 18 + export type { FlatListPropsWithLayout } from './component/FlatList'; 19 + export { startMapper, stopMapper } from './mappers'; 20 + +export { isReducedMotion } from './PlatformChecker'; 21 + diff --git a/node_modules/react-native-reanimated/src/reanimated2/index.ts b/node_modules/react-native-reanimated/src/reanimated2/index.ts 22 + index 096dc05..38fc01d 100644 23 + --- a/node_modules/react-native-reanimated/src/reanimated2/index.ts 24 + +++ b/node_modules/react-native-reanimated/src/reanimated2/index.ts 25 + @@ -271,3 +271,4 @@ export type { 26 + export type { AnimatedScrollViewProps } from './component/ScrollView'; 27 + export type { FlatListPropsWithLayout } from './component/FlatList'; 28 + export { startMapper, stopMapper } from './mappers'; 29 + +export { isReducedMotion } from './PlatformChecker'; 30 + \ No newline at end of file
+2 -4
src/platform/detection.ts
··· 1 1 import {Platform} from 'react-native' 2 + import {isReducedMotion} from 'react-native-reanimated' 2 3 import {getLocales} from 'expo-localization' 3 4 4 5 import {dedupArray} from 'lib/functions' ··· 20 21 .filter(code => typeof code === 'string'), 21 22 ) as string[] 22 23 23 - export const prefersReducedMotion = 24 - isWeb && 25 - // @ts-ignore we know window exists -prf 26 - !global.window.matchMedia('(prefers-reduced-motion: no-preference)')?.matches 24 + export const prefersReducedMotion = isReducedMotion()