Add PlatformInfo module (#4877)

This commit is contained in:
Hailey 2024-08-05 12:21:34 -07:00 committed by GitHub
parent fb278384c6
commit 18b423396b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 92 additions and 38 deletions

View file

@ -0,0 +1,7 @@
import {requireNativeModule} from 'expo-modules-core'
const NativeModule = requireNativeModule('ExpoPlatformInfo')
export function getIsReducedMotionEnabled(): boolean {
return NativeModule.getIsReducedMotionEnabled()
}

View file

@ -0,0 +1,5 @@
import {NotImplementedError} from '../NotImplemented'
export function getIsReducedMotionEnabled(): boolean {
throw new NotImplementedError()
}

View file

@ -0,0 +1,6 @@
export function getIsReducedMotionEnabled(): boolean {
if (typeof window === 'undefined') {
return false
}
return window.matchMedia('(prefers-reduced-motion: reduce)').matches
}