/
githubmirror
/
client
Обзор
Документация
Войти
/
githubmirror
/
client
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
shared/constants/init/platform.native.tsx
55 строк
2 KB
chrisnojima
move to vite (#29386)
09 июл 2026, 00:46
Не верифицирован
09 июл 2026, 00:46
bcd1945
Код
Авторство
О чём код?
import * as ExpoLocation from 'expo-location' import * as ExpoTaskManager from 'expo-task-manager' import NetInfo, {NetInfoStateType} from '@react-native-community/netinfo' import {Linking} from 'react-native' import {setupAudioMode} from '@/util/audio.native' import {requestLocationPermission} from '@/util/platform-specific' import { fsCacheDir, fsDownloadDir, androidAppColorSchemeChanged, guiConfig, shareListenersRegistered, } from 'react-native-kb' import type {DesktopModules, NativeModules, NativeSyncModules} from './platform-types' export const getNative = (): NativeModules => ({ ExpoLocation, ExpoTaskManager, Linking, // NetInfoStateType is a named export, not part of the default export; merge // it in so consumers can read NetInfo.NetInfoStateType (default-import under // ESM drops named exports that require() used to expose). NetInfo: {...NetInfo, NetInfoStateType}, androidAppColorSchemeChanged, fsCacheDir, fsDownloadDir, guiConfig, requestLocationPermission, setupAudioMode, shareListenersRegistered, }) as unknown as NativeModules export const getNativeSync = (): NativeSyncModules => ({ androidAppColorSchemeChanged, fsCacheDir, fsDownloadDir, guiConfig, shareListenersRegistered, }) as unknown as NativeSyncModules export {initPushListener} from './push-listener.native' // DOM helpers are desktop-only. export const maybePauseVideos = (): void => {} export const setupWindowEventListeners = ( _onFocus: () => void, _onBlur: () => void, _onOnline: () => void, _onOffline: () => void ): void => {} export const getDesktop = (): DesktopModules => { throw new Error('init/getDesktop called on native') }