@office-iss/react-native-win32 0.0.0-canary.287 → 0.0.0-canary.289
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/.flowconfig +6 -2
- package/CHANGELOG.json +63 -1
- package/CHANGELOG.md +24 -4
- package/Libraries/Alert/Alert.d.ts +4 -1
- package/Libraries/Alert/Alert.js +3 -0
- package/Libraries/{Modal/ModalInjection.js → Alert/RCTAlertManager.js.flow} +7 -4
- package/Libraries/Animated/Animated.js +8 -37
- package/Libraries/Animated/Animated.js.flow +15 -0
- package/Libraries/Animated/AnimatedExports.js +47 -0
- package/Libraries/Animated/AnimatedExports.js.flow +48 -0
- package/Libraries/Animated/Easing.js +13 -15
- package/Libraries/Animated/createAnimatedComponent.js +24 -12
- package/Libraries/Animated/nodes/AnimatedNode.js +2 -1
- package/Libraries/Animated/nodes/AnimatedProps.js +18 -1
- package/Libraries/Animated/nodes/AnimatedValue.js +6 -2
- package/Libraries/Animated/useAnimatedValue.js +1 -3
- package/Libraries/Blob/URL.js +23 -10
- package/Libraries/Blob/URLSearchParams.js.flow +23 -0
- package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js +1 -1
- package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.win32.js +1 -1
- package/Libraries/Components/AccessibilityInfo/legacySendAccessibilityEvent.js.flow +20 -0
- package/Libraries/Components/ActivityIndicator/ActivityIndicator.js +8 -8
- package/Libraries/Components/Button.js +2 -2
- package/Libraries/Components/Button.win32.js +2 -2
- package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js +14 -100
- package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.js +64 -4
- package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroidTypes.js +138 -0
- package/Libraries/Components/Keyboard/KeyboardAvoidingView.js +7 -4
- package/Libraries/Components/LayoutConformance/LayoutConformance.js +6 -4
- package/Libraries/Components/LayoutConformance/LayoutConformanceNativeComponent.js +1 -1
- package/Libraries/Components/Pressable/Pressable.js +18 -63
- package/Libraries/Components/Pressable/Pressable.win32.js +19 -65
- package/Libraries/Components/Pressable/useAndroidRippleForView.js +2 -2
- package/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.android.js +4 -46
- package/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.js +10 -4
- package/Libraries/Components/ProgressBarAndroid/ProgressBarAndroidTypes.js +54 -0
- package/Libraries/Components/RefreshControl/RefreshControl.js +10 -7
- package/Libraries/Components/RefreshControl/__mocks__/RefreshControlMock.js +2 -1
- package/Libraries/Components/SafeAreaView/SafeAreaView.js +1 -1
- package/Libraries/Components/SafeAreaView/SafeAreaView.win32.js +1 -1
- package/Libraries/Components/ScrollView/AndroidHorizontalScrollViewNativeComponent.js +2 -4
- package/Libraries/Components/ScrollView/ScrollContentViewNativeComponent.js +2 -4
- package/Libraries/Components/ScrollView/ScrollView.js +43 -59
- package/Libraries/Components/ScrollView/ScrollViewCommands.js +1 -1
- package/Libraries/Components/ScrollView/ScrollViewNativeComponent.js +2 -4
- package/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +6 -7
- package/Libraries/Components/StatusBar/StatusBar.js +33 -22
- package/Libraries/Components/Switch/Switch.js +70 -41
- package/Libraries/Components/TextInput/AndroidTextInputNativeComponent.js +2 -4
- package/Libraries/Components/TextInput/RCTMultilineTextInputNativeComponent.js +2 -4
- package/Libraries/Components/TextInput/RCTSingelineTextInputNativeComponent.js +2 -4
- package/Libraries/Components/TextInput/RCTTextInputViewConfig.js +1 -0
- package/Libraries/Components/TextInput/Tests/TextInputTest.d.ts +2 -1
- package/Libraries/Components/TextInput/Tests/TextInputTest.js.map +1 -1
- package/Libraries/Components/TextInput/TextInput.d.ts +6 -0
- package/Libraries/Components/TextInput/TextInput.flow.js +45 -14
- package/Libraries/Components/TextInput/TextInput.js +121 -136
- package/Libraries/Components/TextInput/TextInput.win32.js +122 -137
- package/Libraries/Components/TextInput/TextInputState.js +2 -18
- package/Libraries/Components/TextInput/TextInputState.win32.js +2 -18
- package/Libraries/Components/TextInput/Win32TextInputNativeComponent.js +1 -1
- package/Libraries/Components/Touchable/Tests/TouchableWin32Test.d.ts +2 -1
- package/Libraries/Components/Touchable/Tests/TouchableWin32Test.js.map +1 -1
- package/Libraries/Components/Touchable/Touchable.js +7 -7
- package/Libraries/Components/Touchable/Touchable.win32.js +7 -7
- package/Libraries/Components/Touchable/TouchableBounce.js +1 -1
- package/Libraries/Components/Touchable/TouchableHighlight.js +35 -14
- package/Libraries/Components/Touchable/TouchableNativeFeedback.js +95 -47
- package/Libraries/Components/Touchable/TouchableNativeFeedback.win32.js +248 -43
- package/Libraries/Components/Touchable/TouchableOpacity.js +52 -10
- package/Libraries/Components/Touchable/TouchableWithoutFeedback.js +112 -59
- package/Libraries/Components/View/View.js +1 -1
- package/Libraries/Components/View/View.win32.js +1 -1
- package/Libraries/Components/View/ViewNativeComponent.js +2 -4
- package/Libraries/Components/View/ViewPropTypes.js +15 -12
- package/Libraries/Components/View/ViewPropTypes.win32.js +74 -71
- package/Libraries/Core/ReactNativeVersion.js +2 -2
- package/Libraries/Core/setUpReactDevTools.js +2 -0
- package/Libraries/Debugging/DebuggingOverlayRegistry.js +10 -7
- package/Libraries/Image/Image.android.js +1 -1
- package/Libraries/Image/Image.js.flow +27 -0
- package/Libraries/Image/ImageBackground.js +1 -1
- package/Libraries/Image/ImageProps.js +97 -30
- package/Libraries/Image/ImageTypes.flow.js +16 -6
- package/Libraries/Image/ImageViewNativeComponent.js +3 -5
- package/Libraries/Image/Tests/ImageWin32Test.d.ts +2 -1
- package/Libraries/Image/Tests/ImageWin32Test.js.map +1 -1
- package/Libraries/Image/TextInlineImageNativeComponent.js +2 -4
- package/Libraries/Interaction/InteractionManager.js +9 -1
- package/Libraries/Interaction/PanResponder.js +11 -11
- package/Libraries/Interaction/TaskQueue.js +3 -2
- package/Libraries/Lists/FlatList.js +8 -7
- package/Libraries/LogBox/LogBox.js +1 -1
- package/Libraries/Modal/Modal.js +30 -4
- package/Libraries/NativeComponent/BaseViewConfig.js.flow +14 -0
- package/Libraries/NativeComponent/NativeComponentRegistry.js +1 -1
- package/Libraries/Network/RCTNetworking.js.flow +44 -0
- package/Libraries/Network/XMLHttpRequest_new.js +3 -0
- package/Libraries/Network/XMLHttpRequest_old.js +3 -0
- package/Libraries/Pressability/HoverState.js +1 -0
- package/Libraries/Pressability/HoverState.win32.js +1 -0
- package/Libraries/Pressability/Pressability.js +2 -2
- package/Libraries/Pressability/Pressability.win32.js +3 -3
- package/Libraries/ReactNative/AppRegistry.flow.js +49 -0
- package/Libraries/ReactNative/AppRegistry.js +2 -322
- package/Libraries/ReactNative/AppRegistry.js.flow +23 -0
- package/Libraries/ReactNative/AppRegistryImpl.js +316 -0
- package/Libraries/ReactNative/FabricUIManager.js +5 -3
- package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricHostComponent.js +7 -5
- package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstance.js +1 -4
- package/Libraries/ReactNative/RendererImplementation.js +3 -5
- package/Libraries/ReactNative/requireNativeComponent.js +1 -1
- package/Libraries/ReactPrivate/ReactNativePrivateInterface.js +12 -0
- package/Libraries/Renderer/shims/ReactNativeTypes.js +39 -91
- package/Libraries/StyleSheet/PlatformColorValueTypes.js.flow +22 -0
- package/Libraries/StyleSheet/PlatformColorValueTypesIOS.js +6 -0
- package/Libraries/StyleSheet/StyleSheet.js +5 -197
- package/Libraries/StyleSheet/StyleSheet.js.flow +166 -0
- package/Libraries/StyleSheet/{StyleSheet.win32.js → StyleSheetExports.js} +2 -151
- package/Libraries/StyleSheet/StyleSheetExports.js.flow +110 -0
- package/Libraries/StyleSheet/StyleSheetTypes.js +42 -18
- package/Libraries/Text/Text.d.ts +1 -1
- package/Libraries/Text/Text.js +3 -1
- package/Libraries/Text/Text.win32.js +3 -1
- package/Libraries/Text/TextNativeComponent.js +1 -1
- package/Libraries/Text/TextNativeComponent.win32.js +1 -1
- package/Libraries/Text/TextProps.js +124 -84
- package/Libraries/Text/TextProps.win32.js +124 -84
- package/Libraries/Types/CodegenTypesNamespace.d.ts +45 -0
- package/Libraries/Types/CodegenTypesNamespace.js +14 -0
- package/Libraries/Types/CoreEventTypes.js +1 -1
- package/Libraries/Types/CoreEventTypes.win32.js +1 -1
- package/Libraries/Types/ReactDevToolsTypes.js +4 -8
- package/Libraries/Utilities/BackHandler.js.flow +25 -0
- package/Libraries/Utilities/DevSettings.js +14 -0
- package/Libraries/Utilities/Dimensions.js +5 -0
- package/Libraries/Utilities/Dimensions.win32.js +5 -0
- package/{flow/Position.js → Libraries/Utilities/Platform.js.flow} +3 -6
- package/Libraries/Utilities/PlatformTypes.js +97 -7
- package/Libraries/Utilities/codegenNativeCommands.d.ts +18 -0
- package/Libraries/Utilities/codegenNativeComponent.d.ts +26 -0
- package/Libraries/Utilities/codegenNativeComponent.js +1 -1
- package/Libraries/__flowtests__/ReactNativeTypes-flowtest.js +2 -4
- package/Libraries/vendor/emitter/EventEmitter.js +6 -2
- package/flow/global.js +1 -0
- package/flow/jest.js +4 -2
- package/index.js +47 -43
- package/index.win32.js +63 -59
- package/overrides.json +27 -35
- package/package.json +18 -18
- package/src/private/animated/NativeAnimatedHelper.js +18 -7
- package/src/private/animated/NativeAnimatedHelper.win32.js +18 -7
- package/src/private/animated/createAnimatedPropsHook.js +34 -15
- package/src/private/components/HScrollViewNativeComponents.js +1 -1
- package/src/private/components/VScrollViewNativeComponents.js +1 -1
- package/src/private/featureflags/ReactNativeFeatureFlags.js +24 -36
- package/src/private/featureflags/ReactNativeFeatureFlagsBase.js +9 -1
- package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +4 -4
- package/src/private/inspector/getInspectorDataForViewAtPoint.js +2 -4
- package/src/private/setup/setUpDOM.js +36 -1
- package/src/private/specs_DEPRECATED/components/ActivityIndicatorViewNativeComponent.js +1 -1
- package/src/private/specs_DEPRECATED/components/AndroidDrawerLayoutNativeComponent.js +1 -1
- package/src/private/specs_DEPRECATED/components/AndroidHorizontalScrollContentViewNativeComponent.js +1 -1
- package/src/private/specs_DEPRECATED/components/AndroidSwipeRefreshLayoutNativeComponent.js +1 -1
- package/src/private/specs_DEPRECATED/components/AndroidSwitchNativeComponent.js +1 -1
- package/src/private/specs_DEPRECATED/components/DebuggingOverlayNativeComponent.js +1 -1
- package/src/private/specs_DEPRECATED/components/ProgressBarAndroidNativeComponent.js +1 -1
- package/src/private/specs_DEPRECATED/components/PullToRefreshViewNativeComponent.js +1 -1
- package/src/private/specs_DEPRECATED/components/RCTInputAccessoryViewNativeComponent.js +1 -1
- package/src/private/specs_DEPRECATED/components/RCTModalHostViewNativeComponent.js +1 -1
- package/src/private/specs_DEPRECATED/components/RCTSafeAreaViewNativeComponent.js +1 -1
- package/src/private/specs_DEPRECATED/components/SwitchNativeComponent.js +1 -1
- package/src/private/specs_DEPRECATED/components/UnimplementedNativeViewNativeComponent.js +1 -1
- package/src/private/types/HostComponent.js +16 -0
- package/src/private/types/HostInstance.js +50 -0
- package/src/private/webapis/dom/nodes/ReactNativeDocument.js +1 -0
- package/src/private/webapis/dom/nodes/ReactNativeElement.js +40 -32
- package/src/private/webapis/dom/nodes/ReadOnlyCharacterData.js +1 -1
- package/src/private/webapis/dom/nodes/ReadOnlyElement.js +1 -1
- package/src/private/webapis/dom/nodes/ReadOnlyNode.js +6 -19
- package/src/private/webapis/dom/nodes/internals/NodeInternals.js +6 -0
- package/src/private/webapis/intersectionobserver/IntersectionObserver.js +4 -4
- package/src/private/webapis/mutationobserver/MutationObserver.js +9 -9
- package/src/private/webapis/performance/PerformanceObserver.js +6 -6
- package/src/types/globals.d.ts +628 -0
- package/src/types/third_party/event-target-shim.d.ts +392 -0
- package/src-win/Libraries/Components/TextInput/Tests/TextInputTest.tsx +7 -7
- package/src-win/Libraries/Components/Touchable/Tests/TouchableWin32Test.tsx +3 -3
- package/src-win/Libraries/Image/Tests/ImageWin32Test.tsx +1 -1
- package/src-win/Libraries/Text/Text.d.ts +1 -1
- package/types/index.d.ts +5 -52
- package/types/modules/globals.d.ts +0 -599
|
@@ -8,333 +8,13 @@
|
|
|
8
8
|
* @format
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import type {ViewStyleProp} from '../StyleSheet/StyleSheet';
|
|
12
|
-
import type {RootTag} from '../Types/RootTagTypes';
|
|
13
|
-
import type {IPerformanceLogger} from '../Utilities/createPerformanceLogger';
|
|
14
|
-
import type {DisplayModeType} from './DisplayMode';
|
|
15
|
-
|
|
16
|
-
import BugReporting from '../BugReporting/BugReporting';
|
|
17
11
|
import registerCallableModule from '../Core/registerCallableModule';
|
|
18
|
-
import createPerformanceLogger from '../Utilities/createPerformanceLogger';
|
|
19
|
-
import infoLog from '../Utilities/infoLog';
|
|
20
|
-
import SceneTracker from '../Utilities/SceneTracker';
|
|
21
|
-
import {coerceDisplayMode} from './DisplayMode';
|
|
22
|
-
import HeadlessJsTaskError from './HeadlessJsTaskError';
|
|
23
|
-
import NativeHeadlessJsTaskSupport from './NativeHeadlessJsTaskSupport';
|
|
24
|
-
import renderApplication from './renderApplication';
|
|
25
|
-
import {unmountComponentAtNodeAndRemoveContainer} from './RendererProxy';
|
|
26
|
-
import invariant from 'invariant';
|
|
27
|
-
|
|
28
|
-
type Task = (taskData: any) => Promise<void>;
|
|
29
|
-
export type TaskProvider = () => Task;
|
|
30
|
-
type TaskCanceller = () => void;
|
|
31
|
-
type TaskCancelProvider = () => TaskCanceller;
|
|
32
|
-
|
|
33
|
-
export type ComponentProvider = () => React.ComponentType<any>;
|
|
34
|
-
export type ComponentProviderInstrumentationHook = (
|
|
35
|
-
component_: ComponentProvider,
|
|
36
|
-
scopedPerformanceLogger: IPerformanceLogger,
|
|
37
|
-
) => React.ComponentType<any>;
|
|
38
|
-
export type AppConfig = {
|
|
39
|
-
appKey: string,
|
|
40
|
-
component?: ComponentProvider,
|
|
41
|
-
run?: Runnable,
|
|
42
|
-
section?: boolean,
|
|
43
|
-
...
|
|
44
|
-
};
|
|
45
|
-
type AppParameters = {
|
|
46
|
-
initialProps: $ReadOnly<{[string]: mixed, ...}>,
|
|
47
|
-
rootTag: RootTag,
|
|
48
|
-
fabric?: boolean,
|
|
49
|
-
};
|
|
50
|
-
export type Runnable = (
|
|
51
|
-
appParameters: AppParameters,
|
|
52
|
-
displayMode: DisplayModeType,
|
|
53
|
-
) => void;
|
|
54
|
-
export type Runnables = {[appKey: string]: Runnable};
|
|
55
|
-
export type Registry = {
|
|
56
|
-
sections: $ReadOnlyArray<string>,
|
|
57
|
-
runnables: Runnables,
|
|
58
|
-
...
|
|
59
|
-
};
|
|
60
|
-
export type WrapperComponentProvider = (
|
|
61
|
-
appParameters: Object,
|
|
62
|
-
) => React.ComponentType<any>;
|
|
63
|
-
export type RootViewStyleProvider = (appParameters: Object) => ViewStyleProp;
|
|
64
|
-
|
|
65
|
-
const runnables: Runnables = {};
|
|
66
|
-
let runCount = 1;
|
|
67
|
-
const sections: Runnables = {};
|
|
68
|
-
const taskProviders: Map<string, TaskProvider> = new Map();
|
|
69
|
-
const taskCancelProviders: Map<string, TaskCancelProvider> = new Map();
|
|
70
|
-
let componentProviderInstrumentationHook: ComponentProviderInstrumentationHook =
|
|
71
|
-
(component: ComponentProvider) => component();
|
|
72
|
-
|
|
73
|
-
let wrapperComponentProvider: ?WrapperComponentProvider;
|
|
74
|
-
let rootViewStyleProvider: ?RootViewStyleProvider;
|
|
75
|
-
|
|
76
12
|
/**
|
|
77
13
|
* `AppRegistry` is the JavaScript entry point to running all React Native apps.
|
|
78
14
|
*
|
|
79
15
|
* See https://reactnative.dev/docs/appregistry
|
|
80
16
|
*/
|
|
81
|
-
|
|
82
|
-
setWrapperComponentProvider(provider: WrapperComponentProvider) {
|
|
83
|
-
wrapperComponentProvider = provider;
|
|
84
|
-
},
|
|
85
|
-
|
|
86
|
-
setRootViewStyleProvider(provider: RootViewStyleProvider) {
|
|
87
|
-
rootViewStyleProvider = provider;
|
|
88
|
-
},
|
|
89
|
-
|
|
90
|
-
registerConfig(config: Array<AppConfig>): void {
|
|
91
|
-
config.forEach(appConfig => {
|
|
92
|
-
if (appConfig.run) {
|
|
93
|
-
AppRegistry.registerRunnable(appConfig.appKey, appConfig.run);
|
|
94
|
-
} else {
|
|
95
|
-
invariant(
|
|
96
|
-
appConfig.component != null,
|
|
97
|
-
'AppRegistry.registerConfig(...): Every config is expected to set ' +
|
|
98
|
-
'either `run` or `component`, but `%s` has neither.',
|
|
99
|
-
appConfig.appKey,
|
|
100
|
-
);
|
|
101
|
-
AppRegistry.registerComponent(
|
|
102
|
-
appConfig.appKey,
|
|
103
|
-
appConfig.component,
|
|
104
|
-
appConfig.section,
|
|
105
|
-
);
|
|
106
|
-
}
|
|
107
|
-
});
|
|
108
|
-
},
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
* Registers an app's root component.
|
|
112
|
-
*
|
|
113
|
-
* See https://reactnative.dev/docs/appregistry#registercomponent
|
|
114
|
-
*/
|
|
115
|
-
registerComponent(
|
|
116
|
-
appKey: string,
|
|
117
|
-
componentProvider: ComponentProvider,
|
|
118
|
-
section?: boolean,
|
|
119
|
-
): string {
|
|
120
|
-
const scopedPerformanceLogger = createPerformanceLogger();
|
|
121
|
-
runnables[appKey] = (appParameters, displayMode) => {
|
|
122
|
-
renderApplication(
|
|
123
|
-
componentProviderInstrumentationHook(
|
|
124
|
-
componentProvider,
|
|
125
|
-
scopedPerformanceLogger,
|
|
126
|
-
),
|
|
127
|
-
appParameters.initialProps,
|
|
128
|
-
appParameters.rootTag,
|
|
129
|
-
wrapperComponentProvider && wrapperComponentProvider(appParameters),
|
|
130
|
-
rootViewStyleProvider && rootViewStyleProvider(appParameters),
|
|
131
|
-
appParameters.fabric,
|
|
132
|
-
scopedPerformanceLogger,
|
|
133
|
-
appKey === 'LogBox', // is logbox
|
|
134
|
-
appKey,
|
|
135
|
-
displayMode,
|
|
136
|
-
);
|
|
137
|
-
};
|
|
138
|
-
if (section) {
|
|
139
|
-
sections[appKey] = runnables[appKey];
|
|
140
|
-
}
|
|
141
|
-
return appKey;
|
|
142
|
-
},
|
|
143
|
-
|
|
144
|
-
registerRunnable(appKey: string, run: Runnable): string {
|
|
145
|
-
runnables[appKey] = run;
|
|
146
|
-
return appKey;
|
|
147
|
-
},
|
|
148
|
-
|
|
149
|
-
registerSection(appKey: string, component: ComponentProvider): void {
|
|
150
|
-
AppRegistry.registerComponent(appKey, component, true);
|
|
151
|
-
},
|
|
152
|
-
|
|
153
|
-
getAppKeys(): $ReadOnlyArray<string> {
|
|
154
|
-
return Object.keys(runnables);
|
|
155
|
-
},
|
|
156
|
-
|
|
157
|
-
getSectionKeys(): $ReadOnlyArray<string> {
|
|
158
|
-
return Object.keys(sections);
|
|
159
|
-
},
|
|
160
|
-
|
|
161
|
-
getSections(): Runnables {
|
|
162
|
-
return {
|
|
163
|
-
...sections,
|
|
164
|
-
};
|
|
165
|
-
},
|
|
166
|
-
|
|
167
|
-
getRunnable(appKey: string): ?Runnable {
|
|
168
|
-
return runnables[appKey];
|
|
169
|
-
},
|
|
170
|
-
|
|
171
|
-
getRegistry(): Registry {
|
|
172
|
-
return {
|
|
173
|
-
sections: AppRegistry.getSectionKeys(),
|
|
174
|
-
runnables: {...runnables},
|
|
175
|
-
};
|
|
176
|
-
},
|
|
177
|
-
|
|
178
|
-
setComponentProviderInstrumentationHook(
|
|
179
|
-
hook: ComponentProviderInstrumentationHook,
|
|
180
|
-
) {
|
|
181
|
-
componentProviderInstrumentationHook = hook;
|
|
182
|
-
},
|
|
183
|
-
|
|
184
|
-
/**
|
|
185
|
-
* Loads the JavaScript bundle and runs the app.
|
|
186
|
-
*
|
|
187
|
-
* See https://reactnative.dev/docs/appregistry#runapplication
|
|
188
|
-
*/
|
|
189
|
-
runApplication(
|
|
190
|
-
appKey: string,
|
|
191
|
-
appParameters: AppParameters,
|
|
192
|
-
displayMode?: number,
|
|
193
|
-
): void {
|
|
194
|
-
if (appKey !== 'LogBox') {
|
|
195
|
-
const logParams = __DEV__ ? ` with ${JSON.stringify(appParameters)}` : '';
|
|
196
|
-
const msg = `Running "${appKey}"${logParams}`;
|
|
197
|
-
infoLog(msg);
|
|
198
|
-
BugReporting.addSource(
|
|
199
|
-
'AppRegistry.runApplication' + runCount++,
|
|
200
|
-
() => msg,
|
|
201
|
-
);
|
|
202
|
-
}
|
|
203
|
-
invariant(
|
|
204
|
-
runnables[appKey],
|
|
205
|
-
`"${appKey}" has not been registered. This can happen if:\n` +
|
|
206
|
-
'* Metro (the local dev server) is run from the wrong folder. ' +
|
|
207
|
-
'Check if Metro is running, stop it and restart it in the current project.\n' +
|
|
208
|
-
"* A module failed to load due to an error and `AppRegistry.registerComponent` wasn't called.",
|
|
209
|
-
);
|
|
210
|
-
|
|
211
|
-
SceneTracker.setActiveScene({name: appKey});
|
|
212
|
-
runnables[appKey](appParameters, coerceDisplayMode(displayMode));
|
|
213
|
-
},
|
|
214
|
-
|
|
215
|
-
/**
|
|
216
|
-
* Update initial props for a surface that's already rendered
|
|
217
|
-
*/
|
|
218
|
-
setSurfaceProps(
|
|
219
|
-
appKey: string,
|
|
220
|
-
appParameters: Object,
|
|
221
|
-
displayMode?: number,
|
|
222
|
-
): void {
|
|
223
|
-
if (appKey !== 'LogBox') {
|
|
224
|
-
const msg =
|
|
225
|
-
'Updating props for Surface "' +
|
|
226
|
-
appKey +
|
|
227
|
-
'" with ' +
|
|
228
|
-
JSON.stringify(appParameters);
|
|
229
|
-
infoLog(msg);
|
|
230
|
-
BugReporting.addSource(
|
|
231
|
-
'AppRegistry.setSurfaceProps' + runCount++,
|
|
232
|
-
() => msg,
|
|
233
|
-
);
|
|
234
|
-
}
|
|
235
|
-
invariant(
|
|
236
|
-
runnables[appKey],
|
|
237
|
-
`"${appKey}" has not been registered. This can happen if:\n` +
|
|
238
|
-
'* Metro (the local dev server) is run from the wrong folder. ' +
|
|
239
|
-
'Check if Metro is running, stop it and restart it in the current project.\n' +
|
|
240
|
-
"* A module failed to load due to an error and `AppRegistry.registerComponent` wasn't called.",
|
|
241
|
-
);
|
|
242
|
-
|
|
243
|
-
runnables[appKey](appParameters, coerceDisplayMode(displayMode));
|
|
244
|
-
},
|
|
245
|
-
|
|
246
|
-
/**
|
|
247
|
-
* Stops an application when a view should be destroyed.
|
|
248
|
-
*
|
|
249
|
-
* See https://reactnative.dev/docs/appregistry#unmountapplicationcomponentatroottag
|
|
250
|
-
*/
|
|
251
|
-
unmountApplicationComponentAtRootTag(rootTag: RootTag): void {
|
|
252
|
-
unmountComponentAtNodeAndRemoveContainer(rootTag);
|
|
253
|
-
},
|
|
254
|
-
|
|
255
|
-
/**
|
|
256
|
-
* Register a headless task. A headless task is a bit of code that runs without a UI.
|
|
257
|
-
*
|
|
258
|
-
* See https://reactnative.dev/docs/appregistry#registerheadlesstask
|
|
259
|
-
*/
|
|
260
|
-
registerHeadlessTask(taskKey: string, taskProvider: TaskProvider): void {
|
|
261
|
-
// $FlowFixMe[object-this-reference]
|
|
262
|
-
this.registerCancellableHeadlessTask(taskKey, taskProvider, () => () => {
|
|
263
|
-
/* Cancel is no-op */
|
|
264
|
-
});
|
|
265
|
-
},
|
|
266
|
-
|
|
267
|
-
/**
|
|
268
|
-
* Register a cancellable headless task. A headless task is a bit of code that runs without a UI.
|
|
269
|
-
*
|
|
270
|
-
* See https://reactnative.dev/docs/appregistry#registercancellableheadlesstask
|
|
271
|
-
*/
|
|
272
|
-
registerCancellableHeadlessTask(
|
|
273
|
-
taskKey: string,
|
|
274
|
-
taskProvider: TaskProvider,
|
|
275
|
-
taskCancelProvider: TaskCancelProvider,
|
|
276
|
-
): void {
|
|
277
|
-
if (taskProviders.has(taskKey)) {
|
|
278
|
-
console.warn(
|
|
279
|
-
`registerHeadlessTask or registerCancellableHeadlessTask called multiple times for same key '${taskKey}'`,
|
|
280
|
-
);
|
|
281
|
-
}
|
|
282
|
-
taskProviders.set(taskKey, taskProvider);
|
|
283
|
-
taskCancelProviders.set(taskKey, taskCancelProvider);
|
|
284
|
-
},
|
|
285
|
-
|
|
286
|
-
/**
|
|
287
|
-
* Only called from native code. Starts a headless task.
|
|
288
|
-
*
|
|
289
|
-
* See https://reactnative.dev/docs/appregistry#startheadlesstask
|
|
290
|
-
*/
|
|
291
|
-
startHeadlessTask(taskId: number, taskKey: string, data: any): void {
|
|
292
|
-
const taskProvider = taskProviders.get(taskKey);
|
|
293
|
-
if (!taskProvider) {
|
|
294
|
-
console.warn(`No task registered for key ${taskKey}`);
|
|
295
|
-
if (NativeHeadlessJsTaskSupport) {
|
|
296
|
-
NativeHeadlessJsTaskSupport.notifyTaskFinished(taskId);
|
|
297
|
-
}
|
|
298
|
-
return;
|
|
299
|
-
}
|
|
300
|
-
taskProvider()(data)
|
|
301
|
-
.then(() => {
|
|
302
|
-
if (NativeHeadlessJsTaskSupport) {
|
|
303
|
-
NativeHeadlessJsTaskSupport.notifyTaskFinished(taskId);
|
|
304
|
-
}
|
|
305
|
-
})
|
|
306
|
-
.catch(reason => {
|
|
307
|
-
console.error(reason);
|
|
308
|
-
|
|
309
|
-
if (
|
|
310
|
-
NativeHeadlessJsTaskSupport &&
|
|
311
|
-
reason instanceof HeadlessJsTaskError
|
|
312
|
-
) {
|
|
313
|
-
// $FlowFixMe[unused-promise]
|
|
314
|
-
NativeHeadlessJsTaskSupport.notifyTaskRetry(taskId).then(
|
|
315
|
-
retryPosted => {
|
|
316
|
-
if (!retryPosted) {
|
|
317
|
-
NativeHeadlessJsTaskSupport.notifyTaskFinished(taskId);
|
|
318
|
-
}
|
|
319
|
-
},
|
|
320
|
-
);
|
|
321
|
-
}
|
|
322
|
-
});
|
|
323
|
-
},
|
|
324
|
-
|
|
325
|
-
/**
|
|
326
|
-
* Only called from native code. Cancels a headless task.
|
|
327
|
-
*
|
|
328
|
-
* See https://reactnative.dev/docs/appregistry#cancelheadlesstask
|
|
329
|
-
*/
|
|
330
|
-
cancelHeadlessTask(taskId: number, taskKey: string): void {
|
|
331
|
-
const taskCancelProvider = taskCancelProviders.get(taskKey);
|
|
332
|
-
if (!taskCancelProvider) {
|
|
333
|
-
throw new Error(`No task canceller registered for key '${taskKey}'`);
|
|
334
|
-
}
|
|
335
|
-
taskCancelProvider()();
|
|
336
|
-
},
|
|
337
|
-
};
|
|
17
|
+
import * as AppRegistry from './AppRegistryImpl';
|
|
338
18
|
|
|
339
19
|
// Register LogBox as a default surface
|
|
340
20
|
AppRegistry.registerComponent('LogBox', () => {
|
|
@@ -357,4 +37,4 @@ global.RN$SurfaceRegistry = {
|
|
|
357
37
|
|
|
358
38
|
registerCallableModule('AppRegistry', AppRegistry);
|
|
359
39
|
|
|
360
|
-
export
|
|
40
|
+
export {AppRegistry};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @flow
|
|
8
|
+
* @format
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
export type {
|
|
12
|
+
TaskProvider,
|
|
13
|
+
ComponentProvider,
|
|
14
|
+
ComponentProviderInstrumentationHook,
|
|
15
|
+
AppConfig,
|
|
16
|
+
Runnable,
|
|
17
|
+
Runnables,
|
|
18
|
+
Registry,
|
|
19
|
+
WrapperComponentProvider,
|
|
20
|
+
RootViewStyleProvider,
|
|
21
|
+
} from './AppRegistry.flow';
|
|
22
|
+
|
|
23
|
+
export * as AppRegistry from './AppRegistryImpl';
|
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @flow
|
|
8
|
+
* @format
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import type {RootTag} from '../Types/RootTagTypes';
|
|
12
|
+
import type {
|
|
13
|
+
AppConfig,
|
|
14
|
+
AppParameters,
|
|
15
|
+
ComponentProvider,
|
|
16
|
+
ComponentProviderInstrumentationHook,
|
|
17
|
+
Registry,
|
|
18
|
+
RootViewStyleProvider,
|
|
19
|
+
Runnable,
|
|
20
|
+
Runnables,
|
|
21
|
+
TaskProvider,
|
|
22
|
+
WrapperComponentProvider,
|
|
23
|
+
} from './AppRegistry.flow';
|
|
24
|
+
|
|
25
|
+
import BugReporting from '../BugReporting/BugReporting';
|
|
26
|
+
import createPerformanceLogger from '../Utilities/createPerformanceLogger';
|
|
27
|
+
import infoLog from '../Utilities/infoLog';
|
|
28
|
+
import SceneTracker from '../Utilities/SceneTracker';
|
|
29
|
+
import {coerceDisplayMode} from './DisplayMode';
|
|
30
|
+
import HeadlessJsTaskError from './HeadlessJsTaskError';
|
|
31
|
+
import NativeHeadlessJsTaskSupport from './NativeHeadlessJsTaskSupport';
|
|
32
|
+
import renderApplication from './renderApplication';
|
|
33
|
+
import {unmountComponentAtNodeAndRemoveContainer} from './RendererProxy';
|
|
34
|
+
import invariant from 'invariant';
|
|
35
|
+
|
|
36
|
+
type TaskCanceller = () => void;
|
|
37
|
+
type TaskCancelProvider = () => TaskCanceller;
|
|
38
|
+
|
|
39
|
+
const runnables: Runnables = {};
|
|
40
|
+
let runCount = 1;
|
|
41
|
+
const sections: Runnables = {};
|
|
42
|
+
const taskProviders: Map<string, TaskProvider> = new Map();
|
|
43
|
+
const taskCancelProviders: Map<string, TaskCancelProvider> = new Map();
|
|
44
|
+
let componentProviderInstrumentationHook: ComponentProviderInstrumentationHook =
|
|
45
|
+
(component: ComponentProvider) => component();
|
|
46
|
+
|
|
47
|
+
let wrapperComponentProvider: ?WrapperComponentProvider;
|
|
48
|
+
let rootViewStyleProvider: ?RootViewStyleProvider;
|
|
49
|
+
|
|
50
|
+
export function setWrapperComponentProvider(
|
|
51
|
+
provider: WrapperComponentProvider,
|
|
52
|
+
) {
|
|
53
|
+
wrapperComponentProvider = provider;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export function setRootViewStyleProvider(provider: RootViewStyleProvider) {
|
|
57
|
+
rootViewStyleProvider = provider;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export function registerConfig(config: Array<AppConfig>): void {
|
|
61
|
+
config.forEach(appConfig => {
|
|
62
|
+
if (appConfig.run) {
|
|
63
|
+
registerRunnable(appConfig.appKey, appConfig.run);
|
|
64
|
+
} else {
|
|
65
|
+
invariant(
|
|
66
|
+
appConfig.component != null,
|
|
67
|
+
'AppRegistry.registerConfig(...): Every config is expected to set ' +
|
|
68
|
+
'either `run` or `component`, but `%s` has neither.',
|
|
69
|
+
appConfig.appKey,
|
|
70
|
+
);
|
|
71
|
+
registerComponent(
|
|
72
|
+
appConfig.appKey,
|
|
73
|
+
appConfig.component,
|
|
74
|
+
appConfig.section,
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Registers an app's root component.
|
|
82
|
+
*
|
|
83
|
+
* See https://reactnative.dev/docs/appregistry#registercomponent
|
|
84
|
+
*/
|
|
85
|
+
export function registerComponent(
|
|
86
|
+
appKey: string,
|
|
87
|
+
componentProvider: ComponentProvider,
|
|
88
|
+
section?: boolean,
|
|
89
|
+
): string {
|
|
90
|
+
const scopedPerformanceLogger = createPerformanceLogger();
|
|
91
|
+
runnables[appKey] = (appParameters, displayMode) => {
|
|
92
|
+
renderApplication(
|
|
93
|
+
componentProviderInstrumentationHook(
|
|
94
|
+
componentProvider,
|
|
95
|
+
scopedPerformanceLogger,
|
|
96
|
+
),
|
|
97
|
+
appParameters.initialProps,
|
|
98
|
+
appParameters.rootTag,
|
|
99
|
+
wrapperComponentProvider && wrapperComponentProvider(appParameters),
|
|
100
|
+
rootViewStyleProvider && rootViewStyleProvider(appParameters),
|
|
101
|
+
appParameters.fabric,
|
|
102
|
+
scopedPerformanceLogger,
|
|
103
|
+
appKey === 'LogBox', // is logbox
|
|
104
|
+
appKey,
|
|
105
|
+
displayMode,
|
|
106
|
+
);
|
|
107
|
+
};
|
|
108
|
+
if (section) {
|
|
109
|
+
sections[appKey] = runnables[appKey];
|
|
110
|
+
}
|
|
111
|
+
return appKey;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export function registerRunnable(appKey: string, run: Runnable): string {
|
|
115
|
+
runnables[appKey] = run;
|
|
116
|
+
return appKey;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export function registerSection(
|
|
120
|
+
appKey: string,
|
|
121
|
+
component: ComponentProvider,
|
|
122
|
+
): void {
|
|
123
|
+
registerComponent(appKey, component, true);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export function getAppKeys(): $ReadOnlyArray<string> {
|
|
127
|
+
return Object.keys(runnables);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export function getSectionKeys(): $ReadOnlyArray<string> {
|
|
131
|
+
return Object.keys(sections);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export function getSections(): Runnables {
|
|
135
|
+
return {
|
|
136
|
+
...sections,
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export function getRunnable(appKey: string): ?Runnable {
|
|
141
|
+
return runnables[appKey];
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
export function getRegistry(): Registry {
|
|
145
|
+
return {
|
|
146
|
+
sections: getSectionKeys(),
|
|
147
|
+
runnables: {...runnables},
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export function setComponentProviderInstrumentationHook(
|
|
152
|
+
hook: ComponentProviderInstrumentationHook,
|
|
153
|
+
) {
|
|
154
|
+
componentProviderInstrumentationHook = hook;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Loads the JavaScript bundle and runs the app.
|
|
159
|
+
*
|
|
160
|
+
* See https://reactnative.dev/docs/appregistry#runapplication
|
|
161
|
+
*/
|
|
162
|
+
export function runApplication(
|
|
163
|
+
appKey: string,
|
|
164
|
+
appParameters: AppParameters,
|
|
165
|
+
displayMode?: number,
|
|
166
|
+
): void {
|
|
167
|
+
if (appKey !== 'LogBox') {
|
|
168
|
+
const logParams = __DEV__ ? ` with ${JSON.stringify(appParameters)}` : '';
|
|
169
|
+
const msg = `Running "${appKey}"${logParams}`;
|
|
170
|
+
infoLog(msg);
|
|
171
|
+
BugReporting.addSource(
|
|
172
|
+
'AppRegistry.runApplication' + runCount++,
|
|
173
|
+
() => msg,
|
|
174
|
+
);
|
|
175
|
+
}
|
|
176
|
+
invariant(
|
|
177
|
+
runnables[appKey],
|
|
178
|
+
`"${appKey}" has not been registered. This can happen if:\n` +
|
|
179
|
+
'* Metro (the local dev server) is run from the wrong folder. ' +
|
|
180
|
+
'Check if Metro is running, stop it and restart it in the current project.\n' +
|
|
181
|
+
"* A module failed to load due to an error and `AppRegistry.registerComponent` wasn't called.",
|
|
182
|
+
);
|
|
183
|
+
|
|
184
|
+
SceneTracker.setActiveScene({name: appKey});
|
|
185
|
+
runnables[appKey](appParameters, coerceDisplayMode(displayMode));
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Update initial props for a surface that's already rendered
|
|
190
|
+
*/
|
|
191
|
+
export function setSurfaceProps(
|
|
192
|
+
appKey: string,
|
|
193
|
+
appParameters: Object,
|
|
194
|
+
displayMode?: number,
|
|
195
|
+
): void {
|
|
196
|
+
if (appKey !== 'LogBox') {
|
|
197
|
+
const msg =
|
|
198
|
+
'Updating props for Surface "' +
|
|
199
|
+
appKey +
|
|
200
|
+
'" with ' +
|
|
201
|
+
JSON.stringify(appParameters);
|
|
202
|
+
infoLog(msg);
|
|
203
|
+
BugReporting.addSource(
|
|
204
|
+
'AppRegistry.setSurfaceProps' + runCount++,
|
|
205
|
+
() => msg,
|
|
206
|
+
);
|
|
207
|
+
}
|
|
208
|
+
invariant(
|
|
209
|
+
runnables[appKey],
|
|
210
|
+
`"${appKey}" has not been registered. This can happen if:\n` +
|
|
211
|
+
'* Metro (the local dev server) is run from the wrong folder. ' +
|
|
212
|
+
'Check if Metro is running, stop it and restart it in the current project.\n' +
|
|
213
|
+
"* A module failed to load due to an error and `AppRegistry.registerComponent` wasn't called.",
|
|
214
|
+
);
|
|
215
|
+
|
|
216
|
+
runnables[appKey](appParameters, coerceDisplayMode(displayMode));
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* Stops an application when a view should be destroyed.
|
|
221
|
+
*
|
|
222
|
+
* See https://reactnative.dev/docs/appregistry#unmountapplicationcomponentatroottag
|
|
223
|
+
*/
|
|
224
|
+
export function unmountApplicationComponentAtRootTag(rootTag: RootTag): void {
|
|
225
|
+
unmountComponentAtNodeAndRemoveContainer(rootTag);
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* Register a headless task. A headless task is a bit of code that runs without a UI.
|
|
230
|
+
*
|
|
231
|
+
* See https://reactnative.dev/docs/appregistry#registerheadlesstask
|
|
232
|
+
*/
|
|
233
|
+
export function registerHeadlessTask(
|
|
234
|
+
taskKey: string,
|
|
235
|
+
taskProvider: TaskProvider,
|
|
236
|
+
): void {
|
|
237
|
+
// $FlowFixMe[object-this-reference]
|
|
238
|
+
registerCancellableHeadlessTask(taskKey, taskProvider, () => () => {
|
|
239
|
+
/* Cancel is no-op */
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* Register a cancellable headless task. A headless task is a bit of code that runs without a UI.
|
|
245
|
+
*
|
|
246
|
+
* See https://reactnative.dev/docs/appregistry#registercancellableheadlesstask
|
|
247
|
+
*/
|
|
248
|
+
export function registerCancellableHeadlessTask(
|
|
249
|
+
taskKey: string,
|
|
250
|
+
taskProvider: TaskProvider,
|
|
251
|
+
taskCancelProvider: TaskCancelProvider,
|
|
252
|
+
): void {
|
|
253
|
+
if (taskProviders.has(taskKey)) {
|
|
254
|
+
console.warn(
|
|
255
|
+
`registerHeadlessTask or registerCancellableHeadlessTask called multiple times for same key '${taskKey}'`,
|
|
256
|
+
);
|
|
257
|
+
}
|
|
258
|
+
taskProviders.set(taskKey, taskProvider);
|
|
259
|
+
taskCancelProviders.set(taskKey, taskCancelProvider);
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* Only called from native code. Starts a headless task.
|
|
264
|
+
*
|
|
265
|
+
* See https://reactnative.dev/docs/appregistry#startheadlesstask
|
|
266
|
+
*/
|
|
267
|
+
export function startHeadlessTask(
|
|
268
|
+
taskId: number,
|
|
269
|
+
taskKey: string,
|
|
270
|
+
data: any,
|
|
271
|
+
): void {
|
|
272
|
+
const taskProvider = taskProviders.get(taskKey);
|
|
273
|
+
if (!taskProvider) {
|
|
274
|
+
console.warn(`No task registered for key ${taskKey}`);
|
|
275
|
+
if (NativeHeadlessJsTaskSupport) {
|
|
276
|
+
NativeHeadlessJsTaskSupport.notifyTaskFinished(taskId);
|
|
277
|
+
}
|
|
278
|
+
return;
|
|
279
|
+
}
|
|
280
|
+
taskProvider()(data)
|
|
281
|
+
.then(() => {
|
|
282
|
+
if (NativeHeadlessJsTaskSupport) {
|
|
283
|
+
NativeHeadlessJsTaskSupport.notifyTaskFinished(taskId);
|
|
284
|
+
}
|
|
285
|
+
})
|
|
286
|
+
.catch(reason => {
|
|
287
|
+
console.error(reason);
|
|
288
|
+
|
|
289
|
+
if (
|
|
290
|
+
NativeHeadlessJsTaskSupport &&
|
|
291
|
+
reason instanceof HeadlessJsTaskError
|
|
292
|
+
) {
|
|
293
|
+
// $FlowFixMe[unused-promise]
|
|
294
|
+
NativeHeadlessJsTaskSupport.notifyTaskRetry(taskId).then(
|
|
295
|
+
retryPosted => {
|
|
296
|
+
if (!retryPosted) {
|
|
297
|
+
NativeHeadlessJsTaskSupport.notifyTaskFinished(taskId);
|
|
298
|
+
}
|
|
299
|
+
},
|
|
300
|
+
);
|
|
301
|
+
}
|
|
302
|
+
});
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
/**
|
|
306
|
+
* Only called from native code. Cancels a headless task.
|
|
307
|
+
*
|
|
308
|
+
* See https://reactnative.dev/docs/appregistry#cancelheadlesstask
|
|
309
|
+
*/
|
|
310
|
+
export function cancelHeadlessTask(taskId: number, taskKey: string): void {
|
|
311
|
+
const taskCancelProvider = taskCancelProviders.get(taskKey);
|
|
312
|
+
if (!taskCancelProvider) {
|
|
313
|
+
throw new Error(`No task canceller registered for key '${taskKey}'`);
|
|
314
|
+
}
|
|
315
|
+
taskCancelProvider()();
|
|
316
|
+
}
|
|
@@ -10,13 +10,15 @@
|
|
|
10
10
|
|
|
11
11
|
'use strict';
|
|
12
12
|
|
|
13
|
-
import type {NativeElementReference} from '../../src/private/webapis/dom/nodes/specs/NativeDOM';
|
|
14
13
|
import type {
|
|
15
|
-
InternalInstanceHandle,
|
|
16
|
-
LayoutAnimationConfig,
|
|
17
14
|
MeasureInWindowOnSuccessCallback,
|
|
18
15
|
MeasureLayoutOnSuccessCallback,
|
|
19
16
|
MeasureOnSuccessCallback,
|
|
17
|
+
} from '../../src/private/types/HostInstance';
|
|
18
|
+
import type {NativeElementReference} from '../../src/private/webapis/dom/nodes/specs/NativeDOM';
|
|
19
|
+
import type {
|
|
20
|
+
InternalInstanceHandle,
|
|
21
|
+
LayoutAnimationConfig,
|
|
20
22
|
Node,
|
|
21
23
|
} from '../Renderer/shims/ReactNativeTypes';
|
|
22
24
|
import type {RootTag} from '../Types/RootTagTypes';
|