expo 55.0.0-canary-20260119-17896bf → 55.0.0-canary-20260120-bb71700
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/Expo.podspec +1 -0
- package/android/build.gradle +5 -5
- package/android/src/main/java/expo/modules/ExpoReactHostFactory.kt +67 -32
- package/android/src/main/java/expo/modules/ReactActivityDelegateWrapper.kt +6 -9
- package/android/src/main/java/expo/modules/fetch/ExpoFetchModule.kt +4 -3
- package/android/src/main/java/expo/modules/fetch/NativeResponse.kt +3 -3
- package/android/src/main/java/expo/modules/fetch/ResponseSink.kt +7 -3
- package/android/src/test/java/expo/modules/ReactActivityDelegateWrapperDelayLoadTest.kt +2 -3
- package/build/Expo.d.ts +1 -1
- package/build/Expo.d.ts.map +1 -1
- package/build/async-require/buildErrors.d.ts +5 -0
- package/build/async-require/buildErrors.d.ts.map +1 -0
- package/build/async-require/getDevServer.d.ts.map +1 -1
- package/build/async-require/getFullBundlerUrl.d.ts +2 -0
- package/build/async-require/getFullBundlerUrl.d.ts.map +1 -0
- package/build/async-require/hmr.d.ts +8 -8
- package/build/async-require/hmr.d.ts.map +1 -1
- package/build/async-require/hmrUtils.d.ts +13 -0
- package/build/async-require/hmrUtils.d.ts.map +1 -0
- package/build/async-require/hmrUtils.native.d.ts +13 -0
- package/build/async-require/hmrUtils.native.d.ts.map +1 -0
- package/build/dom/dom-entry.d.ts.map +1 -1
- package/build/dom/dom-internal.types.d.ts +11 -0
- package/build/dom/dom-internal.types.d.ts.map +1 -0
- package/build/dom/dom.types.d.ts +5 -0
- package/build/dom/dom.types.d.ts.map +1 -1
- package/build/dom/internal.d.ts +1 -0
- package/build/dom/internal.d.ts.map +1 -1
- package/build/dom/webview-wrapper.d.ts +2 -2
- package/build/dom/webview-wrapper.d.ts.map +1 -1
- package/build/hooks/useEvent.d.ts +2 -2
- package/bundledNativeModules.json +99 -101
- package/ios/AppDelegates/AppDelegatesLoaderDelegate.swift +2 -0
- package/ios/AppDelegates/EXReactRootViewFactory.h +8 -1
- package/ios/AppDelegates/EXReactRootViewFactory.mm +26 -0
- package/ios/AppDelegates/ExpoAppDelegate.swift +14 -55
- package/ios/AppDelegates/ExpoReactNativeFactory.h +12 -0
- package/ios/AppDelegates/ExpoReactNativeFactory.mm +45 -0
- package/ios/AppDelegates/ExpoReactNativeFactory.swift +22 -1
- package/ios/Expo.h +2 -1
- package/ios/Fetch/ExpoFetchModule.swift +2 -2
- package/local-build-cache-provider.d.ts +1 -0
- package/local-build-cache-provider.js +1 -0
- package/package.json +29 -23
- package/src/Expo.fx.tsx +1 -25
- package/src/Expo.fx.web.tsx +2 -2
- package/src/Expo.ts +3 -0
- package/src/__tests__/__fbBatchedBridgeConfig-test.ts +7 -3
- package/src/async-require/asyncRequireModule.ts +2 -2
- package/src/async-require/buildErrors.ts +14 -0
- package/src/async-require/getDevServer.ts +3 -9
- package/src/async-require/getFullBundlerUrl.ts +13 -0
- package/src/async-require/hmr.ts +118 -103
- package/src/async-require/hmrUtils.native.ts +97 -0
- package/src/async-require/hmrUtils.ts +54 -0
- package/src/async-require/index.ts +1 -1
- package/src/async-require/setupFastRefresh.ts +3 -2
- package/src/dom/dom-entry.tsx +15 -8
- package/src/dom/dom-internal.types.ts +9 -0
- package/src/dom/dom.types.ts +6 -0
- package/src/dom/internal.ts +2 -0
- package/src/dom/webview-wrapper.tsx +14 -6
- package/src/hooks/useEvent.ts +2 -2
- package/template.tgz +0 -0
- package/types/react-native-web.d.ts +1 -1
- package/android/src/main/java/expo/modules/ReactNativeHostWrapper.kt +0 -51
- package/android/src/main/java/expo/modules/ReactNativeHostWrapperBase.kt +0 -107
- package/build/async-require/hmr.native.d.ts +0 -3
- package/build/async-require/hmr.native.d.ts.map +0 -1
- package/ios/AppDelegates/EXAppDelegateWrapper.h +0 -30
- package/ios/AppDelegates/EXAppDelegateWrapper.mm +0 -112
- package/src/async-require/hmr.native.ts +0 -3
package/src/dom/dom-entry.tsx
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
// Entry file for a DOM Component.
|
|
2
2
|
import '@expo/metro-runtime';
|
|
3
3
|
|
|
4
|
-
import { withErrorOverlay } from '@expo/metro-runtime/error-overlay';
|
|
5
4
|
import React from 'react';
|
|
6
5
|
|
|
7
6
|
import { JSONValue } from './dom.types';
|
|
@@ -9,12 +8,13 @@ import { addEventListener, getActionsObject } from './marshal';
|
|
|
9
8
|
import registerRootComponent from '../launch/registerRootComponent';
|
|
10
9
|
|
|
11
10
|
interface MarshalledProps {
|
|
12
|
-
|
|
11
|
+
names: string[];
|
|
13
12
|
props: Record<string, JSONValue>;
|
|
14
13
|
[key: string]: undefined | JSONValue;
|
|
15
14
|
}
|
|
16
15
|
|
|
17
16
|
interface WindowType {
|
|
17
|
+
$$EXPO_DOM_HOST_OS?: string;
|
|
18
18
|
$$EXPO_INITIAL_PROPS?: MarshalledProps;
|
|
19
19
|
}
|
|
20
20
|
|
|
@@ -65,6 +65,13 @@ function convertError(error: any) {
|
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
export function registerDOMComponent(AppModule: any) {
|
|
68
|
+
if (typeof window.$$EXPO_DOM_HOST_OS === 'undefined') {
|
|
69
|
+
throw new Error(
|
|
70
|
+
'Top OS ($$EXPO_DOM_HOST_OS) is not defined. This is a bug in the DOM Component runtime.'
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
process.env.EXPO_DOM_HOST_OS = window.$$EXPO_DOM_HOST_OS;
|
|
74
|
+
|
|
68
75
|
function DOMComponentRoot(props: Record<string, unknown>) {
|
|
69
76
|
// Props listeners
|
|
70
77
|
const [marshalledProps, setProps] = React.useState(() => {
|
|
@@ -92,7 +99,7 @@ export function registerDOMComponent(AppModule: any) {
|
|
|
92
99
|
// Create a named map { [name: string]: ProxyFunction }
|
|
93
100
|
// TODO(@kitten): Unclear how this is typed or shaped
|
|
94
101
|
return Object.fromEntries(
|
|
95
|
-
|
|
102
|
+
marshalledProps.names.map((key: string) => {
|
|
96
103
|
return [key, ACTIONS[key]];
|
|
97
104
|
})
|
|
98
105
|
);
|
|
@@ -102,12 +109,12 @@ export function registerDOMComponent(AppModule: any) {
|
|
|
102
109
|
}
|
|
103
110
|
|
|
104
111
|
try {
|
|
112
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
113
|
+
require('@expo/log-box/lib').setupLogBox();
|
|
114
|
+
}
|
|
115
|
+
|
|
105
116
|
React.startTransition(() => {
|
|
106
|
-
|
|
107
|
-
registerRootComponent(withErrorOverlay(DOMComponentRoot));
|
|
108
|
-
} else {
|
|
109
|
-
registerRootComponent(DOMComponentRoot);
|
|
110
|
-
}
|
|
117
|
+
registerRootComponent(DOMComponentRoot);
|
|
111
118
|
});
|
|
112
119
|
} catch (e) {
|
|
113
120
|
const error = convertError(e);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { DOMProps } from './dom.types';
|
|
2
|
+
|
|
3
|
+
export interface DOMPropsInternal extends DOMProps {
|
|
4
|
+
/**
|
|
5
|
+
* Allows dynamically redirecting a component to a different source, for example prebuilt version.
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
8
|
+
sourceOverride?: { uri: string };
|
|
9
|
+
}
|
package/src/dom/dom.types.ts
CHANGED
|
@@ -36,4 +36,10 @@ export interface DOMProps extends Omit<RNWebViewProps, 'source'> {
|
|
|
36
36
|
* @default false
|
|
37
37
|
*/
|
|
38
38
|
useExpoDOMWebView?: boolean;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Allows dynamically redirecting a component to a different source, for example a prebuilt version.
|
|
42
|
+
* @internal
|
|
43
|
+
*/
|
|
44
|
+
overrideUri?: string;
|
|
39
45
|
}
|
package/src/dom/internal.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export { default as WebView } from './webview-wrapper';
|
|
2
2
|
|
|
3
|
+
export * from './dom-internal.types';
|
|
4
|
+
|
|
3
5
|
// Skip all dom-only functions to give 'undefined is not a function' errors.
|
|
4
6
|
export const registerDOMComponent: undefined | typeof import('./dom-entry').registerDOMComponent =
|
|
5
7
|
undefined;
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
// A webview without babel to test faster.
|
|
2
|
+
//
|
|
3
|
+
// Keep in sync with ExpoLogBox native webview wrappers.
|
|
4
|
+
// Android https://github.com/expo/expo/blob/main/packages/%40expo/log-box/android/src/main/expo/modules/logbox/ExpoLogBoxWebViewWrapper.kt
|
|
5
|
+
// iOS https://github.com/expo/expo/blob/main/packages/%40expo/log-box/ios/ExpoLogBoxWebViewWrapper.swift
|
|
2
6
|
import React from 'react';
|
|
3
7
|
import { AppState } from 'react-native';
|
|
4
8
|
|
|
5
9
|
import { getBaseURL } from './base';
|
|
6
|
-
import
|
|
10
|
+
import { DOMPropsInternal } from './dom-internal.types';
|
|
11
|
+
import type { BridgeMessage, WebViewProps, WebViewRef } from './dom.types';
|
|
7
12
|
import { _emitGlobalEvent } from './global-events';
|
|
8
13
|
import {
|
|
9
14
|
getInjectBodySizeObserverScript,
|
|
@@ -22,14 +27,15 @@ type RawWebViewProps = React.ComponentProps<Exclude<typeof ExpoDomWebView, undef
|
|
|
22
27
|
|
|
23
28
|
interface Props {
|
|
24
29
|
children?: any;
|
|
25
|
-
dom?:
|
|
30
|
+
dom?: DOMPropsInternal;
|
|
26
31
|
filePath: string;
|
|
27
32
|
ref: React.Ref<object>;
|
|
28
33
|
[propName: string]: unknown;
|
|
29
34
|
}
|
|
30
35
|
|
|
31
36
|
const RawWebView = React.forwardRef<object, Props>((props, ref) => {
|
|
32
|
-
const { children, dom, filePath, ref: _ref, ...marshalProps } = props as Props;
|
|
37
|
+
const { children, dom: domProps, filePath, ref: _ref, ...marshalProps } = props as Props;
|
|
38
|
+
const { overrideUri, ...dom } = domProps || {};
|
|
33
39
|
if (__DEV__) {
|
|
34
40
|
if (children !== undefined) {
|
|
35
41
|
throw new Error(
|
|
@@ -66,7 +72,7 @@ const RawWebView = React.forwardRef<object, Props>((props, ref) => {
|
|
|
66
72
|
const webView = resolveWebView(dom?.useExpoDOMWebView ?? false);
|
|
67
73
|
const webviewRef = React.useRef<WebViewRef>(null);
|
|
68
74
|
const domImperativeHandlePropsRef = React.useRef<string[]>([]);
|
|
69
|
-
const source = { uri: `${getBaseURL()}/${filePath}` };
|
|
75
|
+
const source = { uri: overrideUri ?? `${getBaseURL()}/${filePath}` };
|
|
70
76
|
const [containerStyle, setContainerStyle] = React.useState<WebViewProps['containerStyle']>(null);
|
|
71
77
|
|
|
72
78
|
const { debugZeroHeightStyle, debugOnLayout } = useDebugZeroHeight(dom);
|
|
@@ -129,10 +135,12 @@ const RawWebView = React.forwardRef<object, Props>((props, ref) => {
|
|
|
129
135
|
subscription.remove();
|
|
130
136
|
});
|
|
131
137
|
},
|
|
132
|
-
...
|
|
138
|
+
...domProps,
|
|
133
139
|
containerStyle: [containerStyle, debugZeroHeightStyle, dom?.containerStyle],
|
|
134
|
-
onLayout: __DEV__ ? debugOnLayout : dom?.onLayout,
|
|
140
|
+
onLayout: (__DEV__ ? debugOnLayout : dom?.onLayout) as RawWebViewProps['onLayout'],
|
|
135
141
|
injectedJavaScriptBeforeContentLoaded: [
|
|
142
|
+
// Inject the top-most OS for the DOM component to read.
|
|
143
|
+
`window.$$EXPO_DOM_HOST_OS = ${JSON.stringify(process.env.EXPO_OS)};true;`,
|
|
136
144
|
// On first mount, inject `$$EXPO_INITIAL_PROPS` with the initial props.
|
|
137
145
|
`window.$$EXPO_INITIAL_PROPS = ${JSON.stringify(smartActions)};true;`,
|
|
138
146
|
dom?.matchContents ? getInjectBodySizeObserverScript() : null,
|
package/src/hooks/useEvent.ts
CHANGED
|
@@ -32,7 +32,7 @@ type InferEventParameter<
|
|
|
32
32
|
/**
|
|
33
33
|
* React hook that listens to events emitted by the given object. The returned value is an event parameter
|
|
34
34
|
* that gets updated whenever a new event is dispatched.
|
|
35
|
-
* @param eventEmitter An object that emits events. For example, a native module or shared object or an instance of [`EventEmitter`](#
|
|
35
|
+
* @param eventEmitter An object that emits events. For example, a native module or shared object or an instance of [`EventEmitter`](#eventemittertype).
|
|
36
36
|
* @param eventName Name of the event to listen to.
|
|
37
37
|
* @param initialValue An event parameter to use until the event is called for the first time.
|
|
38
38
|
* @returns A parameter of the event listener.
|
|
@@ -71,7 +71,7 @@ export function useEvent<
|
|
|
71
71
|
/**
|
|
72
72
|
* React hook that listens to events emitted by the given object and calls the listener function whenever a new event is dispatched.
|
|
73
73
|
* The event listener is automatically added during the first render and removed when the component unmounts.
|
|
74
|
-
* @param eventEmitter An object that emits events. For example, a native module or shared object or an instance of [`EventEmitter`](#
|
|
74
|
+
* @param eventEmitter An object that emits events. For example, a native module or shared object or an instance of [`EventEmitter`](#eventemittertype).
|
|
75
75
|
* @param eventName Name of the event to listen to.
|
|
76
76
|
* @param listener A function to call when the event is dispatched.
|
|
77
77
|
* @example
|
package/template.tgz
CHANGED
|
Binary file
|
|
@@ -93,7 +93,7 @@ declare module 'react-native' {
|
|
|
93
93
|
/** @platform web */
|
|
94
94
|
transitionDelay?: string | string[];
|
|
95
95
|
/** @platform web */
|
|
96
|
-
transitionDuration?: string | string[];
|
|
96
|
+
transitionDuration?: string | string[] | number;
|
|
97
97
|
/** @platform web */
|
|
98
98
|
transitionProperty?: string | string[];
|
|
99
99
|
/** @platform web */
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
package expo.modules
|
|
2
|
-
|
|
3
|
-
import android.app.Application
|
|
4
|
-
import android.content.Context
|
|
5
|
-
import com.facebook.react.ReactHost
|
|
6
|
-
import com.facebook.react.ReactNativeHost
|
|
7
|
-
import com.facebook.react.ReactPackageTurboModuleManagerDelegate
|
|
8
|
-
import com.facebook.react.bridge.UIManagerProvider
|
|
9
|
-
import com.facebook.react.common.SurfaceDelegateFactory
|
|
10
|
-
import com.facebook.react.devsupport.DevSupportManagerFactory
|
|
11
|
-
import com.facebook.react.devsupport.interfaces.RedBoxHandler
|
|
12
|
-
|
|
13
|
-
class ReactNativeHostWrapper(
|
|
14
|
-
application: Application,
|
|
15
|
-
host: ReactNativeHost
|
|
16
|
-
) : ReactNativeHostWrapperBase(application, host) {
|
|
17
|
-
override fun getDevSupportManagerFactory(): DevSupportManagerFactory? {
|
|
18
|
-
return reactNativeHostHandlers
|
|
19
|
-
.asSequence()
|
|
20
|
-
.mapNotNull { it.devSupportManagerFactory }
|
|
21
|
-
.firstOrNull() as DevSupportManagerFactory?
|
|
22
|
-
?: invokeDelegateMethod("getDevSupportManagerFactory")
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
override fun getReactPackageTurboModuleManagerDelegateBuilder(): ReactPackageTurboModuleManagerDelegate.Builder? {
|
|
26
|
-
return invokeDelegateMethod("getReactPackageTurboModuleManagerDelegateBuilder")
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
override fun getUIManagerProvider(): UIManagerProvider? {
|
|
30
|
-
return invokeDelegateMethod("getUIManagerProvider")
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
override fun getShouldRequireActivity(): Boolean {
|
|
34
|
-
return host.shouldRequireActivity
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
override fun getSurfaceDelegateFactory(): SurfaceDelegateFactory {
|
|
38
|
-
return host.surfaceDelegateFactory
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
override fun getRedBoxHandler(): RedBoxHandler? {
|
|
42
|
-
return invokeDelegateMethod("getRedBoxHandler")
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
companion object {
|
|
46
|
-
@JvmStatic
|
|
47
|
-
fun createReactHost(context: Context, reactNativeHost: ReactNativeHost): ReactHost {
|
|
48
|
-
return ExpoReactHostFactory.createFromReactNativeHost(context, reactNativeHost)
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
package expo.modules
|
|
2
|
-
|
|
3
|
-
import android.app.Application
|
|
4
|
-
import androidx.collection.ArrayMap
|
|
5
|
-
import com.facebook.react.ReactInstanceEventListener
|
|
6
|
-
import com.facebook.react.ReactInstanceManager
|
|
7
|
-
import com.facebook.react.ReactNativeHost
|
|
8
|
-
import com.facebook.react.ReactPackage
|
|
9
|
-
import com.facebook.react.bridge.JavaScriptExecutorFactory
|
|
10
|
-
import com.facebook.react.bridge.ReactContext
|
|
11
|
-
import com.facebook.react.defaults.DefaultReactNativeHost
|
|
12
|
-
import java.lang.reflect.Method
|
|
13
|
-
|
|
14
|
-
open class ReactNativeHostWrapperBase(
|
|
15
|
-
application: Application,
|
|
16
|
-
protected val host: ReactNativeHost
|
|
17
|
-
) : DefaultReactNativeHost(application) {
|
|
18
|
-
|
|
19
|
-
val reactNativeHostHandlers = ExpoModulesPackage.packageList
|
|
20
|
-
.flatMap { it.createReactNativeHostHandlers(application) }
|
|
21
|
-
private val methodMap: ArrayMap<String, Method> = ArrayMap()
|
|
22
|
-
|
|
23
|
-
override fun createReactInstanceManager(): ReactInstanceManager {
|
|
24
|
-
val developerSupport = useDeveloperSupport
|
|
25
|
-
reactNativeHostHandlers.forEach { handler ->
|
|
26
|
-
handler.onWillCreateReactInstance(developerSupport)
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
val result = super.createReactInstanceManager()
|
|
30
|
-
|
|
31
|
-
reactNativeHostHandlers.forEach { handler ->
|
|
32
|
-
handler.onDidCreateDevSupportManager(result.devSupportManager)
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
result.addReactInstanceEventListener(object : ReactInstanceEventListener {
|
|
36
|
-
override fun onReactContextInitialized(context: ReactContext) {
|
|
37
|
-
reactNativeHostHandlers.forEach { handler ->
|
|
38
|
-
handler.onDidCreateReactInstance(developerSupport, context)
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
})
|
|
42
|
-
|
|
43
|
-
injectHostReactInstanceManager(result)
|
|
44
|
-
|
|
45
|
-
return result
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
override fun getJavaScriptExecutorFactory(): JavaScriptExecutorFactory? {
|
|
49
|
-
return reactNativeHostHandlers.asSequence()
|
|
50
|
-
.mapNotNull { it.javaScriptExecutorFactory }
|
|
51
|
-
.firstOrNull() ?: invokeDelegateMethod("getJavaScriptExecutorFactory")
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
public override fun getJSMainModuleName(): String {
|
|
55
|
-
return invokeDelegateMethod("getJSMainModuleName")
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
public override fun getJSBundleFile(): String? {
|
|
59
|
-
return reactNativeHostHandlers.asSequence()
|
|
60
|
-
.mapNotNull { it.getJSBundleFile(useDeveloperSupport) }
|
|
61
|
-
.firstOrNull() ?: invokeDelegateMethod("getJSBundleFile")
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
public override fun getBundleAssetName(): String? {
|
|
65
|
-
return reactNativeHostHandlers.asSequence()
|
|
66
|
-
.mapNotNull { it.getBundleAssetName(useDeveloperSupport) }
|
|
67
|
-
.firstOrNull() ?: invokeDelegateMethod("getBundleAssetName")
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
override fun getUseDeveloperSupport(): Boolean {
|
|
71
|
-
return reactNativeHostHandlers.asSequence()
|
|
72
|
-
.mapNotNull { it.useDeveloperSupport }
|
|
73
|
-
.firstOrNull() ?: host.useDeveloperSupport
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
public override fun getPackages(): MutableList<ReactPackage> {
|
|
77
|
-
return invokeDelegateMethod("getPackages")
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
//endregion
|
|
81
|
-
|
|
82
|
-
//region Internals
|
|
83
|
-
|
|
84
|
-
// this is to call the methods as overridden in MainApplication.kt
|
|
85
|
-
@Suppress("UNCHECKED_CAST")
|
|
86
|
-
internal fun <T> invokeDelegateMethod(name: String): T {
|
|
87
|
-
var method = methodMap[name]
|
|
88
|
-
if (method == null) {
|
|
89
|
-
method = ReactNativeHost::class.java.getDeclaredMethod(name)
|
|
90
|
-
method.isAccessible = true
|
|
91
|
-
methodMap[name] = method
|
|
92
|
-
}
|
|
93
|
-
return method!!.invoke(host) as T
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* Inject the @{ReactInstanceManager} from the wrapper to the wrapped host.
|
|
98
|
-
* In case the wrapped host to call `getReactInstanceManager` inside its methods.
|
|
99
|
-
*/
|
|
100
|
-
private fun injectHostReactInstanceManager(reactInstanceManager: ReactInstanceManager) {
|
|
101
|
-
val mReactInstanceManagerField = ReactNativeHost::class.java.getDeclaredField("mReactInstanceManager")
|
|
102
|
-
mReactInstanceManagerField.isAccessible = true
|
|
103
|
-
mReactInstanceManagerField.set(host, reactInstanceManager)
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
//endregion
|
|
107
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hmr.native.d.ts","sourceRoot":"","sources":["../../src/async-require/hmr.native.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,SAAS,KAAgE,CAAC;AAEhF,eAAe,SAAS,CAAC"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
// Copyright 2018-present 650 Industries. All rights reserved.
|
|
2
|
-
|
|
3
|
-
#import <ExpoModulesCore/Platform.h>
|
|
4
|
-
#import <ExpoModulesCore/EXReactDelegateWrapper.h>
|
|
5
|
-
#import <Expo/RCTAppDelegateUmbrella.h>
|
|
6
|
-
|
|
7
|
-
NS_ASSUME_NONNULL_BEGIN
|
|
8
|
-
|
|
9
|
-
@interface RCTAppDelegate ()
|
|
10
|
-
|
|
11
|
-
@end
|
|
12
|
-
|
|
13
|
-
__deprecated_msg("EXAppDelegateWrapper is deprecated. Migrate your AppDelegate to Swift and use ExpoAppDelegate instead. EXAppDelegateWrapper will be removed in SDK 55.")
|
|
14
|
-
@interface EXAppDelegateWrapper : NSObject <UIApplicationDelegate, UISceneDelegate, RCTReactNativeFactoryDelegate>
|
|
15
|
-
|
|
16
|
-
@property (nonatomic, strong, readonly) EXReactDelegateWrapper *reactDelegate;
|
|
17
|
-
|
|
18
|
-
@property (nonatomic, strong, nullable) NSString *moduleName;
|
|
19
|
-
@property (nonatomic, strong, nullable) NSDictionary *initialProps;
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
Currently (RN 0.76) `customizeRootView` signature in `RCTAppDelegate` is broken as it uses `RCTRootView` type,
|
|
23
|
-
but this type is no longer used. It should rather be `RCTSurfaceHostingView`, but for simplicity it could be just `UIView`.
|
|
24
|
-
We need a helper function in Objective-C to actually make it to work, otherwise the types will conflict in Swift.
|
|
25
|
-
*/
|
|
26
|
-
+ (void)customizeRootView:(nonnull UIView *)rootView byAppDelegate:(nonnull RCTAppDelegate *)appDelegate;
|
|
27
|
-
|
|
28
|
-
@end
|
|
29
|
-
|
|
30
|
-
NS_ASSUME_NONNULL_END
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
// Copyright 2018-present 650 Industries. All rights reserved.
|
|
2
|
-
|
|
3
|
-
#import <Expo/EXAppDelegateWrapper.h>
|
|
4
|
-
|
|
5
|
-
#import <Expo/RCTAppDelegateUmbrella.h>
|
|
6
|
-
#import <Expo/Swift.h>
|
|
7
|
-
|
|
8
|
-
#import <React/RCTComponentViewFactory.h> // Allows non-umbrella since it's coming from React-RCTFabric
|
|
9
|
-
#import <ReactCommon/RCTHost.h> // Allows non-umbrella because the header is not inside a clang module
|
|
10
|
-
|
|
11
|
-
@implementation EXAppDelegateWrapper {
|
|
12
|
-
EXExpoAppDelegate *_expoAppDelegate;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
- (instancetype)init
|
|
16
|
-
{
|
|
17
|
-
if (self = [super init]) {
|
|
18
|
-
_expoAppDelegate = [EXExpoAppDelegate new];
|
|
19
|
-
}
|
|
20
|
-
return self;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
// This needs to be implemented, otherwise forwarding won't be called.
|
|
24
|
-
// When the app starts, `UIApplication` uses it to check beforehand
|
|
25
|
-
// which `UIApplicationDelegate` selectors are implemented.
|
|
26
|
-
- (BOOL)respondsToSelector:(SEL)selector
|
|
27
|
-
{
|
|
28
|
-
return [super respondsToSelector:selector] || [_expoAppDelegate respondsToSelector:selector];
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
// Forwards all invocations to `ExpoAppDelegate` object.
|
|
32
|
-
- (id)forwardingTargetForSelector:(SEL)selector
|
|
33
|
-
{
|
|
34
|
-
return _expoAppDelegate;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
#pragma mark - UIApplicationDelegate
|
|
38
|
-
|
|
39
|
-
// Make sure to override all necessary methods from `RCTAppDelegate` here, explicitly forwarding everything to `_expoAppDelegate`.
|
|
40
|
-
// `forwardingTargetForSelector` works only for methods that are not specified in this and `RCTAppDelegate` classes.
|
|
41
|
-
|
|
42
|
-
#if !TARGET_OS_OSX
|
|
43
|
-
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
|
|
44
|
-
{
|
|
45
|
-
return [_expoAppDelegate application:application didFinishLaunchingWithOptions:launchOptions];
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
- (void)applicationDidBecomeActive:(UIApplication *)application
|
|
49
|
-
{
|
|
50
|
-
return [_expoAppDelegate applicationDidBecomeActive:application];
|
|
51
|
-
}
|
|
52
|
-
#else
|
|
53
|
-
- (void)applicationDidFinishLaunching:(NSNotification *)notification
|
|
54
|
-
{
|
|
55
|
-
return [_expoAppDelegate applicationDidFinishLaunching:notification];
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
- (void)applicationDidBecomeActive:(NSNotification *)notification
|
|
59
|
-
{
|
|
60
|
-
return [_expoAppDelegate applicationDidBecomeActive:notification];
|
|
61
|
-
}
|
|
62
|
-
#endif
|
|
63
|
-
|
|
64
|
-
- (UIViewController *)createRootViewController
|
|
65
|
-
{
|
|
66
|
-
return [_expoAppDelegate.factory.delegate createRootViewController];
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
- (void)customizeRootView:(UIView *)rootView
|
|
70
|
-
{
|
|
71
|
-
[_expoAppDelegate.factory.delegate customizeRootView:rootView];
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
#pragma mark - RCTComponentViewFactoryComponentProvider
|
|
75
|
-
|
|
76
|
-
- (NSDictionary<NSString *, Class<RCTComponentViewProtocol>> *)thirdPartyFabricComponents
|
|
77
|
-
{
|
|
78
|
-
return self.dependencyProvider.thirdPartyFabricComponents;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
#pragma mark - RCTHostDelegate
|
|
82
|
-
|
|
83
|
-
- (void)hostDidStart:(RCTHost *)host
|
|
84
|
-
{
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
- (void)host:(RCTHost *)host
|
|
88
|
-
didReceiveJSErrorStack:(NSArray<NSDictionary<NSString *, id> *> *)stack
|
|
89
|
-
message:(NSString *)message
|
|
90
|
-
exceptionId:(NSUInteger)exceptionId
|
|
91
|
-
isFatal:(BOOL)isFatal
|
|
92
|
-
{
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
- (id<RCTTurboModule>)getModuleInstanceFromClass:(Class)moduleClass
|
|
96
|
-
{
|
|
97
|
-
return [_expoAppDelegate.factory.delegate getModuleInstanceFromClass:moduleClass];
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
- (Class)getModuleClassFromName:(const char *)name {
|
|
101
|
-
return [_expoAppDelegate.factory.delegate getModuleClassFromName:name];
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
#pragma mark - Helpers
|
|
106
|
-
|
|
107
|
-
+ (void)customizeRootView:(nonnull UIView *)rootView byAppDelegate:(nonnull RCTAppDelegate *)appDelegate
|
|
108
|
-
{
|
|
109
|
-
[appDelegate customizeRootView:(RCTRootView *)rootView];
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
@end
|