expo 55.0.0-canary-20260119-70f7c28 → 55.0.0-canary-20260119-17896bf
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 +0 -1
- package/android/build.gradle +5 -5
- package/android/src/main/java/expo/modules/ExpoReactHostFactory.kt +32 -67
- package/android/src/main/java/expo/modules/ReactActivityDelegateWrapper.kt +9 -6
- package/android/src/main/java/expo/modules/ReactNativeHostWrapper.kt +51 -0
- package/android/src/main/java/expo/modules/ReactNativeHostWrapperBase.kt +107 -0
- package/android/src/main/java/expo/modules/fetch/ExpoFetchModule.kt +3 -4
- package/android/src/main/java/expo/modules/fetch/NativeResponse.kt +3 -3
- package/android/src/main/java/expo/modules/fetch/ResponseSink.kt +3 -7
- package/android/src/test/java/expo/modules/ReactActivityDelegateWrapperDelayLoadTest.kt +3 -2
- package/build/Expo.d.ts +1 -1
- package/build/Expo.d.ts.map +1 -1
- package/build/async-require/getDevServer.d.ts.map +1 -1
- package/build/async-require/hmr.d.ts +8 -8
- package/build/async-require/hmr.d.ts.map +1 -1
- package/build/async-require/hmr.native.d.ts +3 -0
- package/build/async-require/hmr.native.d.ts.map +1 -0
- package/build/dom/dom-entry.d.ts.map +1 -1
- package/build/dom/dom.types.d.ts +0 -5
- package/build/dom/dom.types.d.ts.map +1 -1
- package/build/dom/internal.d.ts +0 -1
- 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 +101 -99
- package/ios/AppDelegates/AppDelegatesLoaderDelegate.swift +0 -2
- package/ios/AppDelegates/EXAppDelegateWrapper.h +30 -0
- package/ios/AppDelegates/EXAppDelegateWrapper.mm +112 -0
- package/ios/AppDelegates/EXReactRootViewFactory.h +1 -8
- package/ios/AppDelegates/EXReactRootViewFactory.mm +0 -26
- package/ios/AppDelegates/ExpoAppDelegate.swift +52 -13
- package/ios/AppDelegates/ExpoReactNativeFactory.swift +1 -22
- package/ios/Expo.h +1 -2
- package/ios/Fetch/ExpoFetchModule.swift +2 -2
- package/package.json +23 -29
- package/src/Expo.fx.tsx +25 -1
- package/src/Expo.fx.web.tsx +2 -2
- package/src/Expo.ts +0 -3
- package/src/__tests__/__fbBatchedBridgeConfig-test.ts +3 -7
- package/src/async-require/asyncRequireModule.ts +2 -2
- package/src/async-require/getDevServer.ts +9 -3
- package/src/async-require/hmr.native.ts +3 -0
- package/src/async-require/hmr.ts +103 -118
- package/src/async-require/index.ts +1 -1
- package/src/async-require/setupFastRefresh.ts +2 -3
- package/src/dom/dom-entry.tsx +8 -15
- package/src/dom/dom.types.ts +0 -6
- package/src/dom/internal.ts +0 -2
- package/src/dom/webview-wrapper.tsx +6 -14
- package/src/hooks/useEvent.ts +2 -2
- package/template.tgz +0 -0
- package/types/react-native-web.d.ts +1 -1
- package/build/async-require/buildErrors.d.ts +0 -5
- package/build/async-require/buildErrors.d.ts.map +0 -1
- package/build/async-require/getFullBundlerUrl.d.ts +0 -2
- package/build/async-require/getFullBundlerUrl.d.ts.map +0 -1
- package/build/async-require/hmrUtils.d.ts +0 -13
- package/build/async-require/hmrUtils.d.ts.map +0 -1
- package/build/async-require/hmrUtils.native.d.ts +0 -13
- package/build/async-require/hmrUtils.native.d.ts.map +0 -1
- package/build/dom/dom-internal.types.d.ts +0 -11
- package/build/dom/dom-internal.types.d.ts.map +0 -1
- package/ios/AppDelegates/ExpoReactNativeFactory.h +0 -12
- package/ios/AppDelegates/ExpoReactNativeFactory.mm +0 -45
- package/local-build-cache-provider.d.ts +0 -1
- package/local-build-cache-provider.js +0 -1
- package/src/async-require/buildErrors.ts +0 -14
- package/src/async-require/getFullBundlerUrl.ts +0 -13
- package/src/async-require/hmrUtils.native.ts +0 -97
- package/src/async-require/hmrUtils.ts +0 -54
- package/src/dom/dom-internal.types.ts +0 -9
|
@@ -1,14 +1,9 @@
|
|
|
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
|
|
6
2
|
import React from 'react';
|
|
7
3
|
import { AppState } from 'react-native';
|
|
8
4
|
|
|
9
5
|
import { getBaseURL } from './base';
|
|
10
|
-
import {
|
|
11
|
-
import type { BridgeMessage, WebViewProps, WebViewRef } from './dom.types';
|
|
6
|
+
import type { BridgeMessage, DOMProps, WebViewProps, WebViewRef } from './dom.types';
|
|
12
7
|
import { _emitGlobalEvent } from './global-events';
|
|
13
8
|
import {
|
|
14
9
|
getInjectBodySizeObserverScript,
|
|
@@ -27,15 +22,14 @@ type RawWebViewProps = React.ComponentProps<Exclude<typeof ExpoDomWebView, undef
|
|
|
27
22
|
|
|
28
23
|
interface Props {
|
|
29
24
|
children?: any;
|
|
30
|
-
dom?:
|
|
25
|
+
dom?: DOMProps;
|
|
31
26
|
filePath: string;
|
|
32
27
|
ref: React.Ref<object>;
|
|
33
28
|
[propName: string]: unknown;
|
|
34
29
|
}
|
|
35
30
|
|
|
36
31
|
const RawWebView = React.forwardRef<object, Props>((props, ref) => {
|
|
37
|
-
const { children, dom
|
|
38
|
-
const { overrideUri, ...dom } = domProps || {};
|
|
32
|
+
const { children, dom, filePath, ref: _ref, ...marshalProps } = props as Props;
|
|
39
33
|
if (__DEV__) {
|
|
40
34
|
if (children !== undefined) {
|
|
41
35
|
throw new Error(
|
|
@@ -72,7 +66,7 @@ const RawWebView = React.forwardRef<object, Props>((props, ref) => {
|
|
|
72
66
|
const webView = resolveWebView(dom?.useExpoDOMWebView ?? false);
|
|
73
67
|
const webviewRef = React.useRef<WebViewRef>(null);
|
|
74
68
|
const domImperativeHandlePropsRef = React.useRef<string[]>([]);
|
|
75
|
-
const source = { uri:
|
|
69
|
+
const source = { uri: `${getBaseURL()}/${filePath}` };
|
|
76
70
|
const [containerStyle, setContainerStyle] = React.useState<WebViewProps['containerStyle']>(null);
|
|
77
71
|
|
|
78
72
|
const { debugZeroHeightStyle, debugOnLayout } = useDebugZeroHeight(dom);
|
|
@@ -135,12 +129,10 @@ const RawWebView = React.forwardRef<object, Props>((props, ref) => {
|
|
|
135
129
|
subscription.remove();
|
|
136
130
|
});
|
|
137
131
|
},
|
|
138
|
-
...
|
|
132
|
+
...dom,
|
|
139
133
|
containerStyle: [containerStyle, debugZeroHeightStyle, dom?.containerStyle],
|
|
140
|
-
onLayout:
|
|
134
|
+
onLayout: __DEV__ ? debugOnLayout : dom?.onLayout,
|
|
141
135
|
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;`,
|
|
144
136
|
// On first mount, inject `$$EXPO_INITIAL_PROPS` with the initial props.
|
|
145
137
|
`window.$$EXPO_INITIAL_PROPS = ${JSON.stringify(smartActions)};true;`,
|
|
146
138
|
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`](#eventemitter).
|
|
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`](#eventemitter).
|
|
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[];
|
|
97
97
|
/** @platform web */
|
|
98
98
|
transitionProperty?: string | string[];
|
|
99
99
|
/** @platform web */
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"buildErrors.d.ts","sourceRoot":"","sources":["../../src/async-require/buildErrors.ts"],"names":[],"mappings":"AAEA,qBAAa,kBAAmB,SAAQ,KAAK;IACpC,eAAe,EAAE,MAAM,CAAC;gBAEnB,OAAO,GAAE,MAA8B,EAAE,IAAI,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,KAAK;CAQlF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getFullBundlerUrl.d.ts","sourceRoot":"","sources":["../../src/async-require/getFullBundlerUrl.ts"],"names":[],"mappings":"AAAA,wBAAgB,iBAAiB,IAAI,MAAM,CAY1C"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export declare function getFullBundlerUrl(_: {
|
|
2
|
-
serverScheme?: string;
|
|
3
|
-
serverHost?: string;
|
|
4
|
-
bundleEntry?: string;
|
|
5
|
-
platform?: string;
|
|
6
|
-
}): string;
|
|
7
|
-
export declare function showLoading(message: string, _type: 'load' | 'refresh'): void;
|
|
8
|
-
export declare function hideLoading(): void;
|
|
9
|
-
export declare function resetErrorOverlay(): void;
|
|
10
|
-
export declare function reload(): void;
|
|
11
|
-
export declare function getConnectionError(serverHost: string, e: Error): string;
|
|
12
|
-
export declare function handleCompileError(cause: any): void;
|
|
13
|
-
//# sourceMappingURL=hmrUtils.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hmrUtils.d.ts","sourceRoot":"","sources":["../../src/async-require/hmrUtils.ts"],"names":[],"mappings":"AAKA,wBAAgB,iBAAiB,CAAC,CAAC,EAAE;IACnC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,GAAG,MAAM,CAET;AAED,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,SAAS,QAKrE;AAED,wBAAgB,WAAW,SAE1B;AAED,wBAAgB,iBAAiB,SAGhC;AAED,wBAAgB,MAAM,SAGrB;AAED,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,MAAM,EAAE,CAAC,EAAE,KAAK,GAAG,MAAM,CAWvE;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,GAAG,QAK5C"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export declare function showLoading(message: string, type: 'load' | 'refresh'): void;
|
|
2
|
-
export declare function hideLoading(): void;
|
|
3
|
-
export declare function resetErrorOverlay(): void;
|
|
4
|
-
export declare function reload(): void;
|
|
5
|
-
export declare function getFullBundlerUrl({ serverScheme, serverHost, bundleEntry, platform, }: {
|
|
6
|
-
serverScheme: string;
|
|
7
|
-
serverHost: string;
|
|
8
|
-
bundleEntry: string;
|
|
9
|
-
platform: string;
|
|
10
|
-
}): string;
|
|
11
|
-
export declare function getConnectionError(serverHost: string, e: Error): string;
|
|
12
|
-
export declare function handleCompileError(cause: any): void;
|
|
13
|
-
//# sourceMappingURL=hmrUtils.native.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hmrUtils.native.d.ts","sourceRoot":"","sources":["../../src/async-require/hmrUtils.native.ts"],"names":[],"mappings":"AAWA,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,SAAS,QAGpE;AAED,wBAAgB,WAAW,SAG1B;AAED,wBAAgB,iBAAiB,SAIhC;AAED,wBAAgB,MAAM,SAGrB;AAED,wBAAgB,iBAAiB,CAAC,EAChC,YAAY,EACZ,UAAU,EACV,WAAW,EACX,QAAQ,GACT,EAAE;IACD,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;CAClB,GAAG,MAAM,CAKT;AAED,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,MAAM,EAAE,CAAC,EAAE,KAAK,GAAG,MAAM,CAkBvE;AAcD,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,GAAG,QAe5C"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { DOMProps } from './dom.types';
|
|
2
|
-
export interface DOMPropsInternal extends DOMProps {
|
|
3
|
-
/**
|
|
4
|
-
* Allows dynamically redirecting a component to a different source, for example prebuilt version.
|
|
5
|
-
* @internal
|
|
6
|
-
*/
|
|
7
|
-
sourceOverride?: {
|
|
8
|
-
uri: string;
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
//# sourceMappingURL=dom-internal.types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dom-internal.types.d.ts","sourceRoot":"","sources":["../../src/dom/dom-internal.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE5C,MAAM,WAAW,gBAAiB,SAAQ,QAAQ;IAChD;;;OAGG;IACH,cAAc,CAAC,EAAE;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC;CAClC"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
// Copyright 2025-present 650 Industries. All rights reserved.
|
|
2
|
-
|
|
3
|
-
#import <ExpoModulesCore/ExpoModulesCore.h>
|
|
4
|
-
#import <Expo/RCTAppDelegateUmbrella.h>
|
|
5
|
-
|
|
6
|
-
@protocol RCTHostDelegate;
|
|
7
|
-
@protocol RCTHostRuntimeDelegate;
|
|
8
|
-
|
|
9
|
-
NS_SWIFT_NAME(ExpoReactNativeFactoryObjC)
|
|
10
|
-
@interface EXReactNativeFactory : RCTReactNativeFactory <RCTHostDelegate, RCTHostRuntimeDelegate>
|
|
11
|
-
|
|
12
|
-
@end
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
// Copyright 2025-present 650 Industries. All rights reserved.
|
|
2
|
-
|
|
3
|
-
#import <Expo/ExpoReactNativeFactory.h>
|
|
4
|
-
|
|
5
|
-
#import <ExpoModulesCore/ExpoModulesCore.h>
|
|
6
|
-
#import <ExpoModulesCore/EXRuntime.h>
|
|
7
|
-
#if __has_include(<ExpoModulesCore/ExpoModulesCore-Swift.h>)
|
|
8
|
-
#import <ExpoModulesCore/ExpoModulesCore-Swift.h>
|
|
9
|
-
#else
|
|
10
|
-
#import "ExpoModulesCore-Swift.h"
|
|
11
|
-
#endif
|
|
12
|
-
#import <ReactCommon/RCTHost.h>
|
|
13
|
-
|
|
14
|
-
@implementation EXReactNativeFactory {
|
|
15
|
-
EXAppContext *_appContext;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
#pragma mark - RCTHostDelegate
|
|
19
|
-
|
|
20
|
-
// [main thread]
|
|
21
|
-
- (void)hostDidStart:(nonnull RCTHost *)host
|
|
22
|
-
{
|
|
23
|
-
// Setting the runtime delegate here doesn't feel right, but there is no other way
|
|
24
|
-
// to capture the `host:didInitializeRuntime:` method call.
|
|
25
|
-
// With the current API design we also depend that the runtime is initialized after the host started,
|
|
26
|
-
// which isn't obvious, especially they are invoked on different threads.
|
|
27
|
-
// Ideally if the current `RCTHostRuntimeDelegate` is part of `RCTHostDelegate`.
|
|
28
|
-
host.runtimeDelegate = self;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
#pragma mark - RCTHostRuntimeDelegate
|
|
32
|
-
|
|
33
|
-
// [JS thread]
|
|
34
|
-
- (void)host:(nonnull RCTHost *)host didInitializeRuntime:(jsi::Runtime &)runtime
|
|
35
|
-
{
|
|
36
|
-
_appContext = [[EXAppContext alloc] init];
|
|
37
|
-
|
|
38
|
-
// Inject and decorate the `global.expo` object
|
|
39
|
-
_appContext._runtime = [[EXRuntime alloc] initWithRuntime:runtime];
|
|
40
|
-
[_appContext setHostWrapper:[[EXHostWrapper alloc] initWithHost:host]];
|
|
41
|
-
|
|
42
|
-
[_appContext registerNativeModules];
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
@end
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from '@expo/local-build-cache-provider';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports = require('@expo/local-build-cache-provider');
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { withoutANSIColorStyles } from '@expo/log-box/utils';
|
|
2
|
-
|
|
3
|
-
export class HMRMetroBuildError extends Error {
|
|
4
|
-
public originalMessage: string;
|
|
5
|
-
|
|
6
|
-
constructor(message: string = 'Unknown Metro Error', type?: string, cause?: Error) {
|
|
7
|
-
super(message);
|
|
8
|
-
this.name = type || 'BuildError';
|
|
9
|
-
this.cause = cause;
|
|
10
|
-
this.originalMessage = [type, message].filter(Boolean).join(': ');
|
|
11
|
-
this.message = withoutANSIColorStyles(message);
|
|
12
|
-
this.stack = '';
|
|
13
|
-
}
|
|
14
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export function getFullBundlerUrl(): string {
|
|
2
|
-
const currentScript = document?.currentScript;
|
|
3
|
-
const bundleUrl = new URL(
|
|
4
|
-
currentScript && 'src' in currentScript ? currentScript.src : location.href,
|
|
5
|
-
location.href
|
|
6
|
-
);
|
|
7
|
-
|
|
8
|
-
if (!bundleUrl.searchParams.has('platform')) {
|
|
9
|
-
bundleUrl.searchParams.set('platform', process.env.EXPO_OS ?? 'web');
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
return bundleUrl.toString();
|
|
13
|
-
}
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
// Based on https://github.com/facebook/react-native/blob/9ab95dd2b5746e8323ad1d65591d5a4ec7718790/packages/react-native/Libraries/Utilities/HMRClient.js
|
|
2
|
-
|
|
3
|
-
// @ts-expect-error missing types
|
|
4
|
-
import getDevServer from 'react-native/Libraries/Core/Devtools/getDevServer';
|
|
5
|
-
import LogBox from 'react-native/Libraries/LogBox/LogBox';
|
|
6
|
-
// @ts-expect-error missing types
|
|
7
|
-
import NativeRedBox from 'react-native/Libraries/NativeModules/specs/NativeRedBox';
|
|
8
|
-
import DevSettings from 'react-native/Libraries/Utilities/DevSettings';
|
|
9
|
-
|
|
10
|
-
import { HMRMetroBuildError } from './buildErrors';
|
|
11
|
-
|
|
12
|
-
export function showLoading(message: string, type: 'load' | 'refresh') {
|
|
13
|
-
const DevLoadingView = require('react-native/Libraries/Utilities/DevLoadingView').default;
|
|
14
|
-
DevLoadingView.showMessage(message, type);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export function hideLoading() {
|
|
18
|
-
const DevLoadingView = require('react-native/Libraries/Utilities/DevLoadingView').default;
|
|
19
|
-
DevLoadingView.hide();
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export function resetErrorOverlay() {
|
|
23
|
-
dismissRedbox();
|
|
24
|
-
// @ts-expect-error clearAllLogs exists, but ts types are missing
|
|
25
|
-
LogBox.clearAllLogs();
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export function reload() {
|
|
29
|
-
// @ts-expect-error missing types
|
|
30
|
-
DevSettings.reload('Bundle Splitting – Metro disconnected');
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export function getFullBundlerUrl({
|
|
34
|
-
serverScheme,
|
|
35
|
-
serverHost,
|
|
36
|
-
bundleEntry,
|
|
37
|
-
platform,
|
|
38
|
-
}: {
|
|
39
|
-
serverScheme: string;
|
|
40
|
-
serverHost: string;
|
|
41
|
-
bundleEntry: string;
|
|
42
|
-
platform: string;
|
|
43
|
-
}): string {
|
|
44
|
-
return (
|
|
45
|
-
getDevServer().fullBundleUrl ??
|
|
46
|
-
`${serverScheme}://${serverHost}/hot?bundleEntry=${bundleEntry}&platform=${platform}`
|
|
47
|
-
);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export function getConnectionError(serverHost: string, e: Error): string {
|
|
51
|
-
let error = `Cannot connect to Expo CLI.
|
|
52
|
-
|
|
53
|
-
Try the following to fix the issue:
|
|
54
|
-
- Ensure that Expo dev server is running and available on the same network`;
|
|
55
|
-
|
|
56
|
-
if (process.env.EXPO_OS === 'android') {
|
|
57
|
-
error += `
|
|
58
|
-
- Ensure that your device/emulator is connected to your machine and has USB debugging enabled - run 'adb devices' to see a list of connected devices
|
|
59
|
-
- If you're on a physical device connected to the same machine, run 'adb reverse tcp:8081 tcp:8081' to forward requests from your device`;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
error += `
|
|
63
|
-
|
|
64
|
-
URL: ${serverHost}
|
|
65
|
-
|
|
66
|
-
Error: ${e.message}`;
|
|
67
|
-
return error;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
function dismissRedbox() {
|
|
71
|
-
if (process.env.EXPO_OS === 'ios' && NativeRedBox != null && NativeRedBox.dismiss != null) {
|
|
72
|
-
NativeRedBox.dismiss();
|
|
73
|
-
} else {
|
|
74
|
-
const NativeExceptionsManager =
|
|
75
|
-
require('react-native/Libraries/Core/NativeExceptionsManager').default;
|
|
76
|
-
NativeExceptionsManager &&
|
|
77
|
-
NativeExceptionsManager.dismissRedbox &&
|
|
78
|
-
NativeExceptionsManager.dismissRedbox();
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
export function handleCompileError(cause: any) {
|
|
83
|
-
if (cause === null) {
|
|
84
|
-
return;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
// Even if there is already a redbox, syntax errors are more important.
|
|
88
|
-
// Otherwise you risk seeing a stale runtime error while a syntax error is more recent.
|
|
89
|
-
dismissRedbox();
|
|
90
|
-
|
|
91
|
-
const LogBox = require('react-native/Libraries/LogBox/LogBox').default;
|
|
92
|
-
// The error is passed thru LogBox APIs directly to the parsing function.
|
|
93
|
-
// Won't log the error in devtools console
|
|
94
|
-
// (using throw would mangle the error message and print with ANSI
|
|
95
|
-
// because throw on native is processed as console.error)
|
|
96
|
-
LogBox.addException(new HMRMetroBuildError(cause.message, cause.type, cause.cause));
|
|
97
|
-
}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { DeviceEventEmitter } from 'react-native';
|
|
2
|
-
|
|
3
|
-
import { HMRMetroBuildError } from './buildErrors';
|
|
4
|
-
import { getFullBundlerUrl as getFullBundlerUrlHelper } from './getFullBundlerUrl';
|
|
5
|
-
|
|
6
|
-
export function getFullBundlerUrl(_: {
|
|
7
|
-
serverScheme?: string;
|
|
8
|
-
serverHost?: string;
|
|
9
|
-
bundleEntry?: string;
|
|
10
|
-
platform?: string;
|
|
11
|
-
}): string {
|
|
12
|
-
return getFullBundlerUrlHelper();
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export function showLoading(message: string, _type: 'load' | 'refresh') {
|
|
16
|
-
// Ensure events are sent so custom Fast Refresh views are shown.
|
|
17
|
-
DeviceEventEmitter.emit('devLoadingView:showMessage', {
|
|
18
|
-
message,
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export function hideLoading() {
|
|
23
|
-
DeviceEventEmitter.emit('devLoadingView:hide', {});
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export function resetErrorOverlay() {
|
|
27
|
-
// @ts-expect-error
|
|
28
|
-
globalThis.__expo_dev_resetErrors?.();
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export function reload() {
|
|
32
|
-
// "Bundle Splitting – Metro disconnected"
|
|
33
|
-
window.location.reload();
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export function getConnectionError(serverHost: string, e: Error): string {
|
|
37
|
-
return `
|
|
38
|
-
Cannot connect to Expo CLI.
|
|
39
|
-
|
|
40
|
-
Try the following to fix the issue:
|
|
41
|
-
- Ensure the Expo dev server is running and available on the same network as this device
|
|
42
|
-
|
|
43
|
-
URL: ${serverHost}
|
|
44
|
-
|
|
45
|
-
Error: ${e.message}
|
|
46
|
-
`.trim();
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export function handleCompileError(cause: any) {
|
|
50
|
-
if (!cause) {
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
throw new HMRMetroBuildError(cause.message, cause.type, cause.cause);
|
|
54
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
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
|
-
}
|