@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
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
|
|
11
11
|
import type {ViewProps} from './ViewPropTypes';
|
|
12
12
|
|
|
13
|
+
import ReactNativeFeatureFlags from '../../ReactNative/ReactNativeFeatureFlags';
|
|
13
14
|
import flattenStyle from '../../StyleSheet/flattenStyle';
|
|
14
15
|
import TextAncestor from '../../Text/TextAncestor';
|
|
15
|
-
import {getAccessibilityRoleFromRole} from '../../Utilities/AcessibilityMapping';
|
|
16
16
|
import ViewNativeComponent from './ViewNativeComponent';
|
|
17
17
|
import * as React from 'react';
|
|
18
18
|
|
|
@@ -35,7 +35,6 @@ const View: React.AbstractComponent<
|
|
|
35
35
|
accessibilityLabel,
|
|
36
36
|
accessibilityLabelledBy,
|
|
37
37
|
accessibilityLiveRegion,
|
|
38
|
-
accessibilityRole,
|
|
39
38
|
accessibilityState,
|
|
40
39
|
accessibilityValue,
|
|
41
40
|
'aria-busy': ariaBusy,
|
|
@@ -56,12 +55,12 @@ const View: React.AbstractComponent<
|
|
|
56
55
|
importantForAccessibility,
|
|
57
56
|
nativeID,
|
|
58
57
|
pointerEvents,
|
|
59
|
-
role,
|
|
60
58
|
tabIndex,
|
|
61
59
|
...otherProps
|
|
62
60
|
}: ViewProps,
|
|
63
61
|
forwardedRef,
|
|
64
62
|
) => {
|
|
63
|
+
const hasTextAncestor = React.useContext(TextAncestor);
|
|
65
64
|
const _accessibilityLabelledBy =
|
|
66
65
|
ariaLabelledBy?.split(/\s*,\s*/g) ?? accessibilityLabelledBy;
|
|
67
66
|
|
|
@@ -101,38 +100,53 @@ const View: React.AbstractComponent<
|
|
|
101
100
|
// $FlowFixMe[underconstrained-implicit-instantiation]
|
|
102
101
|
let style = flattenStyle(otherProps.style);
|
|
103
102
|
|
|
103
|
+
// $FlowFixMe[sketchy-null-mixed]
|
|
104
104
|
const newPointerEvents = style?.pointerEvents || pointerEvents;
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
}
|
|
113
|
-
accessibilityLabel={ariaLabel ?? accessibilityLabel}
|
|
114
|
-
focusable={tabIndex !== undefined ? !tabIndex : focusable}
|
|
115
|
-
accessibilityState={_accessibilityState}
|
|
116
|
-
accessibilityRole={
|
|
117
|
-
role ? getAccessibilityRoleFromRole(role) : accessibilityRole
|
|
118
|
-
}
|
|
119
|
-
accessibilityElementsHidden={
|
|
120
|
-
ariaHidden ?? accessibilityElementsHidden
|
|
121
|
-
}
|
|
122
|
-
accessibilityLabelledBy={_accessibilityLabelledBy}
|
|
123
|
-
accessibilityValue={_accessibilityValue}
|
|
124
|
-
importantForAccessibility={
|
|
125
|
-
ariaHidden === true
|
|
126
|
-
? 'no-hide-descendants'
|
|
127
|
-
: importantForAccessibility
|
|
105
|
+
const collapsableOverride =
|
|
106
|
+
ReactNativeFeatureFlags.shouldForceUnflattenForElevation()
|
|
107
|
+
? {
|
|
108
|
+
collapsable:
|
|
109
|
+
style != null && style.elevation != null && style.elevation !== 0
|
|
110
|
+
? false
|
|
111
|
+
: otherProps.collapsable,
|
|
128
112
|
}
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
113
|
+
: {};
|
|
114
|
+
|
|
115
|
+
const actualView = (
|
|
116
|
+
<ViewNativeComponent
|
|
117
|
+
{...otherProps}
|
|
118
|
+
{...collapsableOverride}
|
|
119
|
+
accessibilityLiveRegion={
|
|
120
|
+
ariaLive === 'off' ? 'none' : ariaLive ?? accessibilityLiveRegion
|
|
121
|
+
}
|
|
122
|
+
accessibilityLabel={ariaLabel ?? accessibilityLabel}
|
|
123
|
+
focusable={tabIndex !== undefined ? !tabIndex : focusable}
|
|
124
|
+
accessibilityState={_accessibilityState}
|
|
125
|
+
accessibilityElementsHidden={ariaHidden ?? accessibilityElementsHidden}
|
|
126
|
+
accessibilityLabelledBy={_accessibilityLabelledBy}
|
|
127
|
+
accessibilityValue={_accessibilityValue}
|
|
128
|
+
importantForAccessibility={
|
|
129
|
+
ariaHidden === true
|
|
130
|
+
? 'no-hide-descendants'
|
|
131
|
+
: importantForAccessibility
|
|
132
|
+
}
|
|
133
|
+
nativeID={id ?? nativeID}
|
|
134
|
+
style={style}
|
|
135
|
+
// $FlowFixMe[incompatible-type]
|
|
136
|
+
pointerEvents={newPointerEvents}
|
|
137
|
+
ref={forwardedRef}
|
|
138
|
+
/>
|
|
135
139
|
);
|
|
140
|
+
|
|
141
|
+
if (hasTextAncestor) {
|
|
142
|
+
return (
|
|
143
|
+
<TextAncestor.Provider value={false}>
|
|
144
|
+
{actualView}
|
|
145
|
+
</TextAncestor.Provider>
|
|
146
|
+
);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
return actualView;
|
|
136
150
|
},
|
|
137
151
|
);
|
|
138
152
|
|
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
|
|
11
11
|
import type {ViewProps} from './ViewPropTypes';
|
|
12
12
|
|
|
13
|
+
import ReactNativeFeatureFlags from '../../ReactNative/ReactNativeFeatureFlags';
|
|
13
14
|
import flattenStyle from '../../StyleSheet/flattenStyle';
|
|
14
15
|
import TextAncestor from '../../Text/TextAncestor';
|
|
15
|
-
import {getAccessibilityRoleFromRole} from '../../Utilities/AcessibilityMapping';
|
|
16
16
|
import ViewNativeComponent from './ViewNativeComponent';
|
|
17
17
|
import * as React from 'react';
|
|
18
18
|
import invariant from 'invariant'; // [Windows]
|
|
@@ -35,24 +35,35 @@ const View: React.AbstractComponent<
|
|
|
35
35
|
> = React.forwardRef(
|
|
36
36
|
(
|
|
37
37
|
{
|
|
38
|
+
accessibilityControls, // Win32
|
|
39
|
+
accessibilityDescribedBy, // Win32
|
|
40
|
+
accessibilityDescription, // Win32
|
|
38
41
|
accessibilityElementsHidden,
|
|
39
42
|
accessibilityLabel,
|
|
40
43
|
accessibilityLabelledBy,
|
|
44
|
+
accessibilityLevel, // Win32
|
|
41
45
|
accessibilityLiveRegion,
|
|
42
|
-
|
|
46
|
+
accessibilityPositionInSet, // Win32
|
|
47
|
+
accessibilitySetSize, // Win32
|
|
43
48
|
accessibilityState,
|
|
44
49
|
accessibilityValue,
|
|
45
50
|
'aria-busy': ariaBusy,
|
|
46
51
|
'aria-checked': ariaChecked,
|
|
52
|
+
'aria-controls': ariaControls,
|
|
53
|
+
'aria-describedby': ariaDescribedBy, // Win32
|
|
54
|
+
'aria-description': ariaDescription, // Win32
|
|
47
55
|
'aria-disabled': ariaDisabled,
|
|
48
56
|
'aria-expanded': ariaExpanded,
|
|
49
57
|
'aria-hidden': ariaHidden,
|
|
50
58
|
'aria-label': ariaLabel,
|
|
51
59
|
'aria-labelledby': ariaLabelledBy,
|
|
60
|
+
'aria-level': ariaLevel, // Win32
|
|
52
61
|
'aria-live': ariaLive,
|
|
53
62
|
'aria-multiselectable': ariaMultiselectable, // Win32
|
|
63
|
+
'aria-posinset': ariaPosinset, // Win32
|
|
54
64
|
'aria-required': ariaRequired, // Win32
|
|
55
65
|
'aria-selected': ariaSelected,
|
|
66
|
+
'aria-setsize': ariaSetsize, // Win32
|
|
56
67
|
'aria-valuemax': ariaValueMax,
|
|
57
68
|
'aria-valuemin': ariaValueMin,
|
|
58
69
|
'aria-valuenow': ariaValueNow,
|
|
@@ -62,7 +73,6 @@ const View: React.AbstractComponent<
|
|
|
62
73
|
importantForAccessibility,
|
|
63
74
|
nativeID,
|
|
64
75
|
pointerEvents,
|
|
65
|
-
role,
|
|
66
76
|
tabIndex,
|
|
67
77
|
...otherProps
|
|
68
78
|
}: ViewProps,
|
|
@@ -112,7 +122,17 @@ const View: React.AbstractComponent<
|
|
|
112
122
|
// $FlowFixMe[underconstrained-implicit-instantiation]
|
|
113
123
|
let style = flattenStyle(otherProps.style);
|
|
114
124
|
|
|
125
|
+
// $FlowFixMe[sketchy-null-mixed]
|
|
115
126
|
const newPointerEvents = style?.pointerEvents || pointerEvents;
|
|
127
|
+
const collapsableOverride =
|
|
128
|
+
ReactNativeFeatureFlags.shouldForceUnflattenForElevation()
|
|
129
|
+
? {
|
|
130
|
+
collapsable:
|
|
131
|
+
style != null && style.elevation != null && style.elevation !== 0
|
|
132
|
+
? false
|
|
133
|
+
: otherProps.collapsable,
|
|
134
|
+
}
|
|
135
|
+
: {};
|
|
116
136
|
|
|
117
137
|
const _keyDown = (event: KeyEvent) => {
|
|
118
138
|
if (otherProps.keyDownEvents && event.isPropagationStopped() !== true) {
|
|
@@ -200,17 +220,27 @@ const View: React.AbstractComponent<
|
|
|
200
220
|
return (
|
|
201
221
|
<ViewNativeComponent
|
|
202
222
|
{...otherProps}
|
|
223
|
+
{...collapsableOverride}
|
|
224
|
+
accessibilityControls={ariaControls ?? accessibilityControls} // Win32
|
|
225
|
+
accessibilityDescribedBy={
|
|
226
|
+
ariaDescribedBy ?? accessibilityDescribedBy
|
|
227
|
+
} // Win32
|
|
228
|
+
accessibilityDescription={
|
|
229
|
+
ariaDescription ?? accessibilityDescription
|
|
230
|
+
} // Win32
|
|
203
231
|
accessibilityLiveRegion={
|
|
204
232
|
ariaLive === 'off'
|
|
205
233
|
? 'none'
|
|
206
234
|
: ariaLive ?? accessibilityLiveRegion
|
|
207
235
|
}
|
|
208
236
|
accessibilityLabel={ariaLabel ?? accessibilityLabel}
|
|
237
|
+
accessibilityLevel={ariaLevel ?? accessibilityLevel} // Win32
|
|
209
238
|
focusable={tabIndex !== undefined ? !tabIndex : focusable}
|
|
239
|
+
accessibilityPositionInSet={
|
|
240
|
+
ariaPosinset ?? accessibilityPositionInSet
|
|
241
|
+
} // Win32
|
|
242
|
+
accessibilitySetSize={ariaSetsize ?? accessibilitySetSize} // Win32
|
|
210
243
|
accessibilityState={_accessibilityState}
|
|
211
|
-
accessibilityRole={
|
|
212
|
-
role ? getAccessibilityRoleFromRole(role) : accessibilityRole
|
|
213
|
-
}
|
|
214
244
|
accessibilityElementsHidden={
|
|
215
245
|
ariaHidden ?? accessibilityElementsHidden
|
|
216
246
|
}
|
|
@@ -223,6 +253,7 @@ const View: React.AbstractComponent<
|
|
|
223
253
|
}
|
|
224
254
|
nativeID={id ?? nativeID}
|
|
225
255
|
style={style}
|
|
256
|
+
// $FlowFixMe[incompatible-type]
|
|
226
257
|
pointerEvents={newPointerEvents}
|
|
227
258
|
ref={forwardedRef}
|
|
228
259
|
onKeyDown={_keyDown}
|
|
@@ -321,7 +321,7 @@ export interface AccessibilityPropsIOS {
|
|
|
321
321
|
accessibilityViewIsModal?: boolean | undefined;
|
|
322
322
|
|
|
323
323
|
/**
|
|
324
|
-
* When
|
|
324
|
+
* When accessible is true, the system will invoke this function when the user performs the escape gesture (scrub with two fingers).
|
|
325
325
|
* @platform ios
|
|
326
326
|
*/
|
|
327
327
|
onAccessibilityEscape?: (() => void) | undefined;
|
|
@@ -395,19 +395,22 @@ export interface AccessibilityPropsWin32 {
|
|
|
395
395
|
* @platform win32
|
|
396
396
|
*/
|
|
397
397
|
accessibilityPositionInSet?: number;
|
|
398
|
+
'aria-posinset'?: number;
|
|
398
399
|
/**
|
|
399
400
|
* accessibilitySetSize
|
|
400
401
|
* @platform win32
|
|
401
402
|
*/
|
|
402
403
|
accessibilitySetSize?: ?number;
|
|
404
|
+
'aria-setsize'?: number;
|
|
403
405
|
|
|
404
406
|
/**
|
|
405
407
|
* accessibilityDescription provides more detailed information specific to the element (i.e. last edit date, full location for a file)
|
|
406
|
-
* while accessibilityHint provides
|
|
408
|
+
* while accessibilityHint provides information on what will happen when they perform an action.
|
|
407
409
|
* @platform win32
|
|
408
410
|
*
|
|
409
411
|
*/
|
|
410
412
|
accessibilityDescription?: string;
|
|
413
|
+
'aria-description'?: string;
|
|
411
414
|
|
|
412
415
|
/**
|
|
413
416
|
* Tells a person using a screen reader what kind of annotation they
|
|
@@ -432,6 +435,7 @@ export interface AccessibilityPropsWin32 {
|
|
|
432
435
|
* @platform win32
|
|
433
436
|
*/
|
|
434
437
|
accessibilityLevel?: number;
|
|
438
|
+
'aria-level'?: number | undefined;
|
|
435
439
|
|
|
436
440
|
/**
|
|
437
441
|
* Identifies the ItemType property, which is a text string describing the type of the automation element.
|
|
@@ -450,6 +454,7 @@ export interface AccessibilityPropsWin32 {
|
|
|
450
454
|
* @platform win32
|
|
451
455
|
*/
|
|
452
456
|
accessibilityControls?: string | undefined;
|
|
457
|
+
'aria-controls'?: string;
|
|
453
458
|
|
|
454
459
|
/**
|
|
455
460
|
* Windows Accessibility extensions for allowing other DOM elements to label or describe a given element.
|
|
@@ -458,6 +463,7 @@ export interface AccessibilityPropsWin32 {
|
|
|
458
463
|
* @platform win32
|
|
459
464
|
*/
|
|
460
465
|
accessibilityDescribedBy?: string | undefined;
|
|
466
|
+
'aria-describedby'?: string;
|
|
461
467
|
}
|
|
462
468
|
|
|
463
469
|
export type Role =
|
|
@@ -87,6 +87,8 @@ type MouseEventProps = $ReadOnly<{|
|
|
|
87
87
|
|
|
88
88
|
// Experimental/Work in Progress Pointer Event Callbacks (not yet ready for use)
|
|
89
89
|
type PointerEventProps = $ReadOnly<{|
|
|
90
|
+
onClick?: ?(event: PointerEvent) => void,
|
|
91
|
+
onClickCapture?: ?(event: PointerEvent) => void,
|
|
90
92
|
onPointerEnter?: ?(event: PointerEvent) => void,
|
|
91
93
|
onPointerEnterCapture?: ?(event: PointerEvent) => void,
|
|
92
94
|
onPointerLeave?: ?(event: PointerEvent) => void,
|
|
@@ -103,6 +105,10 @@ type PointerEventProps = $ReadOnly<{|
|
|
|
103
105
|
onPointerOverCapture?: ?(e: PointerEvent) => void,
|
|
104
106
|
onPointerOut?: ?(e: PointerEvent) => void,
|
|
105
107
|
onPointerOutCapture?: ?(e: PointerEvent) => void,
|
|
108
|
+
onGotPointerCapture?: ?(e: PointerEvent) => void,
|
|
109
|
+
onGotPointerCaptureCapture?: ?(e: PointerEvent) => void,
|
|
110
|
+
onLostPointerCapture?: ?(e: PointerEvent) => void,
|
|
111
|
+
onLostPointerCaptureCapture?: ?(e: PointerEvent) => void,
|
|
106
112
|
|}>;
|
|
107
113
|
|
|
108
114
|
type FocusEventProps = $ReadOnly<{|
|
|
@@ -158,8 +164,8 @@ type GestureResponderEventProps = $ReadOnly<{|
|
|
|
158
164
|
* `View.props.onResponderGrant: (event) => {}`, where `event` is a synthetic
|
|
159
165
|
* touch event as described above.
|
|
160
166
|
*
|
|
161
|
-
*
|
|
162
|
-
*
|
|
167
|
+
* Return true from this callback to prevent any other native components from
|
|
168
|
+
* becoming responder until this responder terminates (Android-only).
|
|
163
169
|
*
|
|
164
170
|
* See https://reactnative.dev/docs/view#onrespondergrant
|
|
165
171
|
*/
|
|
@@ -563,7 +569,16 @@ export type ViewProps = $ReadOnly<{|
|
|
|
563
569
|
collapsable?: ?boolean,
|
|
564
570
|
|
|
565
571
|
/**
|
|
566
|
-
*
|
|
572
|
+
* Contols whether this view, and its transitive children, are laid in a way
|
|
573
|
+
* consistent with web browsers ('strict'), or consistent with existing
|
|
574
|
+
* React Native code which may rely on incorrect behavior ('classic').
|
|
575
|
+
*
|
|
576
|
+
* This prop only works when using Fabric.
|
|
577
|
+
*/
|
|
578
|
+
experimental_layoutConformance?: ?('strict' | 'classic'),
|
|
579
|
+
|
|
580
|
+
/**
|
|
581
|
+
* Used to locate this view from native classes. Has precedence over `nativeID` prop.
|
|
567
582
|
*
|
|
568
583
|
* > This disables the 'layout-only view removal' optimization for this view!
|
|
569
584
|
*
|
|
@@ -88,6 +88,8 @@ type MouseEventProps = $ReadOnly<{|
|
|
|
88
88
|
|
|
89
89
|
// Experimental/Work in Progress Pointer Event Callbacks (not yet ready for use)
|
|
90
90
|
type PointerEventProps = $ReadOnly<{|
|
|
91
|
+
onClick?: ?(event: PointerEvent) => void,
|
|
92
|
+
onClickCapture?: ?(event: PointerEvent) => void,
|
|
91
93
|
onPointerEnter?: ?(event: PointerEvent) => void,
|
|
92
94
|
onPointerEnterCapture?: ?(event: PointerEvent) => void,
|
|
93
95
|
onPointerLeave?: ?(event: PointerEvent) => void,
|
|
@@ -104,6 +106,10 @@ type PointerEventProps = $ReadOnly<{|
|
|
|
104
106
|
onPointerOverCapture?: ?(e: PointerEvent) => void,
|
|
105
107
|
onPointerOut?: ?(e: PointerEvent) => void,
|
|
106
108
|
onPointerOutCapture?: ?(e: PointerEvent) => void,
|
|
109
|
+
onGotPointerCapture?: ?(e: PointerEvent) => void,
|
|
110
|
+
onGotPointerCaptureCapture?: ?(e: PointerEvent) => void,
|
|
111
|
+
onLostPointerCapture?: ?(e: PointerEvent) => void,
|
|
112
|
+
onLostPointerCaptureCapture?: ?(e: PointerEvent) => void,
|
|
107
113
|
|}>;
|
|
108
114
|
|
|
109
115
|
type FocusEventProps = $ReadOnly<{|
|
|
@@ -159,8 +165,8 @@ type GestureResponderEventProps = $ReadOnly<{|
|
|
|
159
165
|
* `View.props.onResponderGrant: (event) => {}`, where `event` is a synthetic
|
|
160
166
|
* touch event as described above.
|
|
161
167
|
*
|
|
162
|
-
*
|
|
163
|
-
*
|
|
168
|
+
* Return true from this callback to prevent any other native components from
|
|
169
|
+
* becoming responder until this responder terminates (Android-only).
|
|
164
170
|
*
|
|
165
171
|
* See https://reactnative.dev/docs/view#onrespondergrant
|
|
166
172
|
*/
|
|
@@ -465,10 +471,21 @@ type WindowsViewProps = $ReadOnly<{|
|
|
|
465
471
|
|
|
466
472
|
tabIndex?: ?number,
|
|
467
473
|
|
|
468
|
-
accessibilityPosInSet?: ?number,
|
|
469
474
|
accessibilitySetSize?: ?number,
|
|
475
|
+
accessibilityControls?: ?Stringish,
|
|
476
|
+
accessibilityDescribedBy?: ?Stringish,
|
|
477
|
+
accessibilityDescription?: ?Stringish,
|
|
478
|
+
accessibilityLevel?: ?number,
|
|
479
|
+
accessibilityPositionInSet?: ?number,
|
|
480
|
+
'aria-posinset'?: ?number,
|
|
481
|
+
'aria-setsize'?: ?number,
|
|
482
|
+
'aria-description'?: ?Stringish,
|
|
483
|
+
'aria-level'?: ?number,
|
|
484
|
+
'aria-controls'?: ?Stringish,
|
|
485
|
+
'aria-describedby'?: ?Stringish,
|
|
470
486
|
'aria-multiselectable'?: ?boolean,
|
|
471
487
|
'aria-required'?: ?boolean,
|
|
488
|
+
|
|
472
489
|
/**
|
|
473
490
|
* Specifies if the control should show System focus visuals
|
|
474
491
|
*/
|
|
@@ -613,7 +630,16 @@ export type ViewProps = $ReadOnly<{|
|
|
|
613
630
|
collapsable?: ?boolean,
|
|
614
631
|
|
|
615
632
|
/**
|
|
616
|
-
*
|
|
633
|
+
* Contols whether this view, and its transitive children, are laid in a way
|
|
634
|
+
* consistent with web browsers ('strict'), or consistent with existing
|
|
635
|
+
* React Native code which may rely on incorrect behavior ('classic').
|
|
636
|
+
*
|
|
637
|
+
* This prop only works when using Fabric.
|
|
638
|
+
*/
|
|
639
|
+
experimental_layoutConformance?: ?('strict' | 'classic'),
|
|
640
|
+
|
|
641
|
+
/**
|
|
642
|
+
* Used to locate this view from native classes. Has precedence over `nativeID` prop.
|
|
617
643
|
*
|
|
618
644
|
* > This disables the 'layout-only view removal' optimization for this view!
|
|
619
645
|
*
|
|
@@ -72,7 +72,7 @@ const ViewWin32: React.AbstractComponent<
|
|
|
72
72
|
) {
|
|
73
73
|
warnOnce(
|
|
74
74
|
'accessibilityDescribedByRef',
|
|
75
|
-
'accessibilityDescribedBy should be
|
|
75
|
+
'accessibilityDescribedBy should be specified as a string matching the nativeID of the target component. Support of specifying accessibilityDescribedBy using a ref is deprecated and will be removed in a future release',
|
|
76
76
|
);
|
|
77
77
|
// $FlowFixMe[incompatible-use] - Using accessibilityDescribedBy as Ref for backcompat, not typed
|
|
78
78
|
// $FlowFixMe[prop-missing]
|
|
@@ -90,7 +90,7 @@ const ViewWin32: React.AbstractComponent<
|
|
|
90
90
|
) {
|
|
91
91
|
warnOnce(
|
|
92
92
|
'accessibilityControlsRef',
|
|
93
|
-
'accessibilityControls should be
|
|
93
|
+
'accessibilityControls should be specified as a string matching the nativeID of the target component. Support of specifying accessibilityControls using a ref is deprecated and will be removed in a future release',
|
|
94
94
|
);
|
|
95
95
|
// $FlowFixMe[incompatible-use] - Using accessibilityControls as Ref for backcompat, not typed
|
|
96
96
|
// $FlowFixMe[prop-missing]
|
|
@@ -108,6 +108,7 @@ const ViewWin32: React.AbstractComponent<
|
|
|
108
108
|
{...(labeledByTarget !== null
|
|
109
109
|
? {accessibilityLabeledBy: labeledByTarget}
|
|
110
110
|
: {})}
|
|
111
|
+
// $FlowFixMe[exponential-spread]
|
|
111
112
|
{...(describedByTarget !== null
|
|
112
113
|
? // $FlowFixMe[exponential-spread]
|
|
113
114
|
{accessibilityDescribedBy: describedByTarget}
|
|
@@ -0,0 +1,152 @@
|
|
|
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
|
+
* @oncall react_native
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import Networking from '../../Network/RCTNetworking';
|
|
13
|
+
import HMRClient from '../../Utilities/HMRClient';
|
|
14
|
+
import LoadingView from '../../Utilities/LoadingView';
|
|
15
|
+
import getDevServer from './getDevServer';
|
|
16
|
+
|
|
17
|
+
declare var global: {globalEvalWithSourceUrl?: (string, string) => mixed, ...};
|
|
18
|
+
|
|
19
|
+
let pendingRequests = 0;
|
|
20
|
+
|
|
21
|
+
const cachedPromisesByUrl = new Map<string, Promise<void>>();
|
|
22
|
+
|
|
23
|
+
function asyncRequest(
|
|
24
|
+
url: string,
|
|
25
|
+
): Promise<{body: string, headers: {[string]: string}}> {
|
|
26
|
+
let id = null;
|
|
27
|
+
let responseText = null;
|
|
28
|
+
let headers = null;
|
|
29
|
+
let dataListener;
|
|
30
|
+
let completeListener;
|
|
31
|
+
let responseListener;
|
|
32
|
+
let incrementalDataListener;
|
|
33
|
+
return new Promise<{body: string, headers: {[string]: string}}>(
|
|
34
|
+
(resolve, reject) => {
|
|
35
|
+
dataListener = Networking.addListener(
|
|
36
|
+
'didReceiveNetworkData',
|
|
37
|
+
([requestId, response]) => {
|
|
38
|
+
if (requestId === id) {
|
|
39
|
+
responseText = response;
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
);
|
|
43
|
+
incrementalDataListener = Networking.addListener(
|
|
44
|
+
'didReceiveNetworkIncrementalData',
|
|
45
|
+
([requestId, data]) => {
|
|
46
|
+
if (requestId === id) {
|
|
47
|
+
if (responseText != null) {
|
|
48
|
+
responseText += data;
|
|
49
|
+
} else {
|
|
50
|
+
responseText = data;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
);
|
|
55
|
+
responseListener = Networking.addListener(
|
|
56
|
+
'didReceiveNetworkResponse',
|
|
57
|
+
([requestId, status, responseHeaders]) => {
|
|
58
|
+
if (requestId === id) {
|
|
59
|
+
headers = responseHeaders;
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
);
|
|
63
|
+
completeListener = Networking.addListener(
|
|
64
|
+
'didCompleteNetworkResponse',
|
|
65
|
+
([requestId, error]) => {
|
|
66
|
+
if (requestId === id) {
|
|
67
|
+
if (error) {
|
|
68
|
+
reject(error);
|
|
69
|
+
} else {
|
|
70
|
+
//$FlowFixMe[incompatible-call]
|
|
71
|
+
resolve({body: responseText, headers});
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
);
|
|
76
|
+
Networking.sendRequest(
|
|
77
|
+
'GET',
|
|
78
|
+
'asyncRequest',
|
|
79
|
+
url,
|
|
80
|
+
{},
|
|
81
|
+
'',
|
|
82
|
+
'text',
|
|
83
|
+
true,
|
|
84
|
+
0,
|
|
85
|
+
requestId => {
|
|
86
|
+
id = requestId;
|
|
87
|
+
},
|
|
88
|
+
true,
|
|
89
|
+
);
|
|
90
|
+
},
|
|
91
|
+
).finally(() => {
|
|
92
|
+
dataListener?.remove();
|
|
93
|
+
completeListener?.remove();
|
|
94
|
+
responseListener?.remove();
|
|
95
|
+
incrementalDataListener?.remove();
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function buildUrlForBundle(bundlePathAndQuery: string) {
|
|
100
|
+
const {url: serverUrl} = getDevServer();
|
|
101
|
+
return (
|
|
102
|
+
serverUrl.replace(/\/+$/, '') + '/' + bundlePathAndQuery.replace(/^\/+/, '')
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
module.exports = function (bundlePathAndQuery: string): Promise<void> {
|
|
107
|
+
const requestUrl = buildUrlForBundle(bundlePathAndQuery);
|
|
108
|
+
let loadPromise = cachedPromisesByUrl.get(requestUrl);
|
|
109
|
+
|
|
110
|
+
if (loadPromise) {
|
|
111
|
+
return loadPromise;
|
|
112
|
+
}
|
|
113
|
+
LoadingView.showMessage('Downloading...', 'load');
|
|
114
|
+
++pendingRequests;
|
|
115
|
+
|
|
116
|
+
loadPromise = asyncRequest(requestUrl)
|
|
117
|
+
.then<void>(({body, headers}) => {
|
|
118
|
+
if (
|
|
119
|
+
headers['Content-Type'] != null &&
|
|
120
|
+
headers['Content-Type'].indexOf('application/json') >= 0
|
|
121
|
+
) {
|
|
122
|
+
// Errors are returned as JSON.
|
|
123
|
+
throw new Error(
|
|
124
|
+
JSON.parse(body).message ||
|
|
125
|
+
`Unknown error fetching '${bundlePathAndQuery}'`,
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
HMRClient.registerBundle(requestUrl);
|
|
130
|
+
|
|
131
|
+
// Some engines do not support `sourceURL` as a comment. We expose a
|
|
132
|
+
// `globalEvalWithSourceUrl` function to handle updates in that case.
|
|
133
|
+
if (global.globalEvalWithSourceUrl) {
|
|
134
|
+
global.globalEvalWithSourceUrl(body, requestUrl);
|
|
135
|
+
} else {
|
|
136
|
+
// eslint-disable-next-line no-eval
|
|
137
|
+
eval(body);
|
|
138
|
+
}
|
|
139
|
+
})
|
|
140
|
+
.catch<void>(e => {
|
|
141
|
+
cachedPromisesByUrl.delete(requestUrl);
|
|
142
|
+
throw e;
|
|
143
|
+
})
|
|
144
|
+
.finally(() => {
|
|
145
|
+
if (!--pendingRequests) {
|
|
146
|
+
LoadingView.hide();
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
cachedPromisesByUrl.set(requestUrl, loadPromise);
|
|
151
|
+
return loadPromise;
|
|
152
|
+
};
|
|
@@ -31,6 +31,7 @@ export type SymbolicatedStackTrace = $ReadOnly<{
|
|
|
31
31
|
|
|
32
32
|
async function symbolicateStackTrace(
|
|
33
33
|
stack: Array<StackFrame>,
|
|
34
|
+
extraData?: mixed,
|
|
34
35
|
): Promise<SymbolicatedStackTrace> {
|
|
35
36
|
const devServer = getDevServer();
|
|
36
37
|
if (!devServer.bundleLoadedFromServer) {
|
|
@@ -41,7 +42,7 @@ async function symbolicateStackTrace(
|
|
|
41
42
|
const fetch = global.fetch ?? require('../../Network/fetch');
|
|
42
43
|
const response = await fetch(devServer.url + 'symbolicate', {
|
|
43
44
|
method: 'POST',
|
|
44
|
-
body: JSON.stringify({stack}),
|
|
45
|
+
body: JSON.stringify({stack, extraData}),
|
|
45
46
|
});
|
|
46
47
|
return await response.json();
|
|
47
48
|
}
|
|
@@ -78,6 +78,19 @@ function reportException(
|
|
|
78
78
|
message =
|
|
79
79
|
e.jsEngine == null ? message : `${message}, js engine: ${e.jsEngine}`;
|
|
80
80
|
|
|
81
|
+
// $FlowFixMe[unclear-type]
|
|
82
|
+
const extraData: Object = {
|
|
83
|
+
// $FlowFixMe[incompatible-use] we can't define a type with a Symbol-keyed field in flow
|
|
84
|
+
...e[decoratedExtraDataKey],
|
|
85
|
+
jsEngine: e.jsEngine,
|
|
86
|
+
rawStack: e.stack,
|
|
87
|
+
};
|
|
88
|
+
if (e.cause != null && typeof e.cause === 'object') {
|
|
89
|
+
extraData.stackSymbols = e.cause.stackSymbols;
|
|
90
|
+
extraData.stackReturnAddresses = e.cause.stackReturnAddresses;
|
|
91
|
+
extraData.stackElements = e.cause.stackElements;
|
|
92
|
+
}
|
|
93
|
+
|
|
81
94
|
const data = preprocessException({
|
|
82
95
|
message,
|
|
83
96
|
originalMessage: message === originalMessage ? null : originalMessage,
|
|
@@ -87,12 +100,7 @@ function reportException(
|
|
|
87
100
|
stack,
|
|
88
101
|
id: currentExceptionID,
|
|
89
102
|
isFatal,
|
|
90
|
-
extraData
|
|
91
|
-
// $FlowFixMe[incompatible-use] we can't define a type with a Symbol-keyed field in flow
|
|
92
|
-
...e[decoratedExtraDataKey],
|
|
93
|
-
jsEngine: e.jsEngine,
|
|
94
|
-
rawStack: e.stack,
|
|
95
|
-
},
|
|
103
|
+
extraData,
|
|
96
104
|
});
|
|
97
105
|
|
|
98
106
|
if (reportToConsole) {
|
|
@@ -117,7 +125,8 @@ function reportException(
|
|
|
117
125
|
}
|
|
118
126
|
}
|
|
119
127
|
|
|
120
|
-
declare var console:
|
|
128
|
+
declare var console: {
|
|
129
|
+
error: typeof console.error,
|
|
121
130
|
_errorOriginal: typeof console.error,
|
|
122
131
|
reportErrorsAsExceptions: boolean,
|
|
123
132
|
...
|
|
@@ -18,4 +18,16 @@ export type ExtendedError = Error &
|
|
|
18
18
|
// Note: A field keyed by the Symbol ExceptionsManager.decoratedExtraDataKey is also read from ExtendedErrors.
|
|
19
19
|
// This field isn't documented in the types as Flow does not support this usecase, but it's effectively:
|
|
20
20
|
// [decoratedExtraDataKey]?: {[string]: mixed},
|
|
21
|
+
|
|
22
|
+
// Included for native errors
|
|
23
|
+
cause?: {
|
|
24
|
+
name: string,
|
|
25
|
+
message: string,
|
|
26
|
+
// $FlowFixMe[unclear-type]
|
|
27
|
+
stackElements?: $ReadOnlyArray<Object>,
|
|
28
|
+
// $FlowFixMe[unclear-type]
|
|
29
|
+
stackSymbols?: $ReadOnlyArray<Object>,
|
|
30
|
+
// $FlowFixMe[unclear-type]
|
|
31
|
+
stackReturnAddresses?: $ReadOnlyArray<Object>,
|
|
32
|
+
},
|
|
21
33
|
};
|