@office-iss/react-native-win32 0.72.8 → 0.73.0-preview.2
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 +15 -5
- package/CHANGELOG.json +530 -101
- package/CHANGELOG.md +213 -56
- package/IntegrationTests/PromiseTest.js +1 -0
- package/IntegrationTests/websocket_integration_test_server.js +1 -1
- package/Libraries/Animated/Animated.js +1 -1
- package/Libraries/Animated/AnimatedImplementation.js +1 -1
- package/Libraries/Animated/NativeAnimatedHelper.js +14 -10
- package/Libraries/Animated/NativeAnimatedHelper.win32.js +16 -12
- package/Libraries/Animated/NativeAnimatedModule.js +6 -2
- package/Libraries/Animated/NativeAnimatedTurboModule.js +7 -4
- package/Libraries/Animated/animations/Animation.js +57 -3
- package/Libraries/Animated/animations/DecayAnimation.js +9 -0
- package/Libraries/Animated/animations/SpringAnimation.js +8 -0
- package/Libraries/Animated/animations/TimingAnimation.js +8 -0
- package/Libraries/Animated/components/AnimatedFlatList.js +2 -1
- package/Libraries/Animated/components/AnimatedScrollView.js +2 -0
- package/Libraries/Animated/components/AnimatedSectionList.js +2 -1
- package/Libraries/Animated/createAnimatedComponent.js +1 -0
- package/Libraries/Animated/nodes/AnimatedColor.js +1 -1
- package/Libraries/Animated/nodes/AnimatedObject.js +146 -0
- package/Libraries/Animated/nodes/AnimatedProps.js +19 -7
- package/Libraries/Animated/nodes/AnimatedStyle.js +29 -55
- package/Libraries/Animated/nodes/AnimatedValueXY.js +3 -17
- package/Libraries/Animated/shouldUseTurboAnimatedModule.js +17 -0
- package/Libraries/Animated/useAnimatedProps.js +9 -10
- package/Libraries/AppState/AppState.d.ts +1 -1
- package/Libraries/AppState/NativeAppState.js +8 -4
- package/Libraries/BatchedBridge/MessageQueue.js +45 -36
- package/Libraries/Blob/Blob.js +6 -2
- package/Libraries/Blob/BlobManager.js +9 -10
- package/Libraries/Blob/BlobRegistry.js +14 -9
- package/Libraries/Blob/File.js +1 -1
- package/Libraries/Blob/FileReader.js +1 -2
- package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.d.ts +1 -5
- package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.win32.js +7 -48
- package/Libraries/Components/Button/ButtonWin32.Props.d.ts +1 -1
- package/Libraries/Components/Button/ButtonWin32.Props.js.map +1 -1
- package/Libraries/Components/Button/ButtonWin32.d.ts +1 -1
- package/Libraries/Components/Button/ButtonWin32.js +1 -4
- package/Libraries/Components/Button/ButtonWin32.js.map +1 -1
- package/Libraries/Components/Clipboard/Clipboard.d.ts +4 -4
- package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js +3 -1
- package/Libraries/Components/EnterString.win32.d.ts +1 -1
- package/Libraries/Components/Keyboard/KeyboardAvoidingView.js +26 -6
- package/Libraries/Components/Pressable/Pressable.js +3 -2
- package/Libraries/Components/Pressable/Pressable.win32.js +4 -3
- package/Libraries/Components/Pressable/useAndroidRippleForView.js +1 -1
- package/Libraries/Components/SafeAreaView/SafeAreaView.js +7 -7
- package/Libraries/Components/SafeAreaView/SafeAreaView.win32.js +7 -8
- package/Libraries/Components/ScrollView/ScrollView.js +3 -1
- package/Libraries/Components/ScrollView/ScrollView.win32.js +3 -1
- package/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +39 -46
- package/Libraries/Components/Switch/Switch.js +1 -0
- package/Libraries/Components/Text/TextWin32.d.ts +1 -1
- package/Libraries/Components/TextInput/RCTTextInputViewConfig.js +1 -0
- package/Libraries/Components/TextInput/TextInput.d.ts +49 -7
- package/Libraries/Components/TextInput/TextInput.flow.js +43 -10
- package/Libraries/Components/TextInput/TextInput.js +62 -10
- package/Libraries/Components/TextInput/TextInput.win32.js +953 -206
- package/Libraries/Components/TextInput/Win32TextInputNativeComponent.js +23 -0
- package/Libraries/Components/ToastAndroid/{ToastAndroid.ios.js → ToastAndroid.js} +9 -1
- package/Libraries/Components/ToastAndroid/ToastAndroid.win32.js +9 -1
- package/Libraries/Components/Touchable/Tests/TouchableWin32Test.js +2 -2
- package/Libraries/Components/Touchable/Tests/TouchableWin32Test.js.map +1 -1
- package/Libraries/Components/Touchable/TouchableBounce.js +1 -1
- package/Libraries/Components/Touchable/TouchableHighlight.js +1 -1
- package/Libraries/Components/Touchable/TouchableNativeFeedback.js +1 -1
- package/Libraries/Components/Touchable/TouchableOpacity.js +4 -1
- package/Libraries/Components/Touchable/TouchableWin32.d.ts +1 -1
- package/Libraries/Components/Touchable/TouchableWin32.js.map +1 -1
- package/Libraries/Components/Touchable/TouchableWithoutFeedback.js +1 -0
- package/Libraries/Components/TraceUpdateOverlay/TraceUpdateOverlay.js +16 -6
- package/Libraries/Components/View/ReactNativeStyleAttributes.js +9 -0
- package/Libraries/Components/View/ReactNativeViewAttributes.js +1 -0
- package/Libraries/Components/View/ReactNativeViewAttributes.win32.js +1 -0
- package/Libraries/Components/View/View.js +46 -32
- package/Libraries/Components/View/View.win32.js +37 -6
- package/Libraries/Components/View/ViewAccessibility.d.ts +8 -2
- package/Libraries/Components/View/ViewNativeComponent.js +1 -0
- package/Libraries/Components/View/ViewPropTypes.js +18 -3
- package/Libraries/Components/View/ViewPropTypes.win32.js +30 -4
- package/Libraries/Components/View/ViewWin32.js +3 -2
- package/Libraries/Core/Devtools/loadBundleFromServer.js +152 -0
- package/Libraries/Core/Devtools/symbolicateStackTrace.js +2 -1
- package/Libraries/Core/ExceptionsManager.js +16 -7
- package/Libraries/Core/ExtendedError.js +12 -0
- package/Libraries/Core/ReactNativeVersion.js +3 -3
- package/Libraries/Core/ReactNativeVersionCheck.js +0 -2
- package/Libraries/Core/ReactNativeVersionCheck.win32.js +0 -2
- package/Libraries/Core/__mocks__/NativeExceptionsManager.js +20 -0
- package/Libraries/Core/setUpDeveloperTools.js +5 -1
- package/Libraries/Core/setUpIntersectionObserver.js +16 -0
- package/Libraries/{Components/ProgressBarAndroid/ProgressBarAndroid.ios.js → Core/setUpMutationObserver.js} +6 -2
- package/Libraries/Core/setUpPerformance.js +6 -13
- package/Libraries/Core/setUpPerformanceObserver.js +16 -0
- package/Libraries/Core/setUpRegeneratorRuntime.js +4 -2
- package/Libraries/DOM/Nodes/ReactNativeElement.js +135 -18
- package/Libraries/DOM/Nodes/ReadOnlyCharacterData.js +72 -0
- package/Libraries/DOM/Nodes/ReadOnlyElement.js +209 -21
- package/Libraries/DOM/Nodes/ReadOnlyNode.js +206 -17
- package/Libraries/DOM/Nodes/ReadOnlyText.js +30 -0
- package/Libraries/DOM/Nodes/Utilities/Traversal.js +54 -0
- package/Libraries/EventEmitter/NativeEventEmitter.d.ts +0 -6
- package/Libraries/EventEmitter/RCTDeviceEventEmitter.js +15 -4
- package/Libraries/Image/Image.android.js +8 -2
- package/Libraries/Image/Image.d.ts +1 -1
- package/Libraries/Image/Image.ios.js +4 -1
- package/Libraries/Image/Image.win32.js +6 -3
- package/Libraries/Image/ImageBackground.js +3 -0
- package/Libraries/Image/resolveAssetSource.win32.js +1 -1
- package/Libraries/Inspector/DevtoolsOverlay.js +6 -3
- package/Libraries/Inspector/NetworkOverlay.js +2 -2
- package/Libraries/Interaction/JSEventLoopWatchdog.js +1 -5
- package/Libraries/Interaction/PanResponder.js +1 -4
- package/Libraries/IntersectionObserver/IntersectionObserver.js +252 -0
- package/Libraries/IntersectionObserver/IntersectionObserverEntry.js +140 -0
- package/Libraries/IntersectionObserver/IntersectionObserverManager.js +221 -0
- package/Libraries/IntersectionObserver/NativeIntersectionObserver.js +41 -0
- package/Libraries/IntersectionObserver/__mocks__/NativeIntersectionObserver.js +162 -0
- package/Libraries/LayoutAnimation/LayoutAnimation.js +1 -1
- package/Libraries/Lists/FlatList.d.ts +2 -1
- package/Libraries/Lists/FlatList.js +15 -5
- package/Libraries/Lists/SectionList.js +4 -0
- package/Libraries/LogBox/Data/LogBoxData.js +2 -1
- package/Libraries/LogBox/Data/LogBoxLog.js +4 -1
- package/Libraries/LogBox/Data/LogBoxSymbolication.js +5 -2
- package/Libraries/LogBox/Data/parseLogBoxLog.js +57 -20
- package/Libraries/LogBox/UI/AnsiHighlight.js +1 -1
- package/Libraries/LogBox/UI/LogBoxInspectorFooter.js +24 -31
- package/Libraries/LogBox/UI/LogBoxInspectorHeader.js +1 -1
- package/Libraries/LogBox/UI/LogBoxMessage.js +4 -7
- package/Libraries/MutationObserver/MutationObserver.js +184 -0
- package/Libraries/MutationObserver/MutationObserverManager.js +218 -0
- package/Libraries/MutationObserver/MutationRecord.js +82 -0
- package/Libraries/MutationObserver/NativeMutationObserver.js +58 -0
- package/Libraries/MutationObserver/__mocks__/NativeMutationObserver.js +327 -0
- package/Libraries/NativeComponent/BaseViewConfig.android.js +18 -3
- package/Libraries/NativeComponent/BaseViewConfig.ios.js +33 -0
- package/Libraries/NativeComponent/BaseViewConfig.win32.js +33 -0
- package/Libraries/NativeComponent/NativeComponentRegistry.js +13 -9
- package/Libraries/NativeModules/specs/NativeSourceCode.js +6 -6
- package/Libraries/Network/RCTNetworking.android.js +2 -1
- package/Libraries/Network/XMLHttpRequest.js +1 -1
- package/Libraries/NewAppScreen/components/DebugInstructions.js +4 -4
- package/Libraries/NewAppScreen/components/LearnMoreLinks.js +9 -2
- package/Libraries/Performance/QuickPerformanceLogger.js +1 -1
- package/Libraries/PermissionsAndroid/NativePermissionsAndroid.js +1 -0
- package/Libraries/PermissionsAndroid/PermissionsAndroid.d.ts +1 -0
- package/Libraries/PermissionsAndroid/PermissionsAndroid.js +3 -1
- package/Libraries/Pressability/Pressability.js +28 -3
- package/Libraries/Pressability/Pressability.win32.js +30 -5
- package/Libraries/ReactNative/AppContainer.js +2 -3
- package/Libraries/ReactNative/AppRegistry.d.ts +0 -5
- package/Libraries/ReactNative/AppRegistry.js +66 -53
- package/Libraries/ReactNative/BridgelessUIManager.js +38 -9
- package/Libraries/ReactNative/FabricUIManager.js +143 -34
- package/Libraries/ReactNative/I18nManager.js +5 -11
- package/Libraries/ReactNative/NativeI18nManager.js +7 -5
- package/Libraries/ReactNative/PaperUIManager.win32.js +2 -2
- package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricHostComponent.js +151 -0
- package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstance.js +81 -0
- package/Libraries/ReactNative/ReactFabricPublicInstance/ReactNativeAttributePayload.js +492 -0
- package/Libraries/ReactNative/ReactFabricPublicInstance/warnForStyleProps.js +32 -0
- package/Libraries/ReactNative/ReactNativeFeatureFlags.js +19 -3
- package/Libraries/ReactNative/UIManager.js +8 -0
- package/Libraries/ReactNative/__mocks__/FabricUIManager.js +648 -0
- package/Libraries/ReactPrivate/ReactNativePrivateInterface.js +38 -2
- package/Libraries/Renderer/implementations/ReactFabric-dev.js +27 -27
- package/Libraries/Renderer/implementations/ReactFabric-prod.js +3 -3
- package/Libraries/Renderer/implementations/ReactFabric-profiling.js +3 -3
- package/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js +27 -27
- package/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js +3 -3
- package/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.js +3 -3
- package/Libraries/Renderer/shims/ReactFabric.js +5 -6
- package/Libraries/Renderer/shims/ReactFeatureFlags.js +2 -3
- package/Libraries/Renderer/shims/ReactNative.js +2 -3
- package/Libraries/Renderer/shims/ReactNativeTypes.js +35 -17
- package/Libraries/Renderer/shims/ReactNativeViewConfigRegistry.js +3 -3
- package/Libraries/Renderer/shims/createReactNativeComponentClass.js +2 -3
- package/Libraries/Settings/{Settings.android.js → Settings.js} +4 -4
- package/Libraries/Share/Share.d.ts +3 -9
- package/Libraries/StyleSheet/PlatformColorValueTypes.android.js +9 -4
- package/Libraries/StyleSheet/PlatformColorValueTypes.ios.js +28 -13
- package/Libraries/StyleSheet/PlatformColorValueTypes.win32.js +14 -4
- package/Libraries/StyleSheet/PlatformColorValueTypesIOS.ios.js +1 -1
- package/Libraries/StyleSheet/PlatformColorValueTypesWin32.d.ts +1 -1
- package/Libraries/StyleSheet/StyleSheet.d.ts +10 -1
- package/Libraries/StyleSheet/StyleSheet.js +3 -0
- package/Libraries/StyleSheet/StyleSheet.win32.js +3 -0
- package/Libraries/StyleSheet/StyleSheetTypes.d.ts +31 -17
- package/Libraries/StyleSheet/StyleSheetTypes.js +90 -6
- package/Libraries/StyleSheet/flattenStyle.js +4 -0
- package/Libraries/StyleSheet/private/_TransformStyle.js +16 -2
- package/Libraries/StyleSheet/processColor.js +1 -2
- package/Libraries/StyleSheet/processTransformOrigin.js +136 -0
- package/Libraries/StyleSheet/splitLayoutProps.js +1 -0
- package/Libraries/Text/Text.d.ts +5 -5
- package/Libraries/Text/Text.js +17 -10
- package/Libraries/Text/Text.win32.js +354 -0
- package/Libraries/Text/TextProps.win32.js +281 -0
- package/Libraries/TurboModule/TurboModuleRegistry.js +47 -7
- package/Libraries/TurboModule/samples/NativeSampleTurboModule.js +6 -0
- package/Libraries/Types/CoreEventTypes.d.ts +5 -2
- package/Libraries/Utilities/GlobalPerformanceLogger.js +2 -12
- package/Libraries/Utilities/NativeDeviceInfo.js +8 -9
- package/Libraries/Utilities/NativePlatformConstantsAndroid.js +23 -18
- package/Libraries/Utilities/NativePlatformConstantsIOS.js +16 -13
- package/Libraries/Utilities/NativePlatformConstantsWin.js +13 -10
- package/Libraries/Utilities/PerformanceLoggerContext.js +1 -1
- package/Libraries/Utilities/Platform.android.js +12 -8
- package/Libraries/Utilities/Platform.d.ts +1 -0
- package/Libraries/Utilities/Platform.flow.js +84 -0
- package/Libraries/Utilities/Platform.flow.win32.js +111 -0
- package/Libraries/Utilities/Platform.ios.js +12 -8
- package/Libraries/Utilities/Platform.win32.js +12 -8
- package/Libraries/Utilities/PolyfillFunctions.js +1 -1
- package/Libraries/Utilities/ReactNativeTestTools.js +1 -2
- package/Libraries/Utilities/SceneTracker.js +1 -1
- package/Libraries/Utilities/createPerformanceLogger.js +63 -32
- package/Libraries/Utilities/useColorScheme.js +7 -8
- package/Libraries/WebPerformance/MemoryInfo.js +1 -1
- package/Libraries/WebPerformance/NativePerformance.js +3 -8
- package/Libraries/WebPerformance/NativePerformanceObserver.js +4 -0
- package/Libraries/WebPerformance/Performance.js +42 -15
- package/Libraries/WebPerformance/PerformanceEntry.js +14 -6
- package/Libraries/WebPerformance/PerformanceEventTiming.js +18 -1
- package/Libraries/WebPerformance/ReactNativeStartupTiming.js +40 -14
- package/Libraries/WebPerformance/__mocks__/NativePerformance.js +4 -2
- package/Libraries/WebPerformance/__mocks__/NativePerformanceObserver.js +21 -3
- package/Libraries/promiseRejectionTrackingOptions.js +21 -9
- package/Libraries/vendor/emitter/EventEmitter.js +17 -17
- package/flow/global.js +1 -3
- package/flow/jest.js +5 -1
- package/{Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.ios.js → jest/ReactNativeInternalFeatureFlagsMock.js} +2 -1
- package/jest/__tests__/setup-test.js +18 -0
- package/jest/mockModal.js +6 -4
- package/jest/setup.js +61 -30
- package/jest.config.js +1 -1
- package/just-task.js +1 -0
- package/overrides.json +54 -60
- package/package.json +35 -33
- package/src/Libraries/Components/Button/ButtonWin32.Props.ts +1 -1
- package/src/Libraries/Components/Button/ButtonWin32.tsx +0 -2
- package/src/Libraries/Components/Touchable/Tests/TouchableWin32Test.tsx +2 -2
- package/src/Libraries/Components/Touchable/TouchableWin32.tsx +1 -1
- package/src/Libraries/Components/View/ViewAccessibility.d.ts +8 -2
- package/src/Libraries/StyleSheet/PlatformColorValueTypesWin32.d.ts +1 -1
- package/types/experimental.d.ts +44 -0
- package/types/index.d.ts +2 -1
- package/types/modules/Devtools.d.ts +1 -0
- package/types/modules/globals.d.ts +16 -1
- package/IntegrationTests/BUCK +0 -32
- package/IntegrationTests/PropertiesUpdateTest.js +0 -29
- package/IntegrationTests/RCTRootViewIntegrationTestApp.js +0 -86
- package/IntegrationTests/ReactContentSizeUpdateTest.js +0 -89
- package/IntegrationTests/SizeFlexibilityUpdateTest.js +0 -106
- package/Libraries/Components/AccessibilityInfo/NativeAccessibilityInfoWin32.js +0 -37
- package/Libraries/Components/TextInput/TextInput.Types.win32.d.ts +0 -51
- package/Libraries/Components/TextInput/TextInput.Types.win32.js +0 -3
- package/Libraries/Components/TextInput/TextInput.Types.win32.js.map +0 -1
- package/Libraries/Utilities/AcessibilityMapping.js +0 -154
- package/Libraries/Utilities/AcessibilityMapping.win32.js +0 -156
- package/Libraries/Utilities/NativeDevSplitBundleLoader.js +0 -19
- package/Libraries/Utilities/useColorScheme.win32.js +0 -26
- package/flow/use-sync-external-store.js +0 -20
- package/flow-typed/npm/base64-js_v1.x.x.js +0 -12
- package/flow-typed/npm/glob_v7.x.x.js +0 -79
- package/flow-typed/npm/pretty-format_v26.x.x.js +0 -49
- package/flow-typed/npm/promise_v8.x.x.js +0 -30
- package/flow-typed/npm/react-dom_v17.x.x.js +0 -139
- package/flow-typed/npm/react-test-renderer_v16.x.x.js +0 -79
- package/flow-typed/npm/stacktrace-parser_v0.1.x.js +0 -17
- package/flow-typed/npm/yargs_v17.x.x.js +0 -341
- package/src/Libraries/Components/AccessibilityInfo/AccessibilityInfo.d.ts +0 -161
- package/src/Libraries/Components/TextInput/TextInput.Types.win32.ts +0 -68
- /package/Libraries/{Renderer/public → ReactNative/ReactFabricPublicInstance}/ReactFabricPublicInstanceUtils.js +0 -0
|
@@ -8,10 +8,18 @@
|
|
|
8
8
|
* @flow strict
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import type {HighResTimeStamp} from './PerformanceEntry';
|
|
11
|
+
import type {HighResTimeStamp, PerformanceEntryJSON} from './PerformanceEntry';
|
|
12
12
|
|
|
13
13
|
import {PerformanceEntry} from './PerformanceEntry';
|
|
14
14
|
|
|
15
|
+
export type PerformanceEventTimingJSON = {
|
|
16
|
+
...PerformanceEntryJSON,
|
|
17
|
+
processingStart: HighResTimeStamp,
|
|
18
|
+
processingEnd: HighResTimeStamp,
|
|
19
|
+
interactionId: number,
|
|
20
|
+
...
|
|
21
|
+
};
|
|
22
|
+
|
|
15
23
|
export class PerformanceEventTiming extends PerformanceEntry {
|
|
16
24
|
processingStart: HighResTimeStamp;
|
|
17
25
|
processingEnd: HighResTimeStamp;
|
|
@@ -35,4 +43,13 @@ export class PerformanceEventTiming extends PerformanceEntry {
|
|
|
35
43
|
this.processingEnd = init.processingEnd ?? 0;
|
|
36
44
|
this.interactionId = init.interactionId ?? 0;
|
|
37
45
|
}
|
|
46
|
+
|
|
47
|
+
toJSON(): PerformanceEventTimingJSON {
|
|
48
|
+
return {
|
|
49
|
+
...super.toJSON(),
|
|
50
|
+
processingStart: this.processingStart,
|
|
51
|
+
processingEnd: this.processingEnd,
|
|
52
|
+
interactionId: this.interactionId,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
38
55
|
}
|
|
@@ -11,23 +11,35 @@
|
|
|
11
11
|
|
|
12
12
|
// flowlint unsafe-getters-setters:off
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
type ReactNativeStartupTimingLike = {
|
|
15
|
+
startTime: ?number,
|
|
16
|
+
endTime: ?number,
|
|
17
|
+
initializeRuntimeStart: ?number,
|
|
18
|
+
initializeRuntimeEnd: ?number,
|
|
19
|
+
executeJavaScriptBundleEntryPointStart: ?number,
|
|
20
|
+
executeJavaScriptBundleEntryPointEnd: ?number,
|
|
21
|
+
};
|
|
15
22
|
|
|
16
23
|
// Read-only object with RN startup timing information.
|
|
17
24
|
// This is returned by the performance.reactNativeStartup API.
|
|
18
25
|
export default class ReactNativeStartupTiming {
|
|
19
|
-
// All time information here are in ms.
|
|
20
|
-
//
|
|
21
|
-
//
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
+
// All time information here are in ms. The values may be null if not provided.
|
|
27
|
+
// We do NOT match web spect here for two reasons:
|
|
28
|
+
// 1. The `ReactNativeStartupTiming` is non-standard API
|
|
29
|
+
// 2. The timing information is relative to the time origin, which means `0` has valid meaning
|
|
30
|
+
_startTime: ?number;
|
|
31
|
+
_endTime: ?number;
|
|
32
|
+
_initializeRuntimeStart: ?number;
|
|
33
|
+
_initializeRuntimeEnd: ?number;
|
|
34
|
+
_executeJavaScriptBundleEntryPointStart: ?number;
|
|
35
|
+
_executeJavaScriptBundleEntryPointEnd: ?number;
|
|
26
36
|
|
|
27
|
-
constructor(startUpTiming: ?
|
|
37
|
+
constructor(startUpTiming: ?ReactNativeStartupTimingLike) {
|
|
28
38
|
if (startUpTiming != null) {
|
|
29
39
|
this._startTime = startUpTiming.startTime;
|
|
30
40
|
this._endTime = startUpTiming.endTime;
|
|
41
|
+
this._initializeRuntimeStart = startUpTiming.initializeRuntimeStart;
|
|
42
|
+
this._initializeRuntimeEnd = startUpTiming.initializeRuntimeEnd;
|
|
31
43
|
this._executeJavaScriptBundleEntryPointStart =
|
|
32
44
|
startUpTiming.executeJavaScriptBundleEntryPointStart;
|
|
33
45
|
this._executeJavaScriptBundleEntryPointEnd =
|
|
@@ -36,30 +48,44 @@ export default class ReactNativeStartupTiming {
|
|
|
36
48
|
}
|
|
37
49
|
|
|
38
50
|
/**
|
|
39
|
-
*
|
|
51
|
+
* Start time of the RN app startup process. This is provided by the platform by implementing the `ReactMarker.setAppStartTime` API in the native platform code.
|
|
40
52
|
*/
|
|
41
|
-
get startTime(): number {
|
|
53
|
+
get startTime(): ?number {
|
|
42
54
|
return this._startTime;
|
|
43
55
|
}
|
|
44
56
|
|
|
45
57
|
/**
|
|
46
58
|
* End time of the RN app startup process. This is equal to `executeJavaScriptBundleEntryPointEnd`.
|
|
47
59
|
*/
|
|
48
|
-
get endTime(): number {
|
|
60
|
+
get endTime(): ?number {
|
|
49
61
|
return this._endTime;
|
|
50
62
|
}
|
|
51
63
|
|
|
64
|
+
/**
|
|
65
|
+
* Start time when RN runtime get initialized. This is when RN infra first kicks in app startup process.
|
|
66
|
+
*/
|
|
67
|
+
get initializeRuntimeStart(): ?number {
|
|
68
|
+
return this._initializeRuntimeStart;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* End time when RN runtime get initialized. This is the last marker before ends of the app startup process.
|
|
73
|
+
*/
|
|
74
|
+
get initializeRuntimeEnd(): ?number {
|
|
75
|
+
return this._initializeRuntimeEnd;
|
|
76
|
+
}
|
|
77
|
+
|
|
52
78
|
/**
|
|
53
79
|
* Start time of JS bundle being executed. This indicates the RN JS bundle is loaded and start to be evaluated.
|
|
54
80
|
*/
|
|
55
|
-
get executeJavaScriptBundleEntryPointStart(): number {
|
|
81
|
+
get executeJavaScriptBundleEntryPointStart(): ?number {
|
|
56
82
|
return this._executeJavaScriptBundleEntryPointStart;
|
|
57
83
|
}
|
|
58
84
|
|
|
59
85
|
/**
|
|
60
86
|
* End time of JS bundle being executed. This indicates all the synchronous entry point jobs are finished.
|
|
61
87
|
*/
|
|
62
|
-
get executeJavaScriptBundleEntryPointEnd(): number {
|
|
88
|
+
get executeJavaScriptBundleEntryPointEnd(): ?number {
|
|
63
89
|
return this._executeJavaScriptBundleEntryPointEnd;
|
|
64
90
|
}
|
|
65
91
|
}
|
|
@@ -20,12 +20,12 @@ import {RawPerformanceEntryTypeValues} from '../RawPerformanceEntry';
|
|
|
20
20
|
const marks: Map<string, number> = new Map();
|
|
21
21
|
|
|
22
22
|
const NativePerformanceMock: NativePerformance = {
|
|
23
|
-
mark: (name: string, startTime: number
|
|
23
|
+
mark: (name: string, startTime: number): void => {
|
|
24
24
|
NativePerformanceObserver?.logRawEntry({
|
|
25
25
|
name,
|
|
26
26
|
entryType: RawPerformanceEntryTypeValues.MARK,
|
|
27
27
|
startTime,
|
|
28
|
-
duration,
|
|
28
|
+
duration: 0,
|
|
29
29
|
});
|
|
30
30
|
marks.set(name, startTime);
|
|
31
31
|
},
|
|
@@ -58,6 +58,8 @@ const NativePerformanceMock: NativePerformance = {
|
|
|
58
58
|
endTime: 0,
|
|
59
59
|
executeJavaScriptBundleEntryPointStart: 0,
|
|
60
60
|
executeJavaScriptBundleEntryPointEnd: 0,
|
|
61
|
+
initializeRuntimeStart: 0,
|
|
62
|
+
initializeRuntimeEnd: 0,
|
|
61
63
|
};
|
|
62
64
|
},
|
|
63
65
|
};
|
|
@@ -18,6 +18,7 @@ import type {
|
|
|
18
18
|
import {RawPerformanceEntryTypeValues} from '../RawPerformanceEntry';
|
|
19
19
|
|
|
20
20
|
const reportingType: Set<RawPerformanceEntryType> = new Set();
|
|
21
|
+
const isAlwaysLogged: Set<RawPerformanceEntryType> = new Set();
|
|
21
22
|
const eventCounts: Map<string, number> = new Map();
|
|
22
23
|
const durationThresholds: Map<RawPerformanceEntryType, number> = new Map();
|
|
23
24
|
let entries: Array<RawPerformanceEntry> = [];
|
|
@@ -33,6 +34,19 @@ const NativePerformanceObserverMock: NativePerformanceObserver = {
|
|
|
33
34
|
durationThresholds.delete(entryType);
|
|
34
35
|
},
|
|
35
36
|
|
|
37
|
+
setIsBuffered: (
|
|
38
|
+
entryTypes: $ReadOnlyArray<RawPerformanceEntryType>,
|
|
39
|
+
isBuffered: boolean,
|
|
40
|
+
) => {
|
|
41
|
+
for (const entryType of entryTypes) {
|
|
42
|
+
if (isBuffered) {
|
|
43
|
+
isAlwaysLogged.add(entryType);
|
|
44
|
+
} else {
|
|
45
|
+
isAlwaysLogged.delete(entryType);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
|
|
36
50
|
popPendingEntries: (): GetPendingEntriesResult => {
|
|
37
51
|
const res = entries;
|
|
38
52
|
entries = [];
|
|
@@ -47,7 +61,10 @@ const NativePerformanceObserverMock: NativePerformanceObserver = {
|
|
|
47
61
|
},
|
|
48
62
|
|
|
49
63
|
logRawEntry: (entry: RawPerformanceEntry) => {
|
|
50
|
-
if (
|
|
64
|
+
if (
|
|
65
|
+
reportingType.has(entry.entryType) ||
|
|
66
|
+
isAlwaysLogged.has(entry.entryType)
|
|
67
|
+
) {
|
|
51
68
|
const durationThreshold = durationThresholds.get(entry.entryType);
|
|
52
69
|
if (
|
|
53
70
|
durationThreshold !== undefined &&
|
|
@@ -81,8 +98,9 @@ const NativePerformanceObserverMock: NativePerformanceObserver = {
|
|
|
81
98
|
clearEntries: (entryType: RawPerformanceEntryType, entryName?: string) => {
|
|
82
99
|
entries = entries.filter(
|
|
83
100
|
e =>
|
|
84
|
-
|
|
85
|
-
|
|
101
|
+
(entryType !== RawPerformanceEntryTypeValues.UNDEFINED &&
|
|
102
|
+
e.entryType !== entryType) ||
|
|
103
|
+
(entryName != null && e.name !== entryName),
|
|
86
104
|
);
|
|
87
105
|
},
|
|
88
106
|
|
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
|
|
11
11
|
import typeof {enable} from 'promise/setimmediate/rejection-tracking';
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
import LogBox from './LogBox/LogBox';
|
|
14
14
|
|
|
15
|
-
let rejectionTrackingOptions: $
|
|
15
|
+
let rejectionTrackingOptions: $NonMaybeType<Parameters<enable>[0]> = {
|
|
16
16
|
allRejections: true,
|
|
17
17
|
onUnhandled: (id, rejection = {}) => {
|
|
18
18
|
let message: string;
|
|
@@ -36,17 +36,29 @@ let rejectionTrackingOptions: $Call<ExtractOptionsType, enable> = {
|
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
const warning =
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
39
|
+
const warning = `Possible unhandled promise rejection (id: ${id}):\n${
|
|
40
|
+
message ?? ''
|
|
41
|
+
}`;
|
|
42
|
+
if (__DEV__) {
|
|
43
|
+
LogBox.addLog({
|
|
44
|
+
level: 'warn',
|
|
45
|
+
message: {
|
|
46
|
+
content: warning,
|
|
47
|
+
substitutions: [],
|
|
48
|
+
},
|
|
49
|
+
componentStack: [],
|
|
50
|
+
stack,
|
|
51
|
+
category: 'possible_unhandled_promise_rejection',
|
|
52
|
+
});
|
|
53
|
+
} else {
|
|
54
|
+
console.warn(warning);
|
|
55
|
+
}
|
|
44
56
|
},
|
|
45
57
|
onHandled: id => {
|
|
46
58
|
const warning =
|
|
47
|
-
`Promise
|
|
59
|
+
`Promise rejection handled (id: ${id})\n` +
|
|
48
60
|
'This means you can ignore any previous messages of the form ' +
|
|
49
|
-
`"Possible
|
|
61
|
+
`"Possible unhandled promise rejection (id: ${id}):"`;
|
|
50
62
|
console.warn(warning);
|
|
51
63
|
},
|
|
52
64
|
};
|
|
@@ -15,13 +15,13 @@ export interface EventSubscription {
|
|
|
15
15
|
export interface IEventEmitter<TEventToArgsMap: {...}> {
|
|
16
16
|
addListener<TEvent: $Keys<TEventToArgsMap>>(
|
|
17
17
|
eventType: TEvent,
|
|
18
|
-
listener: (...args:
|
|
18
|
+
listener: (...args: TEventToArgsMap[TEvent]) => mixed,
|
|
19
19
|
context?: mixed,
|
|
20
20
|
): EventSubscription;
|
|
21
21
|
|
|
22
22
|
emit<TEvent: $Keys<TEventToArgsMap>>(
|
|
23
23
|
eventType: TEvent,
|
|
24
|
-
...args:
|
|
24
|
+
...args: TEventToArgsMap[TEvent]
|
|
25
25
|
): void;
|
|
26
26
|
|
|
27
27
|
removeAllListeners<TEvent: $Keys<TEventToArgsMap>>(eventType?: ?TEvent): void;
|
|
@@ -63,7 +63,7 @@ type Registry<TEventToArgsMap: {...}> = $ObjMap<
|
|
|
63
63
|
export default class EventEmitter<TEventToArgsMap: {...}>
|
|
64
64
|
implements IEventEmitter<TEventToArgsMap>
|
|
65
65
|
{
|
|
66
|
-
|
|
66
|
+
#registry: Registry<TEventToArgsMap> = {};
|
|
67
67
|
|
|
68
68
|
/**
|
|
69
69
|
* Registers a listener that is called when the supplied event is emitted.
|
|
@@ -71,7 +71,7 @@ export default class EventEmitter<TEventToArgsMap: {...}>
|
|
|
71
71
|
*/
|
|
72
72
|
addListener<TEvent: $Keys<TEventToArgsMap>>(
|
|
73
73
|
eventType: TEvent,
|
|
74
|
-
listener: (...args:
|
|
74
|
+
listener: (...args: TEventToArgsMap[TEvent]) => mixed,
|
|
75
75
|
context: mixed,
|
|
76
76
|
): EventSubscription {
|
|
77
77
|
if (typeof listener !== 'function') {
|
|
@@ -79,11 +79,12 @@ export default class EventEmitter<TEventToArgsMap: {...}>
|
|
|
79
79
|
'EventEmitter.addListener(...): 2nd argument must be a function.',
|
|
80
80
|
);
|
|
81
81
|
}
|
|
82
|
-
const registrations = allocate<
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
82
|
+
const registrations = allocate<
|
|
83
|
+
TEventToArgsMap,
|
|
84
|
+
TEvent,
|
|
85
|
+
TEventToArgsMap[TEvent],
|
|
86
|
+
>(this.#registry, eventType);
|
|
87
|
+
const registration: Registration<TEventToArgsMap[TEvent]> = {
|
|
87
88
|
context,
|
|
88
89
|
listener,
|
|
89
90
|
remove(): void {
|
|
@@ -103,11 +104,10 @@ export default class EventEmitter<TEventToArgsMap: {...}>
|
|
|
103
104
|
*/
|
|
104
105
|
emit<TEvent: $Keys<TEventToArgsMap>>(
|
|
105
106
|
eventType: TEvent,
|
|
106
|
-
...args:
|
|
107
|
+
...args: TEventToArgsMap[TEvent]
|
|
107
108
|
): void {
|
|
108
|
-
const registrations: ?Set<
|
|
109
|
-
|
|
110
|
-
> = this._registry[eventType];
|
|
109
|
+
const registrations: ?Set<Registration<TEventToArgsMap[TEvent]>> =
|
|
110
|
+
this.#registry[eventType];
|
|
111
111
|
if (registrations != null) {
|
|
112
112
|
// Copy `registrations` to take a snapshot when we invoke `emit`, in case
|
|
113
113
|
// registrations are added or removed when listeners are invoked.
|
|
@@ -124,9 +124,9 @@ export default class EventEmitter<TEventToArgsMap: {...}>
|
|
|
124
124
|
eventType?: ?TEvent,
|
|
125
125
|
): void {
|
|
126
126
|
if (eventType == null) {
|
|
127
|
-
this
|
|
127
|
+
this.#registry = {};
|
|
128
128
|
} else {
|
|
129
|
-
delete this
|
|
129
|
+
delete this.#registry[eventType];
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
132
|
|
|
@@ -134,7 +134,7 @@ export default class EventEmitter<TEventToArgsMap: {...}>
|
|
|
134
134
|
* Returns the number of registered listeners for the supplied event.
|
|
135
135
|
*/
|
|
136
136
|
listenerCount<TEvent: $Keys<TEventToArgsMap>>(eventType: TEvent): number {
|
|
137
|
-
const registrations: ?Set<Registration<mixed>> = this
|
|
137
|
+
const registrations: ?Set<Registration<mixed>> = this.#registry[eventType];
|
|
138
138
|
return registrations == null ? 0 : registrations.size;
|
|
139
139
|
}
|
|
140
140
|
}
|
|
@@ -142,7 +142,7 @@ export default class EventEmitter<TEventToArgsMap: {...}>
|
|
|
142
142
|
function allocate<
|
|
143
143
|
TEventToArgsMap: {...},
|
|
144
144
|
TEvent: $Keys<TEventToArgsMap>,
|
|
145
|
-
TEventArgs:
|
|
145
|
+
TEventArgs: TEventToArgsMap[TEvent],
|
|
146
146
|
>(
|
|
147
147
|
registry: Registry<TEventToArgsMap>,
|
|
148
148
|
eventType: TEvent,
|
package/flow/global.js
CHANGED
package/flow/jest.js
CHANGED
|
@@ -38,6 +38,10 @@ type JestMockFn<TArguments: $ReadOnlyArray<any>, TReturn> = {
|
|
|
38
38
|
* instantiated from this mock function.
|
|
39
39
|
*/
|
|
40
40
|
instances: Array<TReturn>,
|
|
41
|
+
/**
|
|
42
|
+
* An array that contains the contexts for all calls of the mock function.
|
|
43
|
+
*/
|
|
44
|
+
contexts: Array<mixed>,
|
|
41
45
|
/**
|
|
42
46
|
* An array that contains all the object results that have been
|
|
43
47
|
* returned by this mock function call
|
|
@@ -673,7 +677,7 @@ interface JestExpectType {
|
|
|
673
677
|
* Use .toBeInstanceOf(Class) to check that an object is an instance of a
|
|
674
678
|
* class.
|
|
675
679
|
*/
|
|
676
|
-
toBeInstanceOf(cls: Class
|
|
680
|
+
toBeInstanceOf(cls: Class<any>): void;
|
|
677
681
|
/**
|
|
678
682
|
* .toBeNull() is the same as .toBe(null) but the error messages are a bit
|
|
679
683
|
* nicer.
|
|
@@ -0,0 +1,18 @@
|
|
|
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 strict
|
|
8
|
+
* @format
|
|
9
|
+
* @oncall react_native
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import NativeExceptionsManager from '../../Libraries/Core/NativeExceptionsManager';
|
|
13
|
+
|
|
14
|
+
test('NativeExceptionsManager is a mock', () => {
|
|
15
|
+
expect(jest.isMockFunction(NativeExceptionsManager.reportException)).toBe(
|
|
16
|
+
true,
|
|
17
|
+
);
|
|
18
|
+
});
|
package/jest/mockModal.js
CHANGED
|
@@ -17,11 +17,13 @@ import typeof Modal from '../Libraries/Modal/Modal';
|
|
|
17
17
|
|
|
18
18
|
function mockModal(BaseComponent: $FlowFixMe) {
|
|
19
19
|
class ModalMock extends BaseComponent {
|
|
20
|
-
render(): React.Element<Modal> {
|
|
20
|
+
render(): React.Element<Modal> | null {
|
|
21
|
+
if (this.props.visible === false) {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
|
|
21
25
|
return (
|
|
22
|
-
<BaseComponent {...this.props}>
|
|
23
|
-
{this.props.visible !== true ? null : this.props.children}
|
|
24
|
-
</BaseComponent>
|
|
26
|
+
<BaseComponent {...this.props}>{this.props.children}</BaseComponent>
|
|
25
27
|
);
|
|
26
28
|
}
|
|
27
29
|
}
|
package/jest/setup.js
CHANGED
|
@@ -15,36 +15,50 @@ const mockComponent = jest.requireActual('./mockComponent');
|
|
|
15
15
|
jest.requireActual('@react-native/js-polyfills/Object.es8');
|
|
16
16
|
jest.requireActual('@react-native/js-polyfills/error-guard');
|
|
17
17
|
|
|
18
|
-
global
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
jest.
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
18
|
+
Object.defineProperties(global, {
|
|
19
|
+
__DEV__: {
|
|
20
|
+
configurable: true,
|
|
21
|
+
enumerable: true,
|
|
22
|
+
value: true,
|
|
23
|
+
writable: true,
|
|
24
|
+
},
|
|
25
|
+
cancelAnimationFrame: {
|
|
26
|
+
configurable: true,
|
|
27
|
+
enumerable: true,
|
|
28
|
+
value: id => clearTimeout(id),
|
|
29
|
+
writable: true,
|
|
30
|
+
},
|
|
31
|
+
performance: {
|
|
32
|
+
configurable: true,
|
|
33
|
+
enumerable: true,
|
|
34
|
+
value: {
|
|
35
|
+
now: jest.fn(Date.now),
|
|
36
|
+
},
|
|
37
|
+
writable: true,
|
|
38
|
+
},
|
|
39
|
+
regeneratorRuntime: {
|
|
40
|
+
configurable: true,
|
|
41
|
+
enumerable: true,
|
|
42
|
+
value: jest.requireActual('regenerator-runtime/runtime'),
|
|
43
|
+
writable: true,
|
|
44
|
+
},
|
|
45
|
+
requestAnimationFrame: {
|
|
46
|
+
configurable: true,
|
|
47
|
+
enumerable: true,
|
|
48
|
+
value: callback => setTimeout(() => callback(jest.now()), 0),
|
|
49
|
+
writable: true,
|
|
50
|
+
},
|
|
51
|
+
window: {
|
|
52
|
+
configurable: true,
|
|
53
|
+
enumerable: true,
|
|
54
|
+
value: global,
|
|
55
|
+
writable: true,
|
|
56
|
+
},
|
|
57
|
+
});
|
|
39
58
|
|
|
40
59
|
jest
|
|
41
60
|
.mock('../Libraries/Core/InitializeCore', () => {})
|
|
42
|
-
.mock('../Libraries/Core/NativeExceptionsManager'
|
|
43
|
-
__esModule: true,
|
|
44
|
-
default: {
|
|
45
|
-
reportException: jest.fn(),
|
|
46
|
-
},
|
|
47
|
-
}))
|
|
61
|
+
.mock('../Libraries/Core/NativeExceptionsManager')
|
|
48
62
|
.mock('../Libraries/ReactNative/UIManager', () => ({
|
|
49
63
|
AndroidViewPager: {
|
|
50
64
|
Commands: {
|
|
@@ -95,9 +109,17 @@ jest
|
|
|
95
109
|
Constants: {},
|
|
96
110
|
},
|
|
97
111
|
}))
|
|
98
|
-
.mock('../Libraries/Image/Image', () =>
|
|
99
|
-
mockComponent('../Libraries/Image/Image')
|
|
100
|
-
|
|
112
|
+
.mock('../Libraries/Image/Image', () => {
|
|
113
|
+
const Image = mockComponent('../Libraries/Image/Image');
|
|
114
|
+
Image.getSize = jest.fn();
|
|
115
|
+
Image.getSizeWithHeaders = jest.fn();
|
|
116
|
+
Image.prefetch = jest.fn();
|
|
117
|
+
Image.prefetchWithMetadata = jest.fn();
|
|
118
|
+
Image.queryCache = jest.fn();
|
|
119
|
+
Image.resolveAssetSource = jest.fn();
|
|
120
|
+
|
|
121
|
+
return Image;
|
|
122
|
+
})
|
|
101
123
|
.mock('../Libraries/Text/Text', () =>
|
|
102
124
|
mockComponent('../Libraries/Text/Text', MockNativeMethods),
|
|
103
125
|
)
|
|
@@ -176,6 +198,8 @@ jest
|
|
|
176
198
|
addEventListener: jest.fn(() => ({
|
|
177
199
|
remove: jest.fn(),
|
|
178
200
|
})),
|
|
201
|
+
removeEventListener: jest.fn(),
|
|
202
|
+
currentState: jest.fn(),
|
|
179
203
|
}))
|
|
180
204
|
.mock('../Libraries/Linking/Linking', () => ({
|
|
181
205
|
openURL: jest.fn(),
|
|
@@ -374,4 +398,11 @@ jest
|
|
|
374
398
|
__esModule: true,
|
|
375
399
|
default: Component,
|
|
376
400
|
};
|
|
401
|
+
})
|
|
402
|
+
// In tests, we can use the default version instead of the one using
|
|
403
|
+
// dependency injection.
|
|
404
|
+
.mock('../Libraries/ReactNative/RendererProxy', () => {
|
|
405
|
+
return jest.requireActual(
|
|
406
|
+
'../Libraries/ReactNative/RendererImplementation',
|
|
407
|
+
);
|
|
377
408
|
});
|
package/jest.config.js
CHANGED
package/just-task.js
CHANGED