@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
|
@@ -0,0 +1,221 @@
|
|
|
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-local
|
|
8
|
+
* @format
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* This module handles the communication between the React Native renderer
|
|
13
|
+
* and all the intersection observers that are currently observing any targets.
|
|
14
|
+
*
|
|
15
|
+
* In order to reduce the communication between native and JavaScript,
|
|
16
|
+
* we register a single notication callback in native, and then we handle how
|
|
17
|
+
* to notify each entry to the right intersection observer when we receive all
|
|
18
|
+
* the notifications together.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
import type ReactNativeElement from '../DOM/Nodes/ReactNativeElement';
|
|
22
|
+
import type IntersectionObserver, {
|
|
23
|
+
IntersectionObserverCallback,
|
|
24
|
+
} from './IntersectionObserver';
|
|
25
|
+
import type IntersectionObserverEntry from './IntersectionObserverEntry';
|
|
26
|
+
|
|
27
|
+
import {getShadowNode} from '../DOM/Nodes/ReadOnlyNode';
|
|
28
|
+
import * as Systrace from '../Performance/Systrace';
|
|
29
|
+
import warnOnce from '../Utilities/warnOnce';
|
|
30
|
+
import {createIntersectionObserverEntry} from './IntersectionObserverEntry';
|
|
31
|
+
import NativeIntersectionObserver from './NativeIntersectionObserver';
|
|
32
|
+
|
|
33
|
+
export type IntersectionObserverId = number;
|
|
34
|
+
|
|
35
|
+
let nextIntersectionObserverId: IntersectionObserverId = 1;
|
|
36
|
+
let isConnected: boolean = false;
|
|
37
|
+
|
|
38
|
+
const registeredIntersectionObservers: Map<
|
|
39
|
+
IntersectionObserverId,
|
|
40
|
+
{observer: IntersectionObserver, callback: IntersectionObserverCallback},
|
|
41
|
+
> = new Map();
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Registers the given intersection observer and returns a unique ID for it,
|
|
45
|
+
* which is required to start observing targets.
|
|
46
|
+
*/
|
|
47
|
+
export function registerObserver(
|
|
48
|
+
observer: IntersectionObserver,
|
|
49
|
+
callback: IntersectionObserverCallback,
|
|
50
|
+
): IntersectionObserverId {
|
|
51
|
+
const intersectionObserverId = nextIntersectionObserverId;
|
|
52
|
+
nextIntersectionObserverId++;
|
|
53
|
+
registeredIntersectionObservers.set(intersectionObserverId, {
|
|
54
|
+
observer,
|
|
55
|
+
callback,
|
|
56
|
+
});
|
|
57
|
+
return intersectionObserverId;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Unregisters the given intersection observer.
|
|
62
|
+
* This should only be called when an observer is no longer observing any
|
|
63
|
+
* targets.
|
|
64
|
+
*/
|
|
65
|
+
export function unregisterObserver(
|
|
66
|
+
intersectionObserverId: IntersectionObserverId,
|
|
67
|
+
): void {
|
|
68
|
+
const deleted = registeredIntersectionObservers.delete(
|
|
69
|
+
intersectionObserverId,
|
|
70
|
+
);
|
|
71
|
+
if (deleted && registeredIntersectionObservers.size === 0) {
|
|
72
|
+
NativeIntersectionObserver?.disconnect();
|
|
73
|
+
isConnected = false;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Starts observing a target on a specific intersection observer.
|
|
79
|
+
* If this is the first target being observed, this also sets up the centralized
|
|
80
|
+
* notification callback in native.
|
|
81
|
+
*/
|
|
82
|
+
export function observe({
|
|
83
|
+
intersectionObserverId,
|
|
84
|
+
target,
|
|
85
|
+
}: {
|
|
86
|
+
intersectionObserverId: IntersectionObserverId,
|
|
87
|
+
target: ReactNativeElement,
|
|
88
|
+
}): void {
|
|
89
|
+
if (NativeIntersectionObserver == null) {
|
|
90
|
+
warnNoNativeIntersectionObserver();
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const registeredObserver = registeredIntersectionObservers.get(
|
|
95
|
+
intersectionObserverId,
|
|
96
|
+
);
|
|
97
|
+
if (registeredObserver == null) {
|
|
98
|
+
console.error(
|
|
99
|
+
`IntersectionObserverManager: could not start observing target because IntersectionObserver with ID ${intersectionObserverId} was not registered.`,
|
|
100
|
+
);
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
const targetShadowNode = getShadowNode(target);
|
|
105
|
+
if (targetShadowNode == null) {
|
|
106
|
+
console.error(
|
|
107
|
+
'IntersectionObserverManager: could not find reference to host node from target',
|
|
108
|
+
);
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
if (!isConnected) {
|
|
113
|
+
NativeIntersectionObserver.connect(notifyIntersectionObservers);
|
|
114
|
+
isConnected = true;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
return NativeIntersectionObserver.observe({
|
|
118
|
+
intersectionObserverId,
|
|
119
|
+
targetShadowNode,
|
|
120
|
+
thresholds: registeredObserver.observer.thresholds,
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export function unobserve(
|
|
125
|
+
intersectionObserverId: number,
|
|
126
|
+
target: ReactNativeElement,
|
|
127
|
+
): void {
|
|
128
|
+
if (NativeIntersectionObserver == null) {
|
|
129
|
+
warnNoNativeIntersectionObserver();
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
const registeredObserver = registeredIntersectionObservers.get(
|
|
134
|
+
intersectionObserverId,
|
|
135
|
+
);
|
|
136
|
+
if (registeredObserver == null) {
|
|
137
|
+
console.error(
|
|
138
|
+
`IntersectionObserverManager: could not stop observing target because IntersectionObserver with ID ${intersectionObserverId} was not registered.`,
|
|
139
|
+
);
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
const targetShadowNode = getShadowNode(target);
|
|
144
|
+
if (targetShadowNode == null) {
|
|
145
|
+
console.error(
|
|
146
|
+
'IntersectionObserverManager: could not find reference to host node from target',
|
|
147
|
+
);
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
NativeIntersectionObserver.unobserve(
|
|
152
|
+
intersectionObserverId,
|
|
153
|
+
targetShadowNode,
|
|
154
|
+
);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* This function is called from native when there are `IntersectionObserver`
|
|
159
|
+
* entries to dispatch.
|
|
160
|
+
*/
|
|
161
|
+
function notifyIntersectionObservers(): void {
|
|
162
|
+
Systrace.beginEvent(
|
|
163
|
+
'IntersectionObserverManager.notifyIntersectionObservers',
|
|
164
|
+
);
|
|
165
|
+
try {
|
|
166
|
+
doNotifyIntersectionObservers();
|
|
167
|
+
} finally {
|
|
168
|
+
Systrace.endEvent();
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
function doNotifyIntersectionObservers(): void {
|
|
173
|
+
if (NativeIntersectionObserver == null) {
|
|
174
|
+
warnNoNativeIntersectionObserver();
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
const nativeEntries = NativeIntersectionObserver.takeRecords();
|
|
179
|
+
|
|
180
|
+
const entriesByObserver: Map<
|
|
181
|
+
IntersectionObserverId,
|
|
182
|
+
Array<IntersectionObserverEntry>,
|
|
183
|
+
> = new Map();
|
|
184
|
+
|
|
185
|
+
for (const nativeEntry of nativeEntries) {
|
|
186
|
+
let list = entriesByObserver.get(nativeEntry.intersectionObserverId);
|
|
187
|
+
if (list == null) {
|
|
188
|
+
list = [];
|
|
189
|
+
entriesByObserver.set(nativeEntry.intersectionObserverId, list);
|
|
190
|
+
}
|
|
191
|
+
list.push(createIntersectionObserverEntry(nativeEntry));
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
for (const [
|
|
195
|
+
intersectionObserverId,
|
|
196
|
+
entriesForObserver,
|
|
197
|
+
] of entriesByObserver) {
|
|
198
|
+
const registeredObserver = registeredIntersectionObservers.get(
|
|
199
|
+
intersectionObserverId,
|
|
200
|
+
);
|
|
201
|
+
if (!registeredObserver) {
|
|
202
|
+
// This could happen if the observer is disconnected between commit
|
|
203
|
+
// and mount. In this case, we can just ignore the entries.
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
const {observer, callback} = registeredObserver;
|
|
208
|
+
try {
|
|
209
|
+
callback.call(observer, entriesForObserver, observer);
|
|
210
|
+
} catch (error) {
|
|
211
|
+
console.error(error);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
function warnNoNativeIntersectionObserver() {
|
|
217
|
+
warnOnce(
|
|
218
|
+
'missing-native-intersection-observer',
|
|
219
|
+
'Missing native implementation of IntersectionObserver',
|
|
220
|
+
);
|
|
221
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
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
|
+
*/
|
|
10
|
+
|
|
11
|
+
import type {TurboModule} from '../TurboModule/RCTExport';
|
|
12
|
+
|
|
13
|
+
import * as TurboModuleRegistry from '../TurboModule/TurboModuleRegistry';
|
|
14
|
+
|
|
15
|
+
export type NativeIntersectionObserverEntry = {
|
|
16
|
+
intersectionObserverId: number,
|
|
17
|
+
targetInstanceHandle: mixed,
|
|
18
|
+
targetRect: $ReadOnlyArray<number>, // It's actually a tuple with x, y, width and height
|
|
19
|
+
rootRect: $ReadOnlyArray<number>, // It's actually a tuple with x, y, width and height
|
|
20
|
+
intersectionRect: ?$ReadOnlyArray<number>, // It's actually a tuple with x, y, width and height
|
|
21
|
+
isIntersectingAboveThresholds: boolean,
|
|
22
|
+
time: number,
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export type NativeIntersectionObserverObserveOptions = {
|
|
26
|
+
intersectionObserverId: number,
|
|
27
|
+
targetShadowNode: mixed,
|
|
28
|
+
thresholds: $ReadOnlyArray<number>,
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export interface Spec extends TurboModule {
|
|
32
|
+
+observe: (options: NativeIntersectionObserverObserveOptions) => void;
|
|
33
|
+
+unobserve: (intersectionObserverId: number, targetShadowNode: mixed) => void;
|
|
34
|
+
+connect: (notifyIntersectionObserversCallback: () => void) => void;
|
|
35
|
+
+disconnect: () => void;
|
|
36
|
+
+takeRecords: () => $ReadOnlyArray<NativeIntersectionObserverEntry>;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export default (TurboModuleRegistry.get<Spec>(
|
|
40
|
+
'NativeIntersectionObserverCxx',
|
|
41
|
+
): ?Spec);
|
|
@@ -0,0 +1,162 @@
|
|
|
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-local
|
|
8
|
+
* @format
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import type ReactNativeElement from '../../DOM/Nodes/ReactNativeElement';
|
|
12
|
+
import type IntersectionObserver from '../IntersectionObserver';
|
|
13
|
+
import type {
|
|
14
|
+
NativeIntersectionObserverEntry,
|
|
15
|
+
NativeIntersectionObserverObserveOptions,
|
|
16
|
+
Spec,
|
|
17
|
+
} from '../NativeIntersectionObserver';
|
|
18
|
+
|
|
19
|
+
import {getShadowNode} from '../../DOM/Nodes/ReadOnlyNode';
|
|
20
|
+
import {getFabricUIManager} from '../../ReactNative/__mocks__/FabricUIManager';
|
|
21
|
+
import invariant from 'invariant';
|
|
22
|
+
import nullthrows from 'nullthrows';
|
|
23
|
+
|
|
24
|
+
type ObserverState = {
|
|
25
|
+
thresholds: $ReadOnlyArray<number>,
|
|
26
|
+
intersecting: boolean,
|
|
27
|
+
currentThreshold: ?number,
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
type Observation = {
|
|
31
|
+
...NativeIntersectionObserverObserveOptions,
|
|
32
|
+
state: ObserverState,
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
let pendingRecords: Array<NativeIntersectionObserverEntry> = [];
|
|
36
|
+
let callback: ?() => void;
|
|
37
|
+
let observations: Array<Observation> = [];
|
|
38
|
+
|
|
39
|
+
const FabricUIManagerMock = nullthrows(getFabricUIManager());
|
|
40
|
+
|
|
41
|
+
function createRecordFromObservation(
|
|
42
|
+
observation: Observation,
|
|
43
|
+
): NativeIntersectionObserverEntry {
|
|
44
|
+
return {
|
|
45
|
+
intersectionObserverId: observation.intersectionObserverId,
|
|
46
|
+
targetInstanceHandle: FabricUIManagerMock.__getInstanceHandleFromNode(
|
|
47
|
+
// $FlowExpectedError[incompatible-call]
|
|
48
|
+
observation.targetShadowNode,
|
|
49
|
+
),
|
|
50
|
+
targetRect: observation.state.intersecting ? [0, 0, 1, 1] : [20, 20, 1, 1],
|
|
51
|
+
rootRect: [0, 0, 10, 10],
|
|
52
|
+
intersectionRect: observation.state.intersecting ? [0, 0, 1, 1] : null,
|
|
53
|
+
isIntersectingAboveThresholds: observation.state.intersecting,
|
|
54
|
+
time: performance.now(),
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function notifyIntersectionObservers(): void {
|
|
59
|
+
callback?.();
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const NativeIntersectionObserverMock = {
|
|
63
|
+
observe: (options: NativeIntersectionObserverObserveOptions): void => {
|
|
64
|
+
invariant(
|
|
65
|
+
observations.find(
|
|
66
|
+
observation =>
|
|
67
|
+
observation.intersectionObserverId ===
|
|
68
|
+
options.intersectionObserverId &&
|
|
69
|
+
observation.targetShadowNode === options.targetShadowNode,
|
|
70
|
+
) == null,
|
|
71
|
+
'unexpected duplicate call to observe',
|
|
72
|
+
);
|
|
73
|
+
const observation = {
|
|
74
|
+
...options,
|
|
75
|
+
state: {
|
|
76
|
+
thresholds: options.thresholds,
|
|
77
|
+
intersecting: false,
|
|
78
|
+
currentThreshold: null,
|
|
79
|
+
},
|
|
80
|
+
};
|
|
81
|
+
observations.push(observation);
|
|
82
|
+
pendingRecords.push(createRecordFromObservation(observation));
|
|
83
|
+
setImmediate(notifyIntersectionObservers);
|
|
84
|
+
},
|
|
85
|
+
unobserve: (
|
|
86
|
+
intersectionObserverId: number,
|
|
87
|
+
targetShadowNode: mixed,
|
|
88
|
+
): void => {
|
|
89
|
+
const observationIndex = observations.findIndex(
|
|
90
|
+
observation =>
|
|
91
|
+
observation.intersectionObserverId === intersectionObserverId &&
|
|
92
|
+
observation.targetShadowNode === targetShadowNode,
|
|
93
|
+
);
|
|
94
|
+
invariant(
|
|
95
|
+
observationIndex !== -1,
|
|
96
|
+
'unexpected duplicate call to unobserve',
|
|
97
|
+
);
|
|
98
|
+
observations.splice(observationIndex, 1);
|
|
99
|
+
},
|
|
100
|
+
connect: (notifyIntersectionObserversCallback: () => void): void => {
|
|
101
|
+
invariant(callback == null, 'unexpected call to connect');
|
|
102
|
+
invariant(
|
|
103
|
+
notifyIntersectionObserversCallback != null,
|
|
104
|
+
'unexpected null notify intersection observers callback',
|
|
105
|
+
);
|
|
106
|
+
callback = notifyIntersectionObserversCallback;
|
|
107
|
+
},
|
|
108
|
+
disconnect: (): void => {
|
|
109
|
+
invariant(callback != null, 'unexpected call to disconnect');
|
|
110
|
+
callback = null;
|
|
111
|
+
},
|
|
112
|
+
takeRecords: (): $ReadOnlyArray<NativeIntersectionObserverEntry> => {
|
|
113
|
+
const currentRecords = pendingRecords;
|
|
114
|
+
pendingRecords = [];
|
|
115
|
+
return currentRecords;
|
|
116
|
+
},
|
|
117
|
+
__forceTransitionForTests: (
|
|
118
|
+
observer: IntersectionObserver,
|
|
119
|
+
target: ReactNativeElement,
|
|
120
|
+
) => {
|
|
121
|
+
const targetShadowNode = getShadowNode(target);
|
|
122
|
+
const observation = observations.find(
|
|
123
|
+
obs =>
|
|
124
|
+
obs.intersectionObserverId === observer.__getObserverID() &&
|
|
125
|
+
obs.targetShadowNode === targetShadowNode,
|
|
126
|
+
);
|
|
127
|
+
invariant(
|
|
128
|
+
observation != null,
|
|
129
|
+
'cannot force transition on an unobserved target',
|
|
130
|
+
);
|
|
131
|
+
if (observation.state.intersecting) {
|
|
132
|
+
observation.state.intersecting = false;
|
|
133
|
+
observation.state.currentThreshold = null;
|
|
134
|
+
} else {
|
|
135
|
+
observation.state.intersecting = true;
|
|
136
|
+
observation.state.currentThreshold = observation.thresholds[0];
|
|
137
|
+
}
|
|
138
|
+
pendingRecords.push(createRecordFromObservation(observation));
|
|
139
|
+
setImmediate(notifyIntersectionObservers);
|
|
140
|
+
},
|
|
141
|
+
__getObservationsForTests: (
|
|
142
|
+
observer: IntersectionObserver,
|
|
143
|
+
): Array<{targetShadowNode: mixed, thresholds: $ReadOnlyArray<number>}> => {
|
|
144
|
+
const intersectionObserverId = observer.__getObserverID();
|
|
145
|
+
return observations
|
|
146
|
+
.filter(
|
|
147
|
+
observation =>
|
|
148
|
+
observation.intersectionObserverId === intersectionObserverId,
|
|
149
|
+
)
|
|
150
|
+
.map(observation => ({
|
|
151
|
+
targetShadowNode: observation.targetShadowNode,
|
|
152
|
+
thresholds: observation.thresholds,
|
|
153
|
+
}));
|
|
154
|
+
},
|
|
155
|
+
__isConnected: (): boolean => {
|
|
156
|
+
return callback != null;
|
|
157
|
+
},
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
(NativeIntersectionObserverMock: Spec);
|
|
161
|
+
|
|
162
|
+
export default NativeIntersectionObserverMock;
|
|
@@ -12,6 +12,7 @@ import type {
|
|
|
12
12
|
ListRenderItem,
|
|
13
13
|
ViewToken,
|
|
14
14
|
VirtualizedListProps,
|
|
15
|
+
ViewabilityConfig,
|
|
15
16
|
} from '@react-native/virtualized-lists';
|
|
16
17
|
import type {ScrollViewComponent} from '../Components/ScrollView/ScrollView';
|
|
17
18
|
import type {StyleProp} from '../StyleSheet/StyleSheet';
|
|
@@ -144,7 +145,7 @@ export interface FlatListProps<ItemT> extends VirtualizedListProps<ItemT> {
|
|
|
144
145
|
/**
|
|
145
146
|
* See `ViewabilityHelper` for flow type and further documentation.
|
|
146
147
|
*/
|
|
147
|
-
viewabilityConfig?:
|
|
148
|
+
viewabilityConfig?: ViewabilityConfig | undefined;
|
|
148
149
|
|
|
149
150
|
/**
|
|
150
151
|
* Note: may have bugs (missing content) in some circumstances - use at your own risk.
|
|
@@ -36,7 +36,7 @@ type RequiredProps<ItemT> = {|
|
|
|
36
36
|
* An array (or array-like list) of items to render. Other data types can be
|
|
37
37
|
* used by targeting VirtualizedList directly.
|
|
38
38
|
*/
|
|
39
|
-
data: ?$ArrayLike<ItemT
|
|
39
|
+
data: ?$ReadOnly<$ArrayLike<ItemT>>,
|
|
40
40
|
|};
|
|
41
41
|
type OptionalProps<ItemT> = {|
|
|
42
42
|
/**
|
|
@@ -91,7 +91,7 @@ type OptionalProps<ItemT> = {|
|
|
|
91
91
|
* specify `ItemSeparatorComponent`.
|
|
92
92
|
*/
|
|
93
93
|
getItemLayout?: (
|
|
94
|
-
data: ?$ArrayLike<ItemT
|
|
94
|
+
data: ?$ReadOnly<$ArrayLike<ItemT>>,
|
|
95
95
|
index: number,
|
|
96
96
|
) => {
|
|
97
97
|
length: number,
|
|
@@ -436,7 +436,16 @@ class FlatList<ItemT> extends React.PureComponent<Props<ItemT>, void> {
|
|
|
436
436
|
* see the error delete this comment and run Flow. */
|
|
437
437
|
viewabilityConfig: this.props.viewabilityConfig,
|
|
438
438
|
onViewableItemsChanged: this._createOnViewableItemsChanged(
|
|
439
|
-
|
|
439
|
+
// NOTE: we use a wrapper function to allow the actual callback to change
|
|
440
|
+
// while still keeping the function provided to native to be stable
|
|
441
|
+
(...args) => {
|
|
442
|
+
invariant(
|
|
443
|
+
this.props.onViewableItemsChanged,
|
|
444
|
+
'Changing the nullability of onViewableItemsChanged is not supported. ' +
|
|
445
|
+
'Once a function or null is supplied that cannot be changed.',
|
|
446
|
+
);
|
|
447
|
+
return this.props.onViewableItemsChanged(...args);
|
|
448
|
+
},
|
|
440
449
|
),
|
|
441
450
|
});
|
|
442
451
|
}
|
|
@@ -450,8 +459,9 @@ class FlatList<ItemT> extends React.PureComponent<Props<ItemT>, void> {
|
|
|
450
459
|
'changing the number of columns to force a fresh render of the component.',
|
|
451
460
|
);
|
|
452
461
|
invariant(
|
|
453
|
-
prevProps.onViewableItemsChanged ===
|
|
454
|
-
|
|
462
|
+
(prevProps.onViewableItemsChanged == null) ===
|
|
463
|
+
(this.props.onViewableItemsChanged == null),
|
|
464
|
+
'Changing onViewableItemsChanged nullability on the fly is not supported',
|
|
455
465
|
);
|
|
456
466
|
invariant(
|
|
457
467
|
!deepDiffer(prevProps.viewabilityConfig, this.props.viewabilityConfig),
|
|
@@ -244,6 +244,10 @@ export default class SectionList<
|
|
|
244
244
|
const stickySectionHeadersEnabled =
|
|
245
245
|
_stickySectionHeadersEnabled ?? Platform.OS === 'ios';
|
|
246
246
|
return (
|
|
247
|
+
/* $FlowFixMe[incompatible-type] Error revealed after improved builtin
|
|
248
|
+
* React utility types */
|
|
249
|
+
/* $FlowFixMe[incompatible-type] Error revealed after improved builtin
|
|
250
|
+
* React utility types */
|
|
247
251
|
<VirtualizedSectionList
|
|
248
252
|
{...restProps}
|
|
249
253
|
stickySectionHeadersEnabled={stickySectionHeadersEnabled}
|
|
@@ -30,6 +30,7 @@ export type LogData = $ReadOnly<{|
|
|
|
30
30
|
message: Message,
|
|
31
31
|
category: Category,
|
|
32
32
|
componentStack: ComponentStack,
|
|
33
|
+
stack?: string,
|
|
33
34
|
|}>;
|
|
34
35
|
|
|
35
36
|
export type Observer = (
|
|
@@ -198,7 +199,7 @@ export function addLog(log: LogData): void {
|
|
|
198
199
|
// otherwise spammy logs would pause rendering.
|
|
199
200
|
setImmediate(() => {
|
|
200
201
|
try {
|
|
201
|
-
const stack = parseErrorStack(errorForStackTrace?.stack);
|
|
202
|
+
const stack = parseErrorStack(log.stack ?? errorForStackTrace?.stack);
|
|
202
203
|
|
|
203
204
|
appendNewLog(
|
|
204
205
|
new LogBoxLog({
|
|
@@ -31,6 +31,7 @@ export type LogBoxLogData = $ReadOnly<{|
|
|
|
31
31
|
componentStack: ComponentStack,
|
|
32
32
|
codeFrame?: ?CodeFrame,
|
|
33
33
|
isComponentError: boolean,
|
|
34
|
+
extraData?: mixed,
|
|
34
35
|
|}>;
|
|
35
36
|
|
|
36
37
|
class LogBoxLog {
|
|
@@ -43,6 +44,7 @@ class LogBoxLog {
|
|
|
43
44
|
level: LogLevel;
|
|
44
45
|
codeFrame: ?CodeFrame;
|
|
45
46
|
isComponentError: boolean;
|
|
47
|
+
extraData: mixed | void;
|
|
46
48
|
symbolicated:
|
|
47
49
|
| $ReadOnly<{|error: null, stack: null, status: 'NONE'|}>
|
|
48
50
|
| $ReadOnly<{|error: null, stack: null, status: 'PENDING'|}>
|
|
@@ -62,6 +64,7 @@ class LogBoxLog {
|
|
|
62
64
|
this.componentStack = data.componentStack;
|
|
63
65
|
this.codeFrame = data.codeFrame;
|
|
64
66
|
this.isComponentError = data.isComponentError;
|
|
67
|
+
this.extraData = data.extraData;
|
|
65
68
|
this.count = 1;
|
|
66
69
|
}
|
|
67
70
|
|
|
@@ -91,7 +94,7 @@ class LogBoxLog {
|
|
|
91
94
|
handleSymbolicate(callback?: (status: SymbolicationStatus) => void): void {
|
|
92
95
|
if (this.symbolicated.status !== 'PENDING') {
|
|
93
96
|
this.updateStatus(null, null, null, callback);
|
|
94
|
-
LogBoxSymbolication.symbolicate(this.stack).then(
|
|
97
|
+
LogBoxSymbolication.symbolicate(this.stack, this.extraData).then(
|
|
95
98
|
data => {
|
|
96
99
|
this.updateStatus(null, data?.stack, data?.codeFrame, callback);
|
|
97
100
|
},
|
|
@@ -51,10 +51,13 @@ export function deleteStack(stack: Stack): void {
|
|
|
51
51
|
cache.delete(stack);
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
export function symbolicate(
|
|
54
|
+
export function symbolicate(
|
|
55
|
+
stack: Stack,
|
|
56
|
+
extraData?: mixed,
|
|
57
|
+
): Promise<SymbolicatedStackTrace> {
|
|
55
58
|
let promise = cache.get(stack);
|
|
56
59
|
if (promise == null) {
|
|
57
|
-
promise = symbolicateStackTrace(stack).then(sanitize);
|
|
60
|
+
promise = symbolicateStackTrace(stack, extraData).then(sanitize);
|
|
58
61
|
cache.set(stack, promise);
|
|
59
62
|
}
|
|
60
63
|
|