expo 47.0.0-beta.8 → 47.0.0
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/android/build.gradle +2 -2
- package/build/Expo.d.ts +0 -1
- package/build/Expo.d.ts.map +1 -1
- package/build/Expo.fx.js +1 -13
- package/build/Expo.fx.js.map +1 -1
- package/build/Expo.js +0 -1
- package/build/Expo.js.map +1 -1
- package/bundledNativeModules.json +4 -4
- package/package.json +3 -4
- package/build/proxies/NativeModules.d.ts +0 -19
- package/build/proxies/NativeModules.d.ts.map +0 -1
- package/build/proxies/NativeModules.js +0 -110
- package/build/proxies/NativeModules.js.map +0 -1
- package/disable-missing-native-module-errors.js +0 -6
package/android/build.gradle
CHANGED
|
@@ -34,7 +34,7 @@ def getRNVersion() {
|
|
|
34
34
|
ensureDependeciesWereEvaluated(project)
|
|
35
35
|
|
|
36
36
|
group = 'host.exp.exponent'
|
|
37
|
-
version = '47.0.0
|
|
37
|
+
version = '47.0.0'
|
|
38
38
|
|
|
39
39
|
buildscript {
|
|
40
40
|
def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
|
|
@@ -105,7 +105,7 @@ android {
|
|
|
105
105
|
minSdkVersion safeExtGet("minSdkVersion", 21)
|
|
106
106
|
targetSdkVersion safeExtGet("targetSdkVersion", 31)
|
|
107
107
|
versionCode 1
|
|
108
|
-
versionName "47.0.0
|
|
108
|
+
versionName "47.0.0"
|
|
109
109
|
consumerProguardFiles("proguard-rules.pro")
|
|
110
110
|
}
|
|
111
111
|
lintOptions {
|
package/build/Expo.d.ts
CHANGED
|
@@ -2,6 +2,5 @@ import './Expo.fx';
|
|
|
2
2
|
import * as Logs from './logs/Logs';
|
|
3
3
|
export { Logs };
|
|
4
4
|
export { disableErrorHandling } from './errors/ExpoErrorManager';
|
|
5
|
-
export { getNativeModuleIfExists } from './proxies/NativeModules';
|
|
6
5
|
export { default as registerRootComponent } from './launch/registerRootComponent';
|
|
7
6
|
//# sourceMappingURL=Expo.d.ts.map
|
package/build/Expo.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Expo.d.ts","sourceRoot":"","sources":["../src/Expo.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,CAAC;AAEnB,OAAO,KAAK,IAAI,MAAM,aAAa,CAAC;AAEpC,OAAO,EAAE,IAAI,EAAE,CAAC;AAChB,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"Expo.d.ts","sourceRoot":"","sources":["../src/Expo.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,CAAC;AAEnB,OAAO,KAAK,IAAI,MAAM,aAAa,CAAC;AAEpC,OAAO,EAAE,IAAI,EAAE,CAAC;AAChB,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,gCAAgC,CAAC"}
|
package/build/Expo.fx.js
CHANGED
|
@@ -6,9 +6,8 @@ import 'expo-asset';
|
|
|
6
6
|
import Constants, { ExecutionEnvironment } from 'expo-constants';
|
|
7
7
|
import * as Font from 'expo-font';
|
|
8
8
|
import { NativeModulesProxy, Platform } from 'expo-modules-core';
|
|
9
|
-
import
|
|
9
|
+
import { StyleSheet } from 'react-native';
|
|
10
10
|
import { createErrorHandler } from './errors/ExpoErrorManager';
|
|
11
|
-
import { createProxyForNativeModules } from './proxies/NativeModules';
|
|
12
11
|
// If expo-font is installed and the style preprocessor is available, use it to parse fonts.
|
|
13
12
|
if (StyleSheet.setStyleAttributePreprocessor) {
|
|
14
13
|
StyleSheet.setStyleAttributePreprocessor('fontFamily', Font.processFontFamily);
|
|
@@ -31,15 +30,4 @@ if (Constants.executionEnvironment === ExecutionEnvironment.StoreClient) {
|
|
|
31
30
|
const globalHandler = ErrorUtils.getGlobalHandler();
|
|
32
31
|
ErrorUtils.setGlobalHandler(createErrorHandler(globalHandler));
|
|
33
32
|
}
|
|
34
|
-
// Having two if statements will enable terser to remove the entire block.
|
|
35
|
-
if (__DEV__) {
|
|
36
|
-
const proxiedNativeModules = createProxyForNativeModules(ReactNative.NativeModules);
|
|
37
|
-
Object.defineProperty(ReactNative, 'NativeModules', {
|
|
38
|
-
get() {
|
|
39
|
-
return proxiedNativeModules;
|
|
40
|
-
},
|
|
41
|
-
configurable: true,
|
|
42
|
-
enumerable: true,
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
33
|
//# sourceMappingURL=Expo.fx.js.map
|
package/build/Expo.fx.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Expo.fx.js","sourceRoot":"","sources":["../src/Expo.fx.tsx"],"names":[],"mappings":"AAAA,OAAO,2BAA2B,CAAC;AACnC,wEAAwE;AACxE,OAAO,0BAA0B,CAAC;AAClC,mFAAmF;AACnF,OAAO,YAAY,CAAC;AAEpB,OAAO,SAAS,EAAE,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACjE,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,kBAAkB,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACjE,OAAO,
|
|
1
|
+
{"version":3,"file":"Expo.fx.js","sourceRoot":"","sources":["../src/Expo.fx.tsx"],"names":[],"mappings":"AAAA,OAAO,2BAA2B,CAAC;AACnC,wEAAwE;AACxE,OAAO,0BAA0B,CAAC;AAClC,mFAAmF;AACnF,OAAO,YAAY,CAAC;AAEpB,OAAO,SAAS,EAAE,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACjE,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,kBAAkB,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACjE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAE/D,4FAA4F;AAC5F,IAAI,UAAU,CAAC,6BAA6B,EAAE;IAC5C,UAAU,CAAC,6BAA6B,CAAC,YAAY,EAAE,IAAI,CAAC,iBAAiB,CAAC,CAAC;CAChF;AAED,kDAAkD;AAClD,IAAI,kBAAkB,CAAC,WAAW,EAAE,uBAAuB,EAAE;IAC3D,MAAM,OAAO,GACX,+EAA+E;QAC/E,0DAA0D;QAC1D,QAAQ,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,EAAE,qBAAqB,EAAE,CAAC;QACtE,yCAAyC,CAAC;IAC5C,IAAI,OAAO,EAAE;QACX,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;KACvB;SAAM;QACL,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;KAC1B;CACF;AAED,IAAI,SAAS,CAAC,oBAAoB,KAAK,oBAAoB,CAAC,WAAW,EAAE;IACvE,wFAAwF;IACxF,MAAM,aAAa,GAAG,UAAU,CAAC,gBAAgB,EAAE,CAAC;IACpD,UAAU,CAAC,gBAAgB,CAAC,kBAAkB,CAAC,aAAa,CAAC,CAAC,CAAC;CAChE","sourcesContent":["import './environment/validate.fx';\n// load remote logging for compatibility with custom development clients\nimport './environment/logging.fx';\n// load expo-asset immediately to set a custom `source` transformer in React Native\nimport 'expo-asset';\n\nimport Constants, { ExecutionEnvironment } from 'expo-constants';\nimport * as Font from 'expo-font';\nimport { NativeModulesProxy, Platform } from 'expo-modules-core';\nimport { StyleSheet } from 'react-native';\n\nimport { createErrorHandler } from './errors/ExpoErrorManager';\n\n// If expo-font is installed and the style preprocessor is available, use it to parse fonts.\nif (StyleSheet.setStyleAttributePreprocessor) {\n StyleSheet.setStyleAttributePreprocessor('fontFamily', Font.processFontFamily);\n}\n\n// Asserts if bare workflow isn't setup correctly.\nif (NativeModulesProxy.ExpoUpdates?.isMissingRuntimeVersion) {\n const message =\n 'expo-updates is installed but there is no runtime or SDK version configured. ' +\n \"You'll need to configure one of these two properties in \" +\n Platform.select({ ios: 'Expo.plist', android: 'AndroidManifest.xml' }) +\n ' before OTA updates will work properly.';\n if (__DEV__) {\n console.warn(message);\n } else {\n throw new Error(message);\n }\n}\n\nif (Constants.executionEnvironment === ExecutionEnvironment.StoreClient) {\n // set up some improvements to commonly logged error messages stemming from react-native\n const globalHandler = ErrorUtils.getGlobalHandler();\n ErrorUtils.setGlobalHandler(createErrorHandler(globalHandler));\n}\n"]}
|
package/build/Expo.js
CHANGED
|
@@ -2,6 +2,5 @@ import './Expo.fx';
|
|
|
2
2
|
import * as Logs from './logs/Logs';
|
|
3
3
|
export { Logs };
|
|
4
4
|
export { disableErrorHandling } from './errors/ExpoErrorManager';
|
|
5
|
-
export { getNativeModuleIfExists } from './proxies/NativeModules';
|
|
6
5
|
export { default as registerRootComponent } from './launch/registerRootComponent';
|
|
7
6
|
//# sourceMappingURL=Expo.js.map
|
package/build/Expo.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Expo.js","sourceRoot":"","sources":["../src/Expo.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,CAAC;AAEnB,OAAO,KAAK,IAAI,MAAM,aAAa,CAAC;AAEpC,OAAO,EAAE,IAAI,EAAE,CAAC;AAChB,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"Expo.js","sourceRoot":"","sources":["../src/Expo.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,CAAC;AAEnB,OAAO,KAAK,IAAI,MAAM,aAAa,CAAC;AAEpC,OAAO,EAAE,IAAI,EAAE,CAAC;AAChB,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,gCAAgC,CAAC","sourcesContent":["import './Expo.fx';\n\nimport * as Logs from './logs/Logs';\n\nexport { Logs };\nexport { disableErrorHandling } from './errors/ExpoErrorManager';\nexport { default as registerRootComponent } from './launch/registerRootComponent';\n"]}
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"expo-font": "~11.0.1",
|
|
45
45
|
"expo-gl": "~12.0.0",
|
|
46
46
|
"expo-google-app-auth": "~8.3.0",
|
|
47
|
-
"expo-haptics": "~12.0.
|
|
47
|
+
"expo-haptics": "~12.0.1",
|
|
48
48
|
"expo-image-loader": "~4.0.0",
|
|
49
49
|
"expo-image-manipulator": "~11.0.0",
|
|
50
50
|
"expo-image-picker": "~14.0.0",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"expo-location": "~15.0.1",
|
|
59
59
|
"expo-mail-composer": "~12.0.0",
|
|
60
60
|
"expo-media-library": "~15.0.0",
|
|
61
|
-
"expo-module-template": "~10.7.
|
|
61
|
+
"expo-module-template": "~10.7.8",
|
|
62
62
|
"expo-modules-core": "~0.13.4",
|
|
63
63
|
"expo-navigation-bar": "~2.0.1",
|
|
64
64
|
"expo-network": "~5.0.0",
|
|
@@ -80,12 +80,12 @@
|
|
|
80
80
|
"expo-system-ui": "~2.0.1",
|
|
81
81
|
"expo-task-manager": "~11.0.1",
|
|
82
82
|
"expo-tracking-transparency": "~3.0.1",
|
|
83
|
-
"expo-updates": "~0.15.
|
|
83
|
+
"expo-updates": "~0.15.4",
|
|
84
84
|
"expo-video-thumbnails": "~7.0.0",
|
|
85
85
|
"expo-web-browser": "~12.0.0",
|
|
86
86
|
"lottie-react-native": "5.1.4",
|
|
87
87
|
"react": "18.1.0",
|
|
88
|
-
"react-dom": "18.
|
|
88
|
+
"react-dom": "18.1.0",
|
|
89
89
|
"react-native": "0.70.4",
|
|
90
90
|
"react-native-web": "~0.18.9",
|
|
91
91
|
"react-native-branch": "^5.4.0",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo",
|
|
3
|
-
"version": "47.0.0
|
|
3
|
+
"version": "47.0.0",
|
|
4
4
|
"description": "The Expo SDK",
|
|
5
5
|
"main": "build/Expo.js",
|
|
6
6
|
"module": "build/Expo.js",
|
|
@@ -22,7 +22,6 @@
|
|
|
22
22
|
"AppEntry.js",
|
|
23
23
|
"Expo.podspec",
|
|
24
24
|
"bundledNativeModules.json",
|
|
25
|
-
"disable-missing-native-module-errors.js",
|
|
26
25
|
"expo-module.config.json",
|
|
27
26
|
"metro-config.js",
|
|
28
27
|
"config.js",
|
|
@@ -64,7 +63,7 @@
|
|
|
64
63
|
"@expo/vector-icons": "^13.0.0",
|
|
65
64
|
"@expo/config-plugins": "5.0.4",
|
|
66
65
|
"@expo/config": "7.0.3",
|
|
67
|
-
"babel-preset-expo": "~9.2.
|
|
66
|
+
"babel-preset-expo": "~9.2.2",
|
|
68
67
|
"cross-spawn": "^6.0.5",
|
|
69
68
|
"expo-application": "~5.0.1",
|
|
70
69
|
"expo-asset": "~8.6.2",
|
|
@@ -97,5 +96,5 @@
|
|
|
97
96
|
"react-dom": "18.0.0",
|
|
98
97
|
"react-native": "0.70.4"
|
|
99
98
|
},
|
|
100
|
-
"gitHead": "
|
|
99
|
+
"gitHead": "7bd5b06647741fc25c84c77136819ab884c8479b"
|
|
101
100
|
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
export declare function createProxyForNativeModules(NativeModules: any): any;
|
|
2
|
-
/**
|
|
3
|
-
* Disable the error thrown when trying to access a native module that doesn't exist in the host
|
|
4
|
-
* runtime. If a module name or array of module names is provided, this method disables the error
|
|
5
|
-
* for only those modules, erasing a previous setting if one exists. If no parameter is provided,
|
|
6
|
-
* this method disables the error for all modules.
|
|
7
|
-
*
|
|
8
|
-
* @param moduleNames Name of module or modules for which to disable the missing native module
|
|
9
|
-
* error. If this parameter is omitted, the error will be disabled globally.
|
|
10
|
-
*/
|
|
11
|
-
export declare function disableMissingNativeModuleErrors(moduleNames?: string[] | string): void;
|
|
12
|
-
/**
|
|
13
|
-
* Access a native module without throwing an error if it doesn't exist.
|
|
14
|
-
*
|
|
15
|
-
* @param moduleName Name of module to access
|
|
16
|
-
* @returns Corresponding native module object, or null if it doesn't exist
|
|
17
|
-
*/
|
|
18
|
-
export declare function getNativeModuleIfExists(moduleName: string): any;
|
|
19
|
-
//# sourceMappingURL=NativeModules.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"NativeModules.d.ts","sourceRoot":"","sources":["../../src/proxies/NativeModules.ts"],"names":[],"mappings":"AA0DA,wBAAgB,2BAA2B,CAAC,aAAa,EAAE,GAAG,OA+B7D;AAED;;;;;;;;GAQG;AACH,wBAAgB,gCAAgC,CAAC,WAAW,CAAC,EAAE,MAAM,EAAE,GAAG,MAAM,QAQ/E;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,UAAU,EAAE,MAAM,GAAG,GAAG,CAE/D"}
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
import { ExecutionEnvironment } from 'expo-constants';
|
|
2
|
-
import { NativeModules } from 'react-native';
|
|
3
|
-
const originalNativeModules = NativeModules;
|
|
4
|
-
const PROPS_TO_IGNORE = new Set([
|
|
5
|
-
/**
|
|
6
|
-
* We don't want to throw when the expo or expo-modules-core packages try to access any of these
|
|
7
|
-
* modules, since they have built-in fallbacks.
|
|
8
|
-
*/
|
|
9
|
-
'DevLoadingView',
|
|
10
|
-
'EXDevLauncher',
|
|
11
|
-
'EXReactNativeEventEmitter',
|
|
12
|
-
'NativeUnimoduleProxy',
|
|
13
|
-
/**
|
|
14
|
-
* Other modules that are accessed via packages in the Expo SDK but have built-in fallbacks
|
|
15
|
-
*/
|
|
16
|
-
'ExpoImageModule',
|
|
17
|
-
'ExpoRandom',
|
|
18
|
-
'PlatformLocalStorage',
|
|
19
|
-
'RNC_AsyncSQLiteDBStorage',
|
|
20
|
-
'RNCAsyncStorage',
|
|
21
|
-
'RNGetRandomValues',
|
|
22
|
-
'RNVectorIconsManager',
|
|
23
|
-
'RNVectorIconsModule',
|
|
24
|
-
// False alarm from lottie where it uses react-native-safe-module to detect corresponding native module, but it doesn't exist in lottie.
|
|
25
|
-
'LottieAnimationViewManager',
|
|
26
|
-
'LottieAnimationView',
|
|
27
|
-
/**
|
|
28
|
-
* Other methods that can be called on the NativeModules object that we should ignore. The
|
|
29
|
-
* underlying NativeModules object is sometimes a proxy itself so may not have these methods
|
|
30
|
-
* defined.
|
|
31
|
-
*/
|
|
32
|
-
'hasOwnProperty',
|
|
33
|
-
'isPrototypeOf',
|
|
34
|
-
'propertyIsEnumerable',
|
|
35
|
-
'toJSON',
|
|
36
|
-
'toLocaleString',
|
|
37
|
-
'toString',
|
|
38
|
-
'valueOf',
|
|
39
|
-
'$$typeof',
|
|
40
|
-
]);
|
|
41
|
-
const alreadyErroredModules = new Set();
|
|
42
|
-
let additionalModulesToIgnore = new Set();
|
|
43
|
-
let enabled = true;
|
|
44
|
-
function createErrorMessageForStoreClient(moduleName) {
|
|
45
|
-
return `Your JavaScript code tried to access a native module, ${moduleName}, that isn't supported in Expo Go.
|
|
46
|
-
To continue development with ${moduleName}, you need to create a development build of your app. See https://expo.fyi/missing-native-module for more info, including how to disable these errors.`;
|
|
47
|
-
}
|
|
48
|
-
function createErrorMessageForDevelopmentBuild(moduleName) {
|
|
49
|
-
return `Your JavaScript code tried to access a native module, ${moduleName}, that doesn't exist in this development build.
|
|
50
|
-
Make sure you are using the newest available development build of this app and running a compatible version of your JavaScript code. If you've installed a new library recently, you may need to make a new development build.
|
|
51
|
-
See https://expo.fyi/missing-native-module for more info, including how to disable these errors.`;
|
|
52
|
-
}
|
|
53
|
-
export function createProxyForNativeModules(NativeModules) {
|
|
54
|
-
if (!__DEV__) {
|
|
55
|
-
return NativeModules;
|
|
56
|
-
}
|
|
57
|
-
return new Proxy(NativeModules, {
|
|
58
|
-
get(target, prop, receiver) {
|
|
59
|
-
const value = Reflect.get(target, prop, receiver);
|
|
60
|
-
if (enabled &&
|
|
61
|
-
typeof prop !== 'symbol' &&
|
|
62
|
-
(value === null || value === undefined) &&
|
|
63
|
-
!PROPS_TO_IGNORE.has(prop) &&
|
|
64
|
-
!additionalModulesToIgnore.has(prop) &&
|
|
65
|
-
!alreadyErroredModules.has(prop)) {
|
|
66
|
-
alreadyErroredModules.add(prop);
|
|
67
|
-
const isRunningInStoreClient = global.expo?.modules?.NativeModulesProxy?.modulesConstants.ExponentConstants
|
|
68
|
-
?.executionEnvironment === ExecutionEnvironment.StoreClient ||
|
|
69
|
-
target.NativeUnimoduleProxy?.modulesConstants.ExponentConstants?.executionEnvironment ===
|
|
70
|
-
ExecutionEnvironment.StoreClient;
|
|
71
|
-
if (isRunningInStoreClient) {
|
|
72
|
-
throw new Error(createErrorMessageForStoreClient(prop));
|
|
73
|
-
}
|
|
74
|
-
else if (target.EXDevLauncher) {
|
|
75
|
-
throw new Error(createErrorMessageForDevelopmentBuild(prop));
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
return value;
|
|
79
|
-
},
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* Disable the error thrown when trying to access a native module that doesn't exist in the host
|
|
84
|
-
* runtime. If a module name or array of module names is provided, this method disables the error
|
|
85
|
-
* for only those modules, erasing a previous setting if one exists. If no parameter is provided,
|
|
86
|
-
* this method disables the error for all modules.
|
|
87
|
-
*
|
|
88
|
-
* @param moduleNames Name of module or modules for which to disable the missing native module
|
|
89
|
-
* error. If this parameter is omitted, the error will be disabled globally.
|
|
90
|
-
*/
|
|
91
|
-
export function disableMissingNativeModuleErrors(moduleNames) {
|
|
92
|
-
if (moduleNames) {
|
|
93
|
-
additionalModulesToIgnore =
|
|
94
|
-
typeof moduleNames === 'string' ? new Set([moduleNames]) : new Set(moduleNames);
|
|
95
|
-
enabled = true;
|
|
96
|
-
}
|
|
97
|
-
else {
|
|
98
|
-
enabled = false;
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
/**
|
|
102
|
-
* Access a native module without throwing an error if it doesn't exist.
|
|
103
|
-
*
|
|
104
|
-
* @param moduleName Name of module to access
|
|
105
|
-
* @returns Corresponding native module object, or null if it doesn't exist
|
|
106
|
-
*/
|
|
107
|
-
export function getNativeModuleIfExists(moduleName) {
|
|
108
|
-
return originalNativeModules[moduleName];
|
|
109
|
-
}
|
|
110
|
-
//# sourceMappingURL=NativeModules.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"NativeModules.js","sourceRoot":"","sources":["../../src/proxies/NativeModules.ts"],"names":[],"mappings":"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","sourcesContent":["import { ExecutionEnvironment } from 'expo-constants';\nimport { NativeModules } from 'react-native';\n\nconst originalNativeModules = NativeModules;\n\nconst PROPS_TO_IGNORE: Set<string> = new Set([\n /**\n * We don't want to throw when the expo or expo-modules-core packages try to access any of these\n * modules, since they have built-in fallbacks.\n */\n 'DevLoadingView',\n 'EXDevLauncher',\n 'EXReactNativeEventEmitter',\n 'NativeUnimoduleProxy',\n /**\n * Other modules that are accessed via packages in the Expo SDK but have built-in fallbacks\n */\n 'ExpoImageModule',\n 'ExpoRandom',\n 'PlatformLocalStorage',\n 'RNC_AsyncSQLiteDBStorage',\n 'RNCAsyncStorage',\n 'RNGetRandomValues',\n 'RNVectorIconsManager',\n 'RNVectorIconsModule',\n // False alarm from lottie where it uses react-native-safe-module to detect corresponding native module, but it doesn't exist in lottie.\n 'LottieAnimationViewManager',\n 'LottieAnimationView',\n /**\n * Other methods that can be called on the NativeModules object that we should ignore. The\n * underlying NativeModules object is sometimes a proxy itself so may not have these methods\n * defined.\n */\n 'hasOwnProperty',\n 'isPrototypeOf',\n 'propertyIsEnumerable',\n 'toJSON',\n 'toLocaleString',\n 'toString',\n 'valueOf',\n '$$typeof',\n]);\nconst alreadyErroredModules: Set<string> = new Set();\n\nlet additionalModulesToIgnore: Set<string> = new Set();\nlet enabled = true;\n\nfunction createErrorMessageForStoreClient(moduleName: string) {\n return `Your JavaScript code tried to access a native module, ${moduleName}, that isn't supported in Expo Go.\nTo continue development with ${moduleName}, you need to create a development build of your app. See https://expo.fyi/missing-native-module for more info, including how to disable these errors.`;\n}\n\nfunction createErrorMessageForDevelopmentBuild(moduleName: string) {\n return `Your JavaScript code tried to access a native module, ${moduleName}, that doesn't exist in this development build.\nMake sure you are using the newest available development build of this app and running a compatible version of your JavaScript code. If you've installed a new library recently, you may need to make a new development build.\nSee https://expo.fyi/missing-native-module for more info, including how to disable these errors.`;\n}\n\nexport function createProxyForNativeModules(NativeModules: any) {\n if (!__DEV__) {\n return NativeModules;\n }\n return new Proxy(NativeModules, {\n get(target, prop, receiver) {\n const value = Reflect.get(target, prop, receiver);\n if (\n enabled &&\n typeof prop !== 'symbol' &&\n (value === null || value === undefined) &&\n !PROPS_TO_IGNORE.has(prop) &&\n !additionalModulesToIgnore.has(prop) &&\n !alreadyErroredModules.has(prop)\n ) {\n alreadyErroredModules.add(prop);\n\n const isRunningInStoreClient =\n global.expo?.modules?.NativeModulesProxy?.modulesConstants.ExponentConstants\n ?.executionEnvironment === ExecutionEnvironment.StoreClient ||\n target.NativeUnimoduleProxy?.modulesConstants.ExponentConstants?.executionEnvironment ===\n ExecutionEnvironment.StoreClient;\n if (isRunningInStoreClient) {\n throw new Error(createErrorMessageForStoreClient(prop));\n } else if (target.EXDevLauncher) {\n throw new Error(createErrorMessageForDevelopmentBuild(prop));\n }\n }\n return value;\n },\n });\n}\n\n/**\n * Disable the error thrown when trying to access a native module that doesn't exist in the host\n * runtime. If a module name or array of module names is provided, this method disables the error\n * for only those modules, erasing a previous setting if one exists. If no parameter is provided,\n * this method disables the error for all modules.\n *\n * @param moduleNames Name of module or modules for which to disable the missing native module\n * error. If this parameter is omitted, the error will be disabled globally.\n */\nexport function disableMissingNativeModuleErrors(moduleNames?: string[] | string) {\n if (moduleNames) {\n additionalModulesToIgnore =\n typeof moduleNames === 'string' ? new Set([moduleNames]) : new Set(moduleNames);\n enabled = true;\n } else {\n enabled = false;\n }\n}\n\n/**\n * Access a native module without throwing an error if it doesn't exist.\n *\n * @param moduleName Name of module to access\n * @returns Corresponding native module object, or null if it doesn't exist\n */\nexport function getNativeModuleIfExists(moduleName: string): any {\n return originalNativeModules[moduleName];\n}\n"]}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
// Importing and calling this method in user space prevents it from taking effect early enough;
|
|
2
|
-
// errors would still be enabled for modules imported at the root scope. Instead, this file lets
|
|
3
|
-
// people disable the errors by adding `import 'expo/disable-missing-native-module-errors';` which
|
|
4
|
-
// does take effect early enough.
|
|
5
|
-
import { disableMissingNativeModuleErrors } from './build/proxies/NativeModules';
|
|
6
|
-
disableMissingNativeModuleErrors();
|