@amabeth/repeating-wheel-picker 1.2.0 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -2
- package/example/node_modules/@expo/cli/static/template/+html.tsx +0 -28
- package/example/node_modules/@expo/cli/static/template/+native-intent.ts +0 -9
- package/example/node_modules/@expo/cli/static/template/[...rsc]+api.ts +0 -16
- package/example/node_modules/ansi-styles/index.d.ts +0 -345
- package/example/node_modules/chalk/index.d.ts +0 -415
- package/example/node_modules/commander/typings/index.d.ts +0 -627
- package/example/node_modules/expo/Expo.podspec +0 -108
- package/example/node_modules/expo/build/Expo.d.ts +0 -8
- package/example/node_modules/expo/build/Expo.fx.d.ts +0 -4
- package/example/node_modules/expo/build/Expo.fx.web.d.ts +0 -3
- package/example/node_modules/expo/build/devtools/DevToolsPluginClient.d.ts +0 -72
- package/example/node_modules/expo/build/devtools/DevToolsPluginClientFactory.d.ts +0 -16
- package/example/node_modules/expo/build/devtools/DevToolsPluginClientImplApp.d.ts +0 -15
- package/example/node_modules/expo/build/devtools/DevToolsPluginClientImplBrowser.d.ts +0 -14
- package/example/node_modules/expo/build/devtools/MessageFramePacker.d.ts +0 -50
- package/example/node_modules/expo/build/devtools/ProtocolVersion.d.ts +0 -7
- package/example/node_modules/expo/build/devtools/WebSocketBackingStore.d.ts +0 -10
- package/example/node_modules/expo/build/devtools/WebSocketWithReconnect.d.ts +0 -81
- package/example/node_modules/expo/build/devtools/devtools.types.d.ts +0 -42
- package/example/node_modules/expo/build/devtools/getConnectionInfo.d.ts +0 -6
- package/example/node_modules/expo/build/devtools/getConnectionInfo.native.d.ts +0 -6
- package/example/node_modules/expo/build/devtools/index.d.ts +0 -12
- package/example/node_modules/expo/build/devtools/logger.d.ts +0 -6
- package/example/node_modules/expo/build/dom/base.d.ts +0 -5
- package/example/node_modules/expo/build/dom/dom-entry.d.ts +0 -3
- package/example/node_modules/expo/build/dom/dom-hooks.d.ts +0 -8
- package/example/node_modules/expo/build/dom/dom.d.ts +0 -5
- package/example/node_modules/expo/build/dom/dom.types.d.ts +0 -34
- package/example/node_modules/expo/build/dom/dom.web.d.ts +0 -3
- package/example/node_modules/expo/build/dom/global-events.d.ts +0 -4
- package/example/node_modules/expo/build/dom/injection.d.ts +0 -9
- package/example/node_modules/expo/build/dom/internal.d.ts +0 -3
- package/example/node_modules/expo/build/dom/internal.web.d.ts +0 -2
- package/example/node_modules/expo/build/dom/marshal.d.ts +0 -4
- package/example/node_modules/expo/build/dom/webview/ExpoDOMWebView.d.ts +0 -6
- package/example/node_modules/expo/build/dom/webview/RNWebView.d.ts +0 -7
- package/example/node_modules/expo/build/dom/webview/useDebugZeroHeight.d.ts +0 -12
- package/example/node_modules/expo/build/dom/webview-wrapper.d.ts +0 -16
- package/example/node_modules/expo/build/environment/DevLoadingView.d.ts +0 -3
- package/example/node_modules/expo/build/environment/DevLoadingView.web.d.ts +0 -3
- package/example/node_modules/expo/build/environment/DevLoadingViewNativeModule.d.ts +0 -9
- package/example/node_modules/expo/build/environment/DevLoadingViewNativeModule.native.d.ts +0 -3
- package/example/node_modules/expo/build/environment/ExpoGo.d.ts +0 -31
- package/example/node_modules/expo/build/environment/ExpoGo.web.d.ts +0 -3
- package/example/node_modules/expo/build/environment/getInitialSafeArea.d.ts +0 -7
- package/example/node_modules/expo/build/environment/getInitialSafeArea.native.d.ts +0 -11
- package/example/node_modules/expo/build/errors/AppEntryNotFound.d.ts +0 -2
- package/example/node_modules/expo/build/errors/ExpoErrorManager.d.ts +0 -8
- package/example/node_modules/expo/build/errors/ExpoErrorManager.native.d.ts +0 -4
- package/example/node_modules/expo/build/hooks/useEvent.d.ts +0 -59
- package/example/node_modules/expo/build/launch/registerRootComponent.d.ts +0 -30
- package/example/node_modules/expo/build/launch/withDevTools.d.ts +0 -3
- package/example/node_modules/expo/build/launch/withDevTools.ios.d.ts +0 -7
- package/example/node_modules/expo/build/launch/withDevTools.web.d.ts +0 -3
- package/example/node_modules/expo/build/timer/polyfillNextTick.d.ts +0 -6
- package/example/node_modules/expo/build/utils/blobUtils.d.ts +0 -9
- package/example/node_modules/expo/build/utils/getBundleUrl.d.ts +0 -2
- package/example/node_modules/expo/build/utils/getBundleUrl.native.d.ts +0 -2
- package/example/node_modules/expo/build/utils/getBundleUrl.web.d.ts +0 -2
- package/example/node_modules/expo/build/winter/FormData.d.ts +0 -49
- package/example/node_modules/expo/build/winter/ImportMetaRegistry.d.ts +0 -9
- package/example/node_modules/expo/build/winter/TextDecoder.d.ts +0 -20
- package/example/node_modules/expo/build/winter/fetch/ExpoFetchModule.d.ts +0 -2
- package/example/node_modules/expo/build/winter/fetch/ExpoFetchModule.web.d.ts +0 -10
- package/example/node_modules/expo/build/winter/fetch/FetchErrors.d.ts +0 -8
- package/example/node_modules/expo/build/winter/fetch/FetchResponse.d.ts +0 -31
- package/example/node_modules/expo/build/winter/fetch/NativeRequest.d.ts +0 -30
- package/example/node_modules/expo/build/winter/fetch/RequestUtils.d.ts +0 -21
- package/example/node_modules/expo/build/winter/fetch/convertFormData.d.ts +0 -19
- package/example/node_modules/expo/build/winter/fetch/fetch.d.ts +0 -4
- package/example/node_modules/expo/build/winter/fetch/fetch.types.d.ts +0 -16
- package/example/node_modules/expo/build/winter/fetch/fetch.web.d.ts +0 -2
- package/example/node_modules/expo/build/winter/fetch/index.d.ts +0 -3
- package/example/node_modules/expo/build/winter/index.d.ts +0 -2
- package/example/node_modules/expo/build/winter/runtime.d.ts +0 -2
- package/example/node_modules/expo/build/winter/runtime.native.d.ts +0 -2
- package/example/node_modules/expo/build/winter/url.d.ts +0 -23
- package/example/node_modules/expo/config-plugins.d.ts +0 -1
- package/example/node_modules/expo/config.d.ts +0 -1
- package/example/node_modules/expo/devtools.d.ts +0 -1
- package/example/node_modules/expo/dom/global.d.ts +0 -1
- package/example/node_modules/expo/dom/index.d.ts +0 -1
- package/example/node_modules/expo/dom/internal.d.ts +0 -1
- package/example/node_modules/expo/fetch.d.ts +0 -1
- package/example/node_modules/expo/fingerprint.d.ts +0 -1
- package/example/node_modules/expo/metro-config.d.ts +0 -1
- package/example/node_modules/expo/react-native.config.js +0 -50
- package/example/node_modules/expo/src/Expo.fx.tsx +0 -53
- package/example/node_modules/expo/src/Expo.fx.web.tsx +0 -21
- package/example/node_modules/expo/src/Expo.ts +0 -30
- package/example/node_modules/expo/src/devtools/DevToolsPluginClient.ts +0 -240
- package/example/node_modules/expo/src/devtools/DevToolsPluginClientFactory.ts +0 -73
- package/example/node_modules/expo/src/devtools/DevToolsPluginClientImplApp.ts +0 -56
- package/example/node_modules/expo/src/devtools/DevToolsPluginClientImplBrowser.ts +0 -38
- package/example/node_modules/expo/src/devtools/MessageFramePacker.ts +0 -235
- package/example/node_modules/expo/src/devtools/ProtocolVersion.ts +0 -6
- package/example/node_modules/expo/src/devtools/WebSocketBackingStore.ts +0 -10
- package/example/node_modules/expo/src/devtools/WebSocketWithReconnect.ts +0 -318
- package/example/node_modules/expo/src/devtools/devtools.types.ts +0 -50
- package/example/node_modules/expo/src/devtools/getConnectionInfo.native.ts +0 -18
- package/example/node_modules/expo/src/devtools/getConnectionInfo.ts +0 -16
- package/example/node_modules/expo/src/devtools/index.ts +0 -53
- package/example/node_modules/expo/src/devtools/logger.ts +0 -29
- package/example/node_modules/expo/src/dom/base.ts +0 -62
- package/example/node_modules/expo/src/dom/dom-entry.tsx +0 -128
- package/example/node_modules/expo/src/dom/dom-hooks.ts +0 -46
- package/example/node_modules/expo/src/dom/dom.ts +0 -8
- package/example/node_modules/expo/src/dom/dom.types.ts +0 -39
- package/example/node_modules/expo/src/dom/dom.web.ts +0 -6
- package/example/node_modules/expo/src/dom/global-events.ts +0 -16
- package/example/node_modules/expo/src/dom/injection.ts +0 -42
- package/example/node_modules/expo/src/dom/internal.ts +0 -5
- package/example/node_modules/expo/src/dom/internal.web.ts +0 -1
- package/example/node_modules/expo/src/dom/marshal.tsx +0 -116
- package/example/node_modules/expo/src/dom/webview/ExpoDOMWebView.ts +0 -10
- package/example/node_modules/expo/src/dom/webview/RNWebView.ts +0 -12
- package/example/node_modules/expo/src/dom/webview/useDebugZeroHeight.ts +0 -62
- package/example/node_modules/expo/src/dom/webview-wrapper.tsx +0 -253
- package/example/node_modules/expo/src/environment/DevLoadingView.tsx +0 -123
- package/example/node_modules/expo/src/environment/DevLoadingView.web.tsx +0 -135
- package/example/node_modules/expo/src/environment/DevLoadingViewNativeModule.native.ts +0 -3
- package/example/node_modules/expo/src/environment/DevLoadingViewNativeModule.ts +0 -7
- package/example/node_modules/expo/src/environment/ExpoGo.ts +0 -53
- package/example/node_modules/expo/src/environment/ExpoGo.web.ts +0 -7
- package/example/node_modules/expo/src/environment/getInitialSafeArea.native.ts +0 -16
- package/example/node_modules/expo/src/environment/getInitialSafeArea.ts +0 -8
- package/example/node_modules/expo/src/errors/AppEntryNotFound.tsx +0 -35
- package/example/node_modules/expo/src/errors/ExpoErrorManager.native.ts +0 -51
- package/example/node_modules/expo/src/errors/ExpoErrorManager.ts +0 -11
- package/example/node_modules/expo/src/hooks/useEvent.ts +0 -112
- package/example/node_modules/expo/src/launch/registerRootComponent.tsx +0 -64
- package/example/node_modules/expo/src/launch/withDevTools.ios.tsx +0 -47
- package/example/node_modules/expo/src/launch/withDevTools.tsx +0 -30
- package/example/node_modules/expo/src/launch/withDevTools.web.tsx +0 -23
- package/example/node_modules/expo/src/timer/polyfillNextTick.ts +0 -10
- package/example/node_modules/expo/src/ts-declarations/console.d.ts +0 -47
- package/example/node_modules/expo/src/ts-declarations/global.d.ts +0 -12
- package/example/node_modules/expo/src/ts-declarations/react-native.d.ts +0 -34
- package/example/node_modules/expo/src/ts-declarations/whatwg-url-without-unicode.d.ts +0 -186
- package/example/node_modules/expo/src/utils/blobUtils.ts +0 -23
- package/example/node_modules/expo/src/utils/getBundleUrl.native.ts +0 -17
- package/example/node_modules/expo/src/utils/getBundleUrl.ts +0 -5
- package/example/node_modules/expo/src/utils/getBundleUrl.web.ts +0 -21
- package/example/node_modules/expo/src/winter/FormData.ts +0 -222
- package/example/node_modules/expo/src/winter/ImportMetaRegistry.ts +0 -14
- package/example/node_modules/expo/src/winter/TextDecoder.ts +0 -429
- package/example/node_modules/expo/src/winter/fetch/ExpoFetchModule.ts +0 -3
- package/example/node_modules/expo/src/winter/fetch/ExpoFetchModule.web.ts +0 -7
- package/example/node_modules/expo/src/winter/fetch/FetchErrors.ts +0 -11
- package/example/node_modules/expo/src/winter/fetch/FetchResponse.ts +0 -146
- package/example/node_modules/expo/src/winter/fetch/NativeRequest.ts +0 -38
- package/example/node_modules/expo/src/winter/fetch/RequestUtils.ts +0 -124
- package/example/node_modules/expo/src/winter/fetch/convertFormData.ts +0 -92
- package/example/node_modules/expo/src/winter/fetch/fetch.ts +0 -59
- package/example/node_modules/expo/src/winter/fetch/fetch.types.ts +0 -17
- package/example/node_modules/expo/src/winter/fetch/fetch.web.ts +0 -1
- package/example/node_modules/expo/src/winter/fetch/index.ts +0 -2
- package/example/node_modules/expo/src/winter/index.ts +0 -1
- package/example/node_modules/expo/src/winter/runtime.native.ts +0 -41
- package/example/node_modules/expo/src/winter/runtime.ts +0 -5
- package/example/node_modules/expo/src/winter/url.ts +0 -116
- package/example/node_modules/expo/types/global.d.ts +0 -38
- package/example/node_modules/expo/types/index.d.ts +0 -3
- package/example/node_modules/expo/types/metro-require.d.ts +0 -52
- package/example/node_modules/expo/types/react-native-web.d.ts +0 -291
- package/example/node_modules/expo-modules-autolinking/build/ExpoModuleConfig.d.ts +0 -85
- package/example/node_modules/expo-modules-autolinking/build/autolinking/findModules.d.ts +0 -5
- package/example/node_modules/expo-modules-autolinking/build/autolinking/generatePackageList.d.ts +0 -11
- package/example/node_modules/expo-modules-autolinking/build/autolinking/getConfiguration.d.ts +0 -2
- package/example/node_modules/expo-modules-autolinking/build/autolinking/index.d.ts +0 -17
- package/example/node_modules/expo-modules-autolinking/build/autolinking/mergeLinkingOptions.d.ts +0 -21
- package/example/node_modules/expo-modules-autolinking/build/autolinking/resolveModules.d.ts +0 -9
- package/example/node_modules/expo-modules-autolinking/build/autolinking/utils.d.ts +0 -6
- package/example/node_modules/expo-modules-autolinking/build/autolinking/verifySearchResults.d.ts +0 -5
- package/example/node_modules/expo-modules-autolinking/build/fileUtils.d.ts +0 -18
- package/example/node_modules/expo-modules-autolinking/build/index.d.ts +0 -1
- package/example/node_modules/expo-modules-autolinking/build/platforms/android.d.ts +0 -38
- package/example/node_modules/expo-modules-autolinking/build/platforms/apple.d.ts +0 -15
- package/example/node_modules/expo-modules-autolinking/build/platforms/devtools.d.ts +0 -3
- package/example/node_modules/expo-modules-autolinking/build/reactNativeConfig/androidResolver.d.ts +0 -20
- package/example/node_modules/expo-modules-autolinking/build/reactNativeConfig/config.d.ts +0 -5
- package/example/node_modules/expo-modules-autolinking/build/reactNativeConfig/index.d.ts +0 -2
- package/example/node_modules/expo-modules-autolinking/build/reactNativeConfig/iosResolver.d.ts +0 -2
- package/example/node_modules/expo-modules-autolinking/build/reactNativeConfig/reactNativeConfig.d.ts +0 -13
- package/example/node_modules/expo-modules-autolinking/build/reactNativeConfig/reactNativeConfig.types.d.ts +0 -95
- package/example/node_modules/expo-modules-autolinking/build/types.d.ts +0 -319
- package/example/node_modules/expo-modules-autolinking/e2e/TestUtils.ts +0 -53
- package/example/node_modules/expo-modules-autolinking/exports.d.ts +0 -1
- package/example/node_modules/expo-modules-autolinking/src/ExpoModuleConfig.ts +0 -181
- package/example/node_modules/expo-modules-autolinking/src/autolinking/findModules.ts +0 -259
- package/example/node_modules/expo-modules-autolinking/src/autolinking/generatePackageList.ts +0 -46
- package/example/node_modules/expo-modules-autolinking/src/autolinking/getConfiguration.ts +0 -7
- package/example/node_modules/expo-modules-autolinking/src/autolinking/index.ts +0 -45
- package/example/node_modules/expo-modules-autolinking/src/autolinking/mergeLinkingOptions.ts +0 -127
- package/example/node_modules/expo-modules-autolinking/src/autolinking/resolveModules.ts +0 -46
- package/example/node_modules/expo-modules-autolinking/src/autolinking/utils.ts +0 -37
- package/example/node_modules/expo-modules-autolinking/src/autolinking/verifySearchResults.ts +0 -33
- package/example/node_modules/expo-modules-autolinking/src/fileUtils.ts +0 -64
- package/example/node_modules/expo-modules-autolinking/src/index.ts +0 -262
- package/example/node_modules/expo-modules-autolinking/src/platforms/android.ts +0 -303
- package/example/node_modules/expo-modules-autolinking/src/platforms/apple.ts +0 -292
- package/example/node_modules/expo-modules-autolinking/src/platforms/devtools.ts +0 -25
- package/example/node_modules/expo-modules-autolinking/src/reactNativeConfig/androidResolver.ts +0 -264
- package/example/node_modules/expo-modules-autolinking/src/reactNativeConfig/config.ts +0 -67
- package/example/node_modules/expo-modules-autolinking/src/reactNativeConfig/index.ts +0 -2
- package/example/node_modules/expo-modules-autolinking/src/reactNativeConfig/iosResolver.ts +0 -37
- package/example/node_modules/expo-modules-autolinking/src/reactNativeConfig/reactNativeConfig.ts +0 -245
- package/example/node_modules/expo-modules-autolinking/src/reactNativeConfig/reactNativeConfig.types.ts +0 -107
- package/example/node_modules/expo-modules-autolinking/src/types.ts +0 -384
- package/example/node_modules/find-up/index.d.ts +0 -138
- package/example/node_modules/glob/dist/commonjs/glob.d.ts +0 -388
- package/example/node_modules/glob/dist/commonjs/has-magic.d.ts +0 -14
- package/example/node_modules/glob/dist/commonjs/ignore.d.ts +0 -24
- package/example/node_modules/glob/dist/commonjs/index.d.ts +0 -97
- package/example/node_modules/glob/dist/commonjs/pattern.d.ts +0 -76
- package/example/node_modules/glob/dist/commonjs/processor.d.ts +0 -59
- package/example/node_modules/glob/dist/commonjs/walker.d.ts +0 -97
- package/example/node_modules/glob/dist/esm/glob.d.ts +0 -388
- package/example/node_modules/glob/dist/esm/has-magic.d.ts +0 -14
- package/example/node_modules/glob/dist/esm/ignore.d.ts +0 -24
- package/example/node_modules/glob/dist/esm/index.d.ts +0 -97
- package/example/node_modules/glob/dist/esm/pattern.d.ts +0 -76
- package/example/node_modules/glob/dist/esm/processor.d.ts +0 -59
- package/example/node_modules/glob/dist/esm/walker.d.ts +0 -97
- package/example/node_modules/locate-path/index.d.ts +0 -83
- package/example/node_modules/log-symbols/node_modules/chalk/types/index.d.ts +0 -97
- package/example/node_modules/minimatch/dist/commonjs/assert-valid-pattern.d.ts +0 -2
- package/example/node_modules/minimatch/dist/commonjs/ast.d.ts +0 -20
- package/example/node_modules/minimatch/dist/commonjs/brace-expressions.d.ts +0 -8
- package/example/node_modules/minimatch/dist/commonjs/escape.d.ts +0 -12
- package/example/node_modules/minimatch/dist/commonjs/index.d.ts +0 -94
- package/example/node_modules/minimatch/dist/commonjs/unescape.d.ts +0 -17
- package/example/node_modules/minimatch/dist/esm/assert-valid-pattern.d.ts +0 -2
- package/example/node_modules/minimatch/dist/esm/ast.d.ts +0 -20
- package/example/node_modules/minimatch/dist/esm/brace-expressions.d.ts +0 -8
- package/example/node_modules/minimatch/dist/esm/escape.d.ts +0 -12
- package/example/node_modules/minimatch/dist/esm/index.d.ts +0 -94
- package/example/node_modules/minimatch/dist/esm/unescape.d.ts +0 -17
- package/example/node_modules/ora/index.d.ts +0 -257
- package/example/node_modules/ora/node_modules/chalk/types/index.d.ts +0 -97
- package/example/node_modules/ora/node_modules/strip-ansi/index.d.ts +0 -15
- package/example/node_modules/p-locate/index.d.ts +0 -53
- package/example/node_modules/path-exists/index.d.ts +0 -28
|
@@ -1,253 +0,0 @@
|
|
|
1
|
-
// A webview without babel to test faster.
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { AppState } from 'react-native';
|
|
4
|
-
|
|
5
|
-
import { getBaseURL } from './base';
|
|
6
|
-
import type { BridgeMessage, DOMProps, WebViewProps, WebViewRef } from './dom.types';
|
|
7
|
-
import { _emitGlobalEvent } from './global-events';
|
|
8
|
-
import {
|
|
9
|
-
getInjectBodySizeObserverScript,
|
|
10
|
-
getInjectEventScript,
|
|
11
|
-
MATCH_CONTENTS_EVENT,
|
|
12
|
-
NATIVE_ACTION,
|
|
13
|
-
NATIVE_ACTION_RESULT,
|
|
14
|
-
REGISTER_DOM_IMPERATIVE_HANDLE_PROPS,
|
|
15
|
-
} from './injection';
|
|
16
|
-
import ExpoDomWebView from './webview/ExpoDOMWebView';
|
|
17
|
-
import RNWebView from './webview/RNWebView';
|
|
18
|
-
import { useDebugZeroHeight } from './webview/useDebugZeroHeight';
|
|
19
|
-
|
|
20
|
-
type RawWebViewProps = React.ComponentProps<Exclude<typeof ExpoDomWebView, undefined>> &
|
|
21
|
-
React.ComponentProps<Exclude<typeof RNWebView, undefined>>;
|
|
22
|
-
|
|
23
|
-
interface Props {
|
|
24
|
-
children?: any;
|
|
25
|
-
dom?: DOMProps;
|
|
26
|
-
filePath: string;
|
|
27
|
-
ref: React.Ref<object>;
|
|
28
|
-
[propName: string]: unknown;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
const RawWebView = React.forwardRef<object, Props>((props, ref) => {
|
|
32
|
-
const { children, dom, filePath, ref: _ref, ...marshalProps } = props as Props;
|
|
33
|
-
if (__DEV__) {
|
|
34
|
-
if (children !== undefined) {
|
|
35
|
-
throw new Error(
|
|
36
|
-
`DOM components do not accept children. Found: ${children} | in component: ${filePath.split('?')[0]}`
|
|
37
|
-
);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
if (ref != null && typeof ref === 'object' && ref.current == null) {
|
|
42
|
-
ref.current = new Proxy(
|
|
43
|
-
{},
|
|
44
|
-
{
|
|
45
|
-
get(_, prop) {
|
|
46
|
-
const propName = String(prop) as keyof WebViewRef;
|
|
47
|
-
if (domImperativeHandlePropsRef.current?.includes(propName)) {
|
|
48
|
-
return function (...args: any[]) {
|
|
49
|
-
const serializedArgs = args.map((arg) => JSON.stringify(arg)).join(',');
|
|
50
|
-
webviewRef.current?.injectJavaScript(
|
|
51
|
-
`window._domRefProxy.${propName}(${serializedArgs})`
|
|
52
|
-
);
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
if (typeof webviewRef.current?.[propName] === 'function') {
|
|
56
|
-
return function (...args: any[]) {
|
|
57
|
-
return (webviewRef.current?.[propName] as any)(...args);
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
return undefined;
|
|
61
|
-
},
|
|
62
|
-
}
|
|
63
|
-
);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
const webView = resolveWebView(dom?.useExpoDOMWebView ?? false);
|
|
67
|
-
const webviewRef = React.useRef<WebViewRef>(null);
|
|
68
|
-
const domImperativeHandlePropsRef = React.useRef<string[]>([]);
|
|
69
|
-
const source = { uri: `${getBaseURL()}/${filePath}` };
|
|
70
|
-
const [containerStyle, setContainerStyle] = React.useState<WebViewProps['containerStyle']>(null);
|
|
71
|
-
|
|
72
|
-
const { debugZeroHeightStyle, debugOnLayout } = useDebugZeroHeight(dom);
|
|
73
|
-
|
|
74
|
-
const emit = React.useCallback(
|
|
75
|
-
(detail: BridgeMessage<any>) => {
|
|
76
|
-
webviewRef.current?.injectJavaScript(getInjectEventScript(detail));
|
|
77
|
-
},
|
|
78
|
-
[webviewRef]
|
|
79
|
-
);
|
|
80
|
-
|
|
81
|
-
// serializable props, action names.
|
|
82
|
-
|
|
83
|
-
const smartActions = Object.entries(marshalProps).reduce<{
|
|
84
|
-
props: Record<string, any>;
|
|
85
|
-
names: string[];
|
|
86
|
-
}>(
|
|
87
|
-
(acc, [key, value]) => {
|
|
88
|
-
if (value instanceof Function) {
|
|
89
|
-
acc.names.push(key);
|
|
90
|
-
} else {
|
|
91
|
-
// TODO: Recurse and assert that nested functions cannot be used.
|
|
92
|
-
acc.props[key] = value;
|
|
93
|
-
}
|
|
94
|
-
return acc;
|
|
95
|
-
},
|
|
96
|
-
{ names: [], props: {} }
|
|
97
|
-
);
|
|
98
|
-
|
|
99
|
-
// When the `marshalProps` change, emit them to the webview.
|
|
100
|
-
React.useEffect(() => {
|
|
101
|
-
emit({ type: '$$props', data: smartActions });
|
|
102
|
-
}, [emit, smartActions]);
|
|
103
|
-
|
|
104
|
-
return React.createElement(webView, {
|
|
105
|
-
webviewDebuggingEnabled: __DEV__,
|
|
106
|
-
// Make iOS scrolling feel native.
|
|
107
|
-
decelerationRate: process.env.EXPO_OS === 'ios' ? 'normal' : undefined,
|
|
108
|
-
// This is a better default for integrating with native navigation.
|
|
109
|
-
contentInsetAdjustmentBehavior: 'automatic',
|
|
110
|
-
// This is the default in ScrollView and upstream native.
|
|
111
|
-
automaticallyAdjustsScrollIndicatorInsets: true,
|
|
112
|
-
originWhitelist: ['*'],
|
|
113
|
-
allowFileAccess: true,
|
|
114
|
-
allowFileAccessFromFileURLs: true,
|
|
115
|
-
allowingReadAccessToURL: 'file://',
|
|
116
|
-
allowsAirPlayForMediaPlayback: true,
|
|
117
|
-
allowsFullscreenVideo: true,
|
|
118
|
-
onContentProcessDidTerminate: () => {
|
|
119
|
-
webviewRef.current?.reload();
|
|
120
|
-
},
|
|
121
|
-
onRenderProcessGone: () => {
|
|
122
|
-
// Simulate iOS `onContentProcessDidTerminate` behavior to reload when the app is in foreground or back to foreground.
|
|
123
|
-
if (AppState.currentState === 'active') {
|
|
124
|
-
webviewRef.current?.reload();
|
|
125
|
-
return;
|
|
126
|
-
}
|
|
127
|
-
const subscription = AppState.addEventListener('focus', () => {
|
|
128
|
-
webviewRef.current?.reload();
|
|
129
|
-
subscription.remove();
|
|
130
|
-
});
|
|
131
|
-
},
|
|
132
|
-
...dom,
|
|
133
|
-
containerStyle: [containerStyle, debugZeroHeightStyle, dom?.containerStyle],
|
|
134
|
-
onLayout: __DEV__ ? debugOnLayout : dom?.onLayout,
|
|
135
|
-
injectedJavaScriptBeforeContentLoaded: [
|
|
136
|
-
// On first mount, inject `$$EXPO_INITIAL_PROPS` with the initial props.
|
|
137
|
-
`window.$$EXPO_INITIAL_PROPS = ${JSON.stringify(smartActions)};true;`,
|
|
138
|
-
dom?.matchContents ? getInjectBodySizeObserverScript() : null,
|
|
139
|
-
dom?.injectedJavaScriptBeforeContentLoaded,
|
|
140
|
-
'true;',
|
|
141
|
-
]
|
|
142
|
-
.filter(Boolean)
|
|
143
|
-
.join('\n'),
|
|
144
|
-
// @ts-expect-error: TODO(@kitten): untyped ref for now
|
|
145
|
-
ref: webviewRef,
|
|
146
|
-
source,
|
|
147
|
-
style: [
|
|
148
|
-
dom?.style ? { flex: 1, backgroundColor: 'transparent' } : { backgroundColor: 'transparent' },
|
|
149
|
-
dom?.style,
|
|
150
|
-
],
|
|
151
|
-
onMessage: (event) => {
|
|
152
|
-
const { type, data } = JSON.parse(event.nativeEvent.data);
|
|
153
|
-
|
|
154
|
-
if (type === MATCH_CONTENTS_EVENT) {
|
|
155
|
-
if (dom?.matchContents) {
|
|
156
|
-
setContainerStyle({
|
|
157
|
-
width: data.width,
|
|
158
|
-
height: data.height,
|
|
159
|
-
});
|
|
160
|
-
}
|
|
161
|
-
return;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
if (type === REGISTER_DOM_IMPERATIVE_HANDLE_PROPS) {
|
|
165
|
-
domImperativeHandlePropsRef.current = data;
|
|
166
|
-
return;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
if (type === NATIVE_ACTION) {
|
|
170
|
-
const action = marshalProps[data.actionId];
|
|
171
|
-
if (action == null) {
|
|
172
|
-
throw new Error(`Native action "${data.actionId}" is not defined.`);
|
|
173
|
-
}
|
|
174
|
-
if (typeof action !== 'function' || !(action instanceof Function)) {
|
|
175
|
-
throw new Error(`Native action "${data.actionId}" is not a function.`);
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
const emitError = (error: any) => {
|
|
179
|
-
emit({
|
|
180
|
-
type: NATIVE_ACTION_RESULT,
|
|
181
|
-
data: {
|
|
182
|
-
uid: data.uid,
|
|
183
|
-
actionId: data.actionId,
|
|
184
|
-
error: serializeError(error),
|
|
185
|
-
},
|
|
186
|
-
});
|
|
187
|
-
};
|
|
188
|
-
const emitResolve = (result?: any) => {
|
|
189
|
-
// Send async results back to the DOM proxy for return values.
|
|
190
|
-
emit({
|
|
191
|
-
type: NATIVE_ACTION_RESULT,
|
|
192
|
-
data: {
|
|
193
|
-
uid: data.uid,
|
|
194
|
-
actionId: data.actionId,
|
|
195
|
-
result,
|
|
196
|
-
},
|
|
197
|
-
});
|
|
198
|
-
};
|
|
199
|
-
try {
|
|
200
|
-
const value = action(...data.args);
|
|
201
|
-
if (value instanceof Promise) {
|
|
202
|
-
return value
|
|
203
|
-
.then((result) => {
|
|
204
|
-
emitResolve(result);
|
|
205
|
-
})
|
|
206
|
-
.catch((error) => {
|
|
207
|
-
emitError(error);
|
|
208
|
-
});
|
|
209
|
-
} else {
|
|
210
|
-
// Send async results back to the webview proxy for return values.
|
|
211
|
-
return emitResolve(value);
|
|
212
|
-
}
|
|
213
|
-
} catch (error) {
|
|
214
|
-
return emitError(error);
|
|
215
|
-
}
|
|
216
|
-
} else {
|
|
217
|
-
// @ts-expect-error: TODO(@kitten): The two types for this event will never match up, but we know they do
|
|
218
|
-
dom?.onMessage?.(event);
|
|
219
|
-
}
|
|
220
|
-
_emitGlobalEvent({ type, data });
|
|
221
|
-
},
|
|
222
|
-
});
|
|
223
|
-
});
|
|
224
|
-
|
|
225
|
-
if (__DEV__) {
|
|
226
|
-
RawWebView.displayName = 'DOM';
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
function serializeError(error: any) {
|
|
230
|
-
if (error instanceof Error) {
|
|
231
|
-
return {
|
|
232
|
-
message: error.message,
|
|
233
|
-
stack: error.stack,
|
|
234
|
-
// TODO: Other props...
|
|
235
|
-
};
|
|
236
|
-
}
|
|
237
|
-
return error;
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
export function resolveWebView(
|
|
241
|
-
useExpoDOMWebView: boolean
|
|
242
|
-
): React.ForwardRefExoticComponent<RawWebViewProps> {
|
|
243
|
-
const webView = useExpoDOMWebView ? ExpoDomWebView : RNWebView;
|
|
244
|
-
if (webView == null) {
|
|
245
|
-
const moduleName = useExpoDOMWebView ? '@expo/dom-webview' : 'react-native-webview';
|
|
246
|
-
throw new Error(
|
|
247
|
-
`Unable to resolve the '${moduleName}' module. Make sure to install it with 'npx expo install ${moduleName}'.`
|
|
248
|
-
);
|
|
249
|
-
}
|
|
250
|
-
return webView as React.ForwardRefExoticComponent<RawWebViewProps>;
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
export default RawWebView;
|
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
// Prevent pulling in all of expo-modules-core on web
|
|
2
|
-
import { LegacyEventEmitter } from 'expo-modules-core/src/LegacyEventEmitter';
|
|
3
|
-
import React, { useEffect, useState, useRef, useMemo } from 'react';
|
|
4
|
-
import { Animated, StyleSheet, Text, View } from 'react-native';
|
|
5
|
-
|
|
6
|
-
import DevLoadingViewNativeModule from './DevLoadingViewNativeModule';
|
|
7
|
-
import { getInitialSafeArea } from './getInitialSafeArea';
|
|
8
|
-
|
|
9
|
-
export default function DevLoadingView() {
|
|
10
|
-
const [message, setMessage] = useState('Refreshing...');
|
|
11
|
-
const [isDevLoading, setIsDevLoading] = useState(false);
|
|
12
|
-
const [isAnimating, setIsAnimating] = useState(false);
|
|
13
|
-
const translateY = useRef(new Animated.Value(0)).current;
|
|
14
|
-
const emitter = useMemo<LegacyEventEmitter>(() => {
|
|
15
|
-
try {
|
|
16
|
-
return new LegacyEventEmitter(DevLoadingViewNativeModule);
|
|
17
|
-
} catch (error: any) {
|
|
18
|
-
throw new Error(
|
|
19
|
-
'Failed to instantiate native emitter in `DevLoadingView` because the native module `DevLoadingView` is undefined: ' +
|
|
20
|
-
error.message
|
|
21
|
-
);
|
|
22
|
-
}
|
|
23
|
-
}, []);
|
|
24
|
-
|
|
25
|
-
useEffect(() => {
|
|
26
|
-
if (!emitter) return;
|
|
27
|
-
|
|
28
|
-
function handleShowMessage(event: { message: string }) {
|
|
29
|
-
setMessage(event.message);
|
|
30
|
-
// TODO: if we show the refreshing banner and don't get a hide message
|
|
31
|
-
// for 3 seconds, warn the user that it's taking a while and suggest
|
|
32
|
-
// they reload
|
|
33
|
-
|
|
34
|
-
translateY.setValue(0);
|
|
35
|
-
setIsDevLoading(true);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
function handleHide() {
|
|
39
|
-
// TODO: if we showed the 'refreshing' banner less than 250ms ago, delay
|
|
40
|
-
// switching to the 'finished' banner
|
|
41
|
-
|
|
42
|
-
setIsAnimating(true);
|
|
43
|
-
setIsDevLoading(false);
|
|
44
|
-
Animated.timing(translateY, {
|
|
45
|
-
toValue: 150,
|
|
46
|
-
delay: 1000,
|
|
47
|
-
duration: 350,
|
|
48
|
-
useNativeDriver: true,
|
|
49
|
-
}).start(({ finished }) => {
|
|
50
|
-
if (finished) {
|
|
51
|
-
setIsAnimating(false);
|
|
52
|
-
translateY.setValue(0);
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
const showMessageSubscription = emitter.addListener(
|
|
58
|
-
'devLoadingView:showMessage',
|
|
59
|
-
handleShowMessage
|
|
60
|
-
);
|
|
61
|
-
const hideSubscription = emitter.addListener('devLoadingView:hide', handleHide);
|
|
62
|
-
|
|
63
|
-
return function cleanup() {
|
|
64
|
-
showMessageSubscription.remove();
|
|
65
|
-
hideSubscription.remove();
|
|
66
|
-
};
|
|
67
|
-
}, [translateY, emitter]);
|
|
68
|
-
|
|
69
|
-
if (!isDevLoading && !isAnimating) {
|
|
70
|
-
return null;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
return (
|
|
74
|
-
<Animated.View style={[styles.animatedContainer, { transform: [{ translateY }] }]}>
|
|
75
|
-
<View style={styles.banner}>
|
|
76
|
-
<View style={styles.contentContainer}>
|
|
77
|
-
<View style={{ flexDirection: 'row' }}>
|
|
78
|
-
<Text style={styles.text}>{message}</Text>
|
|
79
|
-
</View>
|
|
80
|
-
|
|
81
|
-
<View style={{ flex: 1 }}>
|
|
82
|
-
<Text style={styles.subtitle}>
|
|
83
|
-
{isDevLoading ? 'Using Fast Refresh' : "Don't see your changes? Reload the app"}
|
|
84
|
-
</Text>
|
|
85
|
-
</View>
|
|
86
|
-
</View>
|
|
87
|
-
</View>
|
|
88
|
-
</Animated.View>
|
|
89
|
-
);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
const styles = StyleSheet.create({
|
|
93
|
-
animatedContainer: {
|
|
94
|
-
position: 'absolute',
|
|
95
|
-
pointerEvents: 'none',
|
|
96
|
-
bottom: 0,
|
|
97
|
-
left: 0,
|
|
98
|
-
right: 0,
|
|
99
|
-
zIndex: 42, // arbitrary
|
|
100
|
-
},
|
|
101
|
-
|
|
102
|
-
banner: {
|
|
103
|
-
flex: 1,
|
|
104
|
-
overflow: 'visible',
|
|
105
|
-
backgroundColor: 'rgba(0,0,0,0.75)',
|
|
106
|
-
paddingBottom: getInitialSafeArea().bottom,
|
|
107
|
-
},
|
|
108
|
-
contentContainer: {
|
|
109
|
-
flex: 1,
|
|
110
|
-
paddingTop: 10,
|
|
111
|
-
paddingBottom: 5,
|
|
112
|
-
alignItems: 'center',
|
|
113
|
-
justifyContent: 'center',
|
|
114
|
-
textAlign: 'center',
|
|
115
|
-
},
|
|
116
|
-
text: {
|
|
117
|
-
color: '#fff',
|
|
118
|
-
fontSize: 15,
|
|
119
|
-
},
|
|
120
|
-
subtitle: {
|
|
121
|
-
color: 'rgba(255,255,255,0.8)',
|
|
122
|
-
},
|
|
123
|
-
});
|
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
|
2
|
-
import { NativeEventEmitter } from 'react-native';
|
|
3
|
-
|
|
4
|
-
const MIN_DURATION = 400;
|
|
5
|
-
const ANIMATION_DURATION = 150;
|
|
6
|
-
|
|
7
|
-
const emitter = new NativeEventEmitter({
|
|
8
|
-
addListener() {},
|
|
9
|
-
removeListeners() {},
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
export default function DevLoadingView() {
|
|
13
|
-
const show = useFastRefresh();
|
|
14
|
-
|
|
15
|
-
const timer = useRef<ReturnType<typeof setTimeout> | null>(null);
|
|
16
|
-
|
|
17
|
-
const toast = useMemo(
|
|
18
|
-
() => (
|
|
19
|
-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" width={24} height={24}>
|
|
20
|
-
<path
|
|
21
|
-
fill="#ECEDEE"
|
|
22
|
-
d="M36.764 1.716a1.477 1.477 0 0 0-2.325-.268L11.721 24.609c-1.464 1.493-.438 4.064 1.623 4.064h4.484a1 1 0 0 1 .889 1.46l-7.54 14.591a1.588 1.588 0 0 0 .059 1.56 1.477 1.477 0 0 0 2.325.268l22.718-23.161c1.464-1.493.438-4.064-1.623-4.064H28.53l8.295-16.051a1.588 1.588 0 0 0-.06-1.56Z"
|
|
23
|
-
/>
|
|
24
|
-
</svg>
|
|
25
|
-
),
|
|
26
|
-
[]
|
|
27
|
-
);
|
|
28
|
-
const style = useMemo(
|
|
29
|
-
() => (
|
|
30
|
-
<style
|
|
31
|
-
dangerouslySetInnerHTML={{
|
|
32
|
-
__html: `
|
|
33
|
-
.__expo_fast_refresh {
|
|
34
|
-
position: fixed;
|
|
35
|
-
pointer-events: none;
|
|
36
|
-
bottom: 8px;
|
|
37
|
-
left: 8px;
|
|
38
|
-
z-index: 9999;
|
|
39
|
-
display: flex;
|
|
40
|
-
background-color: #1B1D1E;
|
|
41
|
-
border: 1px solid #4D5155;
|
|
42
|
-
padding: 8px;
|
|
43
|
-
border-radius: 8px;
|
|
44
|
-
transition: all ${ANIMATION_DURATION}ms;
|
|
45
|
-
opacity: 0;
|
|
46
|
-
filter: blur(4px);
|
|
47
|
-
transform: translateY(20%);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
.__expo_fast_refresh_show { opacity: 1; filter: blur(0); transform: scale(1); }
|
|
51
|
-
`,
|
|
52
|
-
}}
|
|
53
|
-
/>
|
|
54
|
-
),
|
|
55
|
-
[]
|
|
56
|
-
);
|
|
57
|
-
|
|
58
|
-
const [isAnimating, setIsAnimating] = useState(false);
|
|
59
|
-
const [animationClass, setAnimationClass] = useState('');
|
|
60
|
-
|
|
61
|
-
const refreshIndicator = useMemo(
|
|
62
|
-
() => (
|
|
63
|
-
<>
|
|
64
|
-
{style}
|
|
65
|
-
|
|
66
|
-
<div className={'__expo_fast_refresh ' + animationClass}>{toast}</div>
|
|
67
|
-
</>
|
|
68
|
-
),
|
|
69
|
-
[animationClass, style, toast]
|
|
70
|
-
);
|
|
71
|
-
|
|
72
|
-
useEffect(() => {
|
|
73
|
-
timer.current && clearTimeout(timer.current);
|
|
74
|
-
|
|
75
|
-
if (show) {
|
|
76
|
-
setAnimationClass('__expo_fast_refresh_show');
|
|
77
|
-
} else {
|
|
78
|
-
setIsAnimating(true);
|
|
79
|
-
setAnimationClass('');
|
|
80
|
-
timer.current = setTimeout(() => {
|
|
81
|
-
setIsAnimating(false);
|
|
82
|
-
}, MIN_DURATION - ANIMATION_DURATION);
|
|
83
|
-
}
|
|
84
|
-
return () => {
|
|
85
|
-
timer.current && clearTimeout(timer.current);
|
|
86
|
-
};
|
|
87
|
-
}, [show]);
|
|
88
|
-
|
|
89
|
-
if (!isAnimating && !show) {
|
|
90
|
-
return null;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
return <>{refreshIndicator}</>;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
function useFastRefresh() {
|
|
97
|
-
const [isShown, setShown] = useState(false);
|
|
98
|
-
const duration = useRef<number | null>(null);
|
|
99
|
-
const timeout = useRef<ReturnType<typeof setTimeout> | null>(null);
|
|
100
|
-
|
|
101
|
-
useEffect(() => {
|
|
102
|
-
function handleShowMessage() {
|
|
103
|
-
setShown(true);
|
|
104
|
-
duration.current = Date.now();
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
function handleHide() {
|
|
108
|
-
// Bail out if the timeout is already set
|
|
109
|
-
if (timeout.current) {
|
|
110
|
-
return;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
const timeVisible = duration.current ? Date.now() - duration.current : 0;
|
|
114
|
-
|
|
115
|
-
const min = Math.max(0, MIN_DURATION - timeVisible);
|
|
116
|
-
|
|
117
|
-
timeout.current = setTimeout(() => {
|
|
118
|
-
timeout.current = null;
|
|
119
|
-
setShown(false);
|
|
120
|
-
}, min);
|
|
121
|
-
}
|
|
122
|
-
const show = emitter.addListener('devLoadingView:showMessage', handleShowMessage);
|
|
123
|
-
const hide = emitter.addListener('devLoadingView:hide', handleHide);
|
|
124
|
-
return () => {
|
|
125
|
-
if (timeout.current) {
|
|
126
|
-
clearTimeout(timeout.current);
|
|
127
|
-
timeout.current = null;
|
|
128
|
-
}
|
|
129
|
-
show.remove();
|
|
130
|
-
hide.remove();
|
|
131
|
-
};
|
|
132
|
-
}, [emitter]);
|
|
133
|
-
|
|
134
|
-
return isShown;
|
|
135
|
-
}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { requireNativeModule } from 'expo-modules-core';
|
|
2
|
-
|
|
3
|
-
type ExpoGoModule = {
|
|
4
|
-
expoVersion: string;
|
|
5
|
-
projectConfig: ExpoGoProjectConfig;
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
type ExpoGoProjectConfig = {
|
|
9
|
-
mainModuleName?: string;
|
|
10
|
-
debuggerHost?: string;
|
|
11
|
-
logUrl?: string;
|
|
12
|
-
developer?: {
|
|
13
|
-
tool?: string;
|
|
14
|
-
[key: string]: any;
|
|
15
|
-
};
|
|
16
|
-
packagerOpts?: ExpoGoPackagerOpts;
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
export type ExpoGoPackagerOpts = {
|
|
20
|
-
hostType?: string;
|
|
21
|
-
dev?: boolean;
|
|
22
|
-
strict?: boolean;
|
|
23
|
-
minify?: boolean;
|
|
24
|
-
urlType?: string;
|
|
25
|
-
urlRandomness?: string;
|
|
26
|
-
lanType?: string;
|
|
27
|
-
[key: string]: any;
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
// ExpoGo module is available only when the app is run in Expo Go,
|
|
31
|
-
// otherwise we use `null` instead of throwing an error.
|
|
32
|
-
const NativeExpoGoModule = ((): ExpoGoModule | null => {
|
|
33
|
-
try {
|
|
34
|
-
return requireNativeModule('ExpoGo');
|
|
35
|
-
} catch {
|
|
36
|
-
return null;
|
|
37
|
-
}
|
|
38
|
-
})();
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Returns a boolean value whether the app is running in Expo Go.
|
|
42
|
-
*/
|
|
43
|
-
export function isRunningInExpoGo(): boolean {
|
|
44
|
-
return NativeExpoGoModule != null;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* @hidden
|
|
49
|
-
* Returns an Expo Go project config from the manifest or `null` if the app is not running in Expo Go.
|
|
50
|
-
*/
|
|
51
|
-
export function getExpoGoProjectConfig(): ExpoGoProjectConfig | null {
|
|
52
|
-
return NativeExpoGoModule?.projectConfig ?? null;
|
|
53
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { TurboModuleRegistry } from 'react-native';
|
|
2
|
-
|
|
3
|
-
const DEFAULT_SAFE_AREA = { top: 0, bottom: 0, left: 0, right: 0 };
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Get the best estimate safe area before native modules have fully loaded.
|
|
7
|
-
* This is a hack to get the safe area insets without explicitly depending on react-native-safe-area-context.
|
|
8
|
-
*/
|
|
9
|
-
export function getInitialSafeArea(): { top: number; bottom: number; left: number; right: number } {
|
|
10
|
-
const RNCSafeAreaContext = TurboModuleRegistry.get('RNCSafeAreaContext');
|
|
11
|
-
|
|
12
|
-
// @ts-ignore: we're not using the spec so the return type of getConstants() is {}
|
|
13
|
-
const initialWindowMetrics = RNCSafeAreaContext?.getConstants()?.initialWindowMetrics;
|
|
14
|
-
|
|
15
|
-
return initialWindowMetrics?.insets ?? DEFAULT_SAFE_AREA;
|
|
16
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { StyleSheet, Text, View } from 'react-native';
|
|
2
|
-
|
|
3
|
-
export function AppEntryNotFound() {
|
|
4
|
-
return (
|
|
5
|
-
<View style={styles.container}>
|
|
6
|
-
<Text style={styles.errorTitle}>App entry not found</Text>
|
|
7
|
-
<Text style={styles.errorDescription}>
|
|
8
|
-
The app entry point named "main" was not registered. This may be due to an uncaught error
|
|
9
|
-
thrown from a module's top-level code. Refer to the CLI logs and the native device logs for
|
|
10
|
-
more detail.
|
|
11
|
-
</Text>
|
|
12
|
-
</View>
|
|
13
|
-
);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
const styles = StyleSheet.create({
|
|
17
|
-
container: {
|
|
18
|
-
flex: 1,
|
|
19
|
-
justifyContent: 'center',
|
|
20
|
-
padding: 20,
|
|
21
|
-
backgroundColor: '#f2f2f2',
|
|
22
|
-
},
|
|
23
|
-
errorTitle: {
|
|
24
|
-
fontSize: 24,
|
|
25
|
-
fontWeight: 'bold',
|
|
26
|
-
color: '#d32f2f',
|
|
27
|
-
textAlign: 'center',
|
|
28
|
-
marginBottom: 24,
|
|
29
|
-
},
|
|
30
|
-
errorDescription: {
|
|
31
|
-
fontSize: 16,
|
|
32
|
-
color: '#333',
|
|
33
|
-
textAlign: 'center',
|
|
34
|
-
},
|
|
35
|
-
});
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import type { ErrorHandlerCallback } from 'react-native';
|
|
2
|
-
|
|
3
|
-
// Similar interface to the one used in expo modules.
|
|
4
|
-
type CodedError = Error & { code?: string };
|
|
5
|
-
|
|
6
|
-
let isErrorHandlingEnabled = true;
|
|
7
|
-
|
|
8
|
-
const developmentBuildMessage = `If you're trying to use a module that is not supported in Expo Go, you need to create a development build of your app. See https://docs.expo.dev/development/introduction/ for more info.`;
|
|
9
|
-
|
|
10
|
-
function customizeUnavailableMessage(error: CodedError) {
|
|
11
|
-
error.message += '\n\n' + developmentBuildMessage;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
function customizeModuleIsMissingMessage(error: Error) {
|
|
15
|
-
error.message = `Your JavaScript code tried to access a native module that doesn't exist.
|
|
16
|
-
|
|
17
|
-
${developmentBuildMessage}`;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
function customizeError(error: Error | CodedError) {
|
|
21
|
-
if ('code' in error && error.code === 'ERR_UNAVAILABLE') {
|
|
22
|
-
customizeUnavailableMessage(error);
|
|
23
|
-
} else if (
|
|
24
|
-
error.message.includes('Native module cannot be null') || // RN 0.64 and below message
|
|
25
|
-
error.message.includes('`new NativeEventEmitter()` requires a non-null argument.') // RN 0.65+ message
|
|
26
|
-
) {
|
|
27
|
-
customizeModuleIsMissingMessage(error);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
function errorHandler(originalHandler: ErrorHandlerCallback, error: any, isFatal?: boolean): void {
|
|
32
|
-
if (error instanceof Error) {
|
|
33
|
-
customizeError(error);
|
|
34
|
-
}
|
|
35
|
-
originalHandler(error, isFatal);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export function createErrorHandler(originalHandler: ErrorHandlerCallback): ErrorHandlerCallback {
|
|
39
|
-
return (error, isFatal) => {
|
|
40
|
-
if (isErrorHandlingEnabled) {
|
|
41
|
-
errorHandler(originalHandler, error, isFatal);
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
originalHandler(error, isFatal);
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export function disableErrorHandling() {
|
|
50
|
-
isErrorHandlingEnabled = false;
|
|
51
|
-
}
|