react-native-windows 0.83.0-preview.2 → 0.84.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 +2 -2
- package/Folly/Folly.vcxproj +2 -0
- package/Libraries/Animated/AnimatedEvent.js +2 -2
- package/Libraries/Animated/animations/Animation.js +1 -3
- package/Libraries/Animated/createAnimatedComponent.js +8 -5
- package/Libraries/Animated/nodes/AnimatedColor.js +1 -1
- package/Libraries/Animated/nodes/AnimatedInterpolation.js +40 -4
- package/Libraries/Animated/nodes/AnimatedNode.js +3 -3
- package/Libraries/Animated/nodes/AnimatedObject.js +16 -11
- package/Libraries/Animated/nodes/AnimatedProps.js +43 -12
- package/Libraries/Animated/nodes/AnimatedStyle.js +12 -12
- package/Libraries/Animated/nodes/AnimatedValue.js +6 -3
- package/Libraries/Animated/nodes/AnimatedValueXY.js +1 -1
- package/Libraries/BatchedBridge/MessageQueue.js +24 -22
- package/Libraries/Blob/URL.js +34 -3
- package/Libraries/Blob/URLSearchParams.js +1 -0
- package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.d.ts +9 -1
- package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js +6 -1
- package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.windows.js +6 -1
- package/Libraries/Components/Button.js +2 -5
- package/Libraries/Components/Button.windows.js +2 -5
- package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js +1 -1
- package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroidTypes.js +4 -4
- package/Libraries/Components/Keyboard/Keyboard.js +2 -2
- package/Libraries/Components/Pressable/Pressable.js +8 -8
- package/Libraries/Components/Pressable/Pressable.windows.js +14 -13
- package/Libraries/Components/TextInput/TextInput.flow.js +13 -13
- package/Libraries/Components/TextInput/TextInput.flow.windows.js +19 -18
- package/Libraries/Components/TextInput/TextInput.js +33 -34
- package/Libraries/Components/TextInput/TextInput.windows.js +40 -39
- package/Libraries/Components/Touchable/PooledClass.js +2 -2
- package/Libraries/Components/Touchable/TouchableBounce.js +3 -3
- package/Libraries/Components/Touchable/TouchableBounce.windows.js +3 -3
- package/Libraries/Components/Touchable/TouchableNativeFeedback.js +1 -1
- package/Libraries/Components/Touchable/TouchableNativeFeedback.windows.js +1 -1
- package/Libraries/Components/Touchable/TouchableWithoutFeedback.js +9 -9
- package/Libraries/Components/Touchable/TouchableWithoutFeedback.windows.js +9 -9
- package/Libraries/Components/View/ViewPropTypes.js +16 -6
- package/Libraries/Components/View/ViewPropTypes.windows.js +21 -11
- package/Libraries/Core/Devtools/loadBundleFromServer.js +6 -3
- package/Libraries/Core/Devtools/loadBundleFromServer.windows.js +6 -3
- package/Libraries/Core/Devtools/symbolicateStackTrace.js +1 -1
- package/Libraries/Core/ExceptionsManager.js +3 -3
- package/Libraries/Core/RawEventEmitter.js +1 -1
- package/Libraries/Core/ReactFiberErrorDialog.js +1 -1
- package/Libraries/Core/ReactNativeVersion.js +3 -3
- package/Libraries/Core/setUpDeveloperTools.js +1 -1
- package/Libraries/Core/setUpErrorHandling.js +1 -1
- package/Libraries/EventEmitter/NativeEventEmitter.js +2 -2
- package/Libraries/Image/Image.android.js +2 -2
- package/Libraries/Image/Image.ios.js +2 -2
- package/Libraries/Image/Image.windows.js +2 -2
- package/Libraries/Image/ImageProps.js +1 -1
- package/Libraries/Image/ImageTypes.flow.js +2 -2
- package/Libraries/Interaction/InteractionManager.js +3 -3
- package/Libraries/Interaction/PanResponder.js +1 -1
- package/Libraries/LayoutAnimation/LayoutAnimation.js +1 -1
- package/Libraries/Linking/Linking.js +1 -1
- package/Libraries/Lists/FlatList.js +2 -2
- package/Libraries/LogBox/Data/LogBoxData.js +31 -4
- package/Libraries/LogBox/Data/LogBoxLog.js +2 -2
- package/Libraries/LogBox/Data/LogBoxSymbolication.js +1 -1
- package/Libraries/LogBox/Data/parseLogBoxLog.js +5 -5
- package/Libraries/LogBox/LogBox.js +7 -7
- package/Libraries/NativeComponent/BaseViewConfig.android.js +12 -0
- package/Libraries/NativeComponent/StaticViewConfigValidator.js +4 -4
- package/Libraries/NativeComponent/ViewConfigIgnore.js +1 -1
- package/Libraries/NativeComponent/ViewConfigIgnore.windows.js +1 -1
- package/Libraries/Network/RCTNetworking.android.js +3 -3
- package/Libraries/Network/RCTNetworking.ios.js +2 -2
- package/Libraries/Network/RCTNetworking.js.flow +2 -2
- package/Libraries/Network/RCTNetworking.windows.js +2 -2
- package/Libraries/Pressability/Pressability.js +9 -9
- package/Libraries/Pressability/Pressability.windows.js +17 -16
- package/Libraries/ReactNative/AppRegistry.flow.js +1 -1
- package/Libraries/ReactNative/BridgelessUIManager.js +1 -1
- package/Libraries/ReactNative/FabricUIManager.js +1 -1
- package/Libraries/ReactNative/PaperUIManager.js +1 -1
- package/Libraries/ReactNative/PaperUIManager.windows.js +1 -1
- package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstance.js +1 -1
- package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstanceUtils.js +2 -2
- package/Libraries/ReactNative/ReactFabricPublicInstance/ReactNativeAttributePayload.js +1 -1
- package/Libraries/ReactNative/RendererImplementation.js +1 -1
- package/Libraries/ReactNative/getNativeComponentAttributes.js +1 -1
- package/Libraries/ReactPrivate/ReactNativePrivateInterface.js +1 -2
- package/Libraries/Renderer/implementations/ReactFabric-dev.js +3 -3
- 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 +11 -4
- package/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js +11 -4
- package/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.js +11 -4
- package/Libraries/Renderer/shims/ReactFabric.js +3 -1
- package/Libraries/Renderer/shims/ReactFeatureFlags.js +3 -1
- package/Libraries/Renderer/shims/ReactNative.js +2 -2
- package/Libraries/Renderer/shims/ReactNativeTypes.js +3 -1
- package/Libraries/Renderer/shims/ReactNativeTypes.windows.js +3 -1
- package/Libraries/Renderer/shims/ReactNativeViewConfigRegistry.js +3 -1
- package/Libraries/Renderer/shims/createReactNativeComponentClass.js +3 -1
- package/Libraries/Settings/Settings.ios.js +1 -1
- package/Libraries/StyleSheet/PlatformColorValueTypes.android.js +2 -2
- package/Libraries/StyleSheet/PlatformColorValueTypes.ios.js +1 -1
- package/Libraries/StyleSheet/PlatformColorValueTypes.js.flow +4 -2
- package/Libraries/StyleSheet/StyleSheetExports.js +1 -1
- package/Libraries/StyleSheet/StyleSheetTypes.d.ts +99 -4
- package/Libraries/StyleSheet/StyleSheetTypes.js +6 -8
- package/Libraries/StyleSheet/processFilter.js +1 -1
- package/Libraries/Text/Text.js +46 -6
- package/Libraries/Text/Text.windows.js +46 -6
- package/Libraries/Text/TextNativeComponent.js +1 -1
- package/Libraries/Text/TextProps.js +7 -7
- package/Libraries/Text/TextProps.windows.js +7 -7
- package/Libraries/Types/CodegenTypes.js +1 -1
- package/Libraries/Types/CoreEventTypes.js +31 -0
- package/Libraries/Types/CoreEventTypes.windows.js +31 -13
- package/Libraries/Types/ReactDevToolsTypes.js +2 -2
- package/Libraries/Utilities/Appearance.js +2 -2
- package/Libraries/Utilities/DevLoadingView.js +8 -1
- package/Libraries/Utilities/DevSettings.js +3 -3
- package/Libraries/Utilities/HMRClient.js +4 -3
- package/Libraries/Utilities/RCTLog.js +3 -3
- package/Libraries/Utilities/ReactNativeTestTools.js +1 -1
- package/Libraries/Utilities/SceneTracker.js +1 -1
- package/Libraries/Utilities/codegenNativeCommands.js +1 -1
- package/Libraries/Utilities/deepFreezeAndThrowOnMutationInDev.js +3 -3
- package/Libraries/Utilities/logError.js +1 -1
- package/Libraries/Utilities/stringifySafe.js +7 -7
- package/Libraries/Utilities/useRefEffect.js +1 -1
- package/Libraries/WebSocket/WebSocketInterceptor.js +3 -3
- package/Libraries/promiseRejectionTrackingOptions.js +8 -8
- package/Libraries/vendor/core/ErrorUtils.js +10 -10
- package/Libraries/vendor/emitter/EventEmitter.js +6 -6
- package/Microsoft.ReactNative/Fabric/AbiViewProps.cpp +5 -0
- package/Microsoft.ReactNative/Fabric/AbiViewProps.h +1 -0
- package/Microsoft.ReactNative/Fabric/Composition/CompositionEventHandler.cpp +25 -5
- package/Microsoft.ReactNative/Fabric/Composition/CompositionEventHandler.h +2 -1
- package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.cpp +9 -3
- package/Microsoft.ReactNative/Fabric/FabricUIManagerModule.cpp +2 -3
- package/Microsoft.ReactNative/Fabric/ReactTaggedView.h +2 -2
- package/Microsoft.ReactNative/IReactCompositionViewComponentBuilder.idl +2 -0
- package/Microsoft.ReactNative/ReactHost/ReactInstanceWin.cpp +6 -0
- package/Microsoft.ReactNative/ViewProps.idl +9 -0
- package/Microsoft.ReactNative.Cxx/ReactCommon/TurboModule.h +12 -2
- package/PropertySheets/Generated/PackageVersion.g.props +3 -3
- package/ReactCommon/ReactCommon.vcxproj +7 -1
- package/ReactCommon/ReactCommon.vcxproj.filters +0 -3
- package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/JSIndexedRAMBundle.cpp +5 -5
- package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/ReactMarker.cpp +0 -1
- package/ReactCommon/TEMP_UntilReactCommonUpdate/jsiexecutor/jsireact/JSIExecutor.cpp +2 -43
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/nativemodule/core/ReactCommon/TurboModule.h +12 -2
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/attributedstring/TextAttributes.cpp +291 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/core/EventDispatcher.cpp +0 -1
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/core/EventQueueProcessor.cpp +1 -3
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/core/propsConversions.h +199 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/uimanager/UIManager.cpp +6 -0
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/runtime/ReactInstance.cpp +17 -10
- package/Scripts/creaternwapp.cmd +8 -1
- package/Scripts/creaternwlib.cmd +21 -2
- package/Shared/DevSettings.h +0 -3
- package/Shared/Modules/WebSocketModule.cpp +0 -1
- package/Shared/Modules/WebSocketModule.h +62 -3
- package/Shared/OInstance.cpp +5 -0
- package/Shared/Shared.vcxitems +4 -6
- package/Shared/Shared.vcxitems.filters +218 -709
- package/codegen/NativeAccessibilityManagerSpec.g.h +2 -0
- package/codegen/NativeAnimatedModuleSpec.g.h +21 -15
- package/codegen/NativeDevLoadingViewSpec.g.h +3 -3
- package/codegen/NativeIntentAndroidSpec.g.h +16 -3
- package/codegen/NativeReactNativeFeatureFlagsSpec.g.h +209 -191
- package/codegen/react/components/rnwcore/EventEmitters.h +1 -0
- package/codegen/react/components/rnwcore/Props.h +14 -0
- package/codegen/rnwcoreJSI.h +246 -211
- package/index.js +3 -0
- package/index.windows.js +3 -0
- package/jest/mock.js +2 -2
- package/jest/mockComponent.js +1 -1
- package/jest/setup.js +1 -1
- package/package.json +22 -21
- package/src/private/animated/NativeAnimatedHelper.js +130 -125
- package/src/private/animated/NativeAnimatedValidation.js +7 -4
- package/src/private/animated/createAnimatedPropsHook.js +13 -5
- package/src/private/animated/createAnimatedPropsMemoHook.js +10 -10
- package/src/private/components/virtualview/VirtualView.js +16 -9
- package/src/private/components/virtualview/logger/VirtualViewLogger.js +21 -0
- package/src/private/components/virtualview/logger/VirtualViewLoggerTypes.js +24 -0
- package/src/private/devsupport/devmenu/elementinspector/ElementProperties.js +1 -1
- package/src/private/devsupport/devmenu/elementinspector/Inspector.js +6 -25
- package/src/private/devsupport/devmenu/elementinspector/InspectorPanel.js +1 -27
- package/src/private/devsupport/devmenu/elementinspector/XHRInterceptor.js +3 -2
- package/src/private/featureflags/ReactNativeFeatureFlags.js +63 -42
- package/src/private/featureflags/ReactNativeFeatureFlagsBase.js +3 -3
- package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +12 -9
- package/src/private/renderer/errorhandling/ErrorHandlers.js +7 -4
- package/src/private/specs_DEPRECATED/modules/NativeAccessibilityManager.js +1 -1
- package/src/private/specs_DEPRECATED/modules/NativeAnimatedModule.js +4 -0
- package/src/private/specs_DEPRECATED/modules/NativeDevLoadingView.js +1 -0
- package/src/private/webapis/dom/events/CustomEvent.js +3 -3
- package/src/private/webapis/dom/nodes/internals/ReactNativeDocumentElementInstanceHandle.js +1 -1
- package/src/private/webapis/dom/nodes/internals/ReactNativeDocumentInstanceHandle.js +1 -1
- package/src/private/webapis/dom/nodes/specs/NativeDOM.js +29 -29
- package/src/private/webapis/dom/oldstylecollections/HTMLCollection.js +1 -1
- package/src/private/webapis/dom/oldstylecollections/NodeList.js +2 -2
- package/src/private/webapis/geometry/DOMRectReadOnly.js +1 -1
- package/src/private/webapis/html/events/MessageEvent.js +3 -3
- package/src/private/webapis/idlecallbacks/specs/NativeIdleCallbacks.js +3 -3
- package/src/private/webapis/intersectionobserver/IntersectionObserver.js +53 -5
- package/src/private/webapis/intersectionobserver/internals/IntersectionObserverManager.js +2 -2
- package/src/private/webapis/intersectionobserver/specs/NativeIntersectionObserver.js +4 -4
- package/src/private/webapis/microtasks/specs/NativeMicrotasks.js +1 -1
- package/src/private/webapis/mutationobserver/MutationObserver.js +1 -1
- package/src/private/webapis/mutationobserver/MutationRecord.js +1 -1
- package/src/private/webapis/mutationobserver/specs/NativeMutationObserver.js +4 -4
- package/src/private/webapis/performance/Performance.js +1 -1
- package/src/private/webapis/performance/UserTiming.js +1 -1
- package/src/private/webapis/performance/specs/NativePerformance.js +3 -3
- package/src/private/webapis/structuredClone/structuredClone.js +3 -3
- package/src/types/globals.d.ts +30 -1
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/image/conversions.h +0 -178
- package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/imagemanager/primitives.h +0 -183
- package/Shared/Modules/WebSocketTurboModule.h +0 -71
- package/src/private/devsupport/devmenu/elementinspector/NetworkOverlay.js +0 -628
- package/src/private/devsupport/devmenu/perfmonitor/PerformanceOverlay.js +0 -66
|
@@ -48,6 +48,7 @@ if (ReactNativeFeatureFlags.reduceDefaultPropsInText()) {
|
|
|
48
48
|
ref: forwardedRef,
|
|
49
49
|
accessible,
|
|
50
50
|
accessibilityLabel,
|
|
51
|
+
accessibilityRole,
|
|
51
52
|
accessibilityState,
|
|
52
53
|
allowFontScaling,
|
|
53
54
|
'aria-busy': ariaBusy,
|
|
@@ -85,6 +86,7 @@ if (ReactNativeFeatureFlags.reduceDefaultPropsInText()) {
|
|
|
85
86
|
onResponderTerminationRequest,
|
|
86
87
|
onStartShouldSetResponder,
|
|
87
88
|
pressRetentionOffset,
|
|
89
|
+
role,
|
|
88
90
|
selectable,
|
|
89
91
|
selectionColor,
|
|
90
92
|
suppressHighlighting,
|
|
@@ -185,6 +187,17 @@ if (ReactNativeFeatureFlags.reduceDefaultPropsInText()) {
|
|
|
185
187
|
onStartShouldSetResponder != null) &&
|
|
186
188
|
_disabled !== true;
|
|
187
189
|
|
|
190
|
+
const shouldUseLinkRole =
|
|
191
|
+
ReactNativeFeatureFlags.shouldUseLinkRoleForPressableText() &&
|
|
192
|
+
isPressable &&
|
|
193
|
+
accessibilityRole == null &&
|
|
194
|
+
role == null;
|
|
195
|
+
|
|
196
|
+
const _accessibilityRole =
|
|
197
|
+
accessibilityRole ?? (shouldUseLinkRole ? 'link' : undefined);
|
|
198
|
+
|
|
199
|
+
const _role = shouldUseLinkRole ? undefined : role;
|
|
200
|
+
|
|
188
201
|
// TODO: Move this processing to the view configuration.
|
|
189
202
|
const _selectionColor =
|
|
190
203
|
selectionColor != null ? processColor(selectionColor) : undefined;
|
|
@@ -242,6 +255,9 @@ if (ReactNativeFeatureFlags.reduceDefaultPropsInText()) {
|
|
|
242
255
|
if (_accessibilityLabel !== undefined) {
|
|
243
256
|
processedProps.accessibilityLabel = _accessibilityLabel;
|
|
244
257
|
}
|
|
258
|
+
if (_accessibilityRole !== undefined) {
|
|
259
|
+
processedProps.accessibilityRole = _accessibilityRole;
|
|
260
|
+
}
|
|
245
261
|
if (_accessibilityState !== undefined) {
|
|
246
262
|
processedProps.accessibilityState = _accessibilityState;
|
|
247
263
|
}
|
|
@@ -260,6 +276,9 @@ if (ReactNativeFeatureFlags.reduceDefaultPropsInText()) {
|
|
|
260
276
|
if (_selectionColor !== undefined) {
|
|
261
277
|
processedProps.selectionColor = _selectionColor;
|
|
262
278
|
}
|
|
279
|
+
if (_role !== undefined) {
|
|
280
|
+
processedProps.role = _role;
|
|
281
|
+
}
|
|
263
282
|
|
|
264
283
|
// [Windows accessibility properties
|
|
265
284
|
if (ariaLevel !== undefined) {
|
|
@@ -365,6 +384,7 @@ if (ReactNativeFeatureFlags.reduceDefaultPropsInText()) {
|
|
|
365
384
|
accessibilityElementsHidden,
|
|
366
385
|
importantForAccessibility,
|
|
367
386
|
accessibilityLabel,
|
|
387
|
+
accessibilityRole,
|
|
368
388
|
accessibilityState,
|
|
369
389
|
allowFontScaling,
|
|
370
390
|
'aria-busy': ariaBusy,
|
|
@@ -402,6 +422,7 @@ if (ReactNativeFeatureFlags.reduceDefaultPropsInText()) {
|
|
|
402
422
|
onResponderTerminationRequest,
|
|
403
423
|
onStartShouldSetResponder,
|
|
404
424
|
pressRetentionOffset,
|
|
425
|
+
role,
|
|
405
426
|
selectable,
|
|
406
427
|
selectionColor,
|
|
407
428
|
suppressHighlighting,
|
|
@@ -478,6 +499,17 @@ if (ReactNativeFeatureFlags.reduceDefaultPropsInText()) {
|
|
|
478
499
|
onStartShouldSetResponder != null) &&
|
|
479
500
|
_disabled !== true;
|
|
480
501
|
|
|
502
|
+
const shouldUseLinkRole =
|
|
503
|
+
ReactNativeFeatureFlags.shouldUseLinkRoleForPressableText() &&
|
|
504
|
+
isPressable &&
|
|
505
|
+
accessibilityRole == null &&
|
|
506
|
+
role == null;
|
|
507
|
+
|
|
508
|
+
const _accessibilityRole =
|
|
509
|
+
accessibilityRole ?? (shouldUseLinkRole ? 'link' : undefined);
|
|
510
|
+
|
|
511
|
+
const _role = shouldUseLinkRole ? undefined : role;
|
|
512
|
+
|
|
481
513
|
// TODO: Move this processing to the view configuration.
|
|
482
514
|
const _selectionColor =
|
|
483
515
|
selectionColor != null ? processColor(selectionColor) : undefined;
|
|
@@ -542,6 +574,7 @@ if (ReactNativeFeatureFlags.reduceDefaultPropsInText()) {
|
|
|
542
574
|
...restProps,
|
|
543
575
|
accessibilityElementsHidden: _accessibilityElementsHidden,
|
|
544
576
|
accessibilityLabel: _accessibilityLabel,
|
|
577
|
+
accessibilityRole: _accessibilityRole,
|
|
545
578
|
accessibilityState: _accessibilityState,
|
|
546
579
|
importantForAccessibility: _importantForAccessibility,
|
|
547
580
|
// #[Windows
|
|
@@ -556,6 +589,7 @@ if (ReactNativeFeatureFlags.reduceDefaultPropsInText()) {
|
|
|
556
589
|
selectionColor: _selectionColor,
|
|
557
590
|
style: _style,
|
|
558
591
|
disabled: disabled,
|
|
592
|
+
role: _role,
|
|
559
593
|
children,
|
|
560
594
|
}}
|
|
561
595
|
textPressabilityProps={{
|
|
@@ -581,6 +615,7 @@ if (ReactNativeFeatureFlags.reduceDefaultPropsInText()) {
|
|
|
581
615
|
{...restProps}
|
|
582
616
|
accessibilityElementsHidden={_accessibilityElementsHidden}
|
|
583
617
|
accessibilityLabel={_accessibilityLabel}
|
|
618
|
+
accessibilityRole={_accessibilityRole}
|
|
584
619
|
accessibilityState={_accessibilityState}
|
|
585
620
|
importantForAccessibility={_importantForAccessibility}
|
|
586
621
|
nativeID={_nativeID}
|
|
@@ -589,7 +624,8 @@ if (ReactNativeFeatureFlags.reduceDefaultPropsInText()) {
|
|
|
589
624
|
selectable={_selectable}
|
|
590
625
|
selectionColor={_selectionColor}
|
|
591
626
|
style={_style}
|
|
592
|
-
disabled={disabled}
|
|
627
|
+
disabled={disabled}
|
|
628
|
+
role={_role}>
|
|
593
629
|
{children}
|
|
594
630
|
</NativeVirtualText>
|
|
595
631
|
);
|
|
@@ -624,6 +660,7 @@ if (ReactNativeFeatureFlags.reduceDefaultPropsInText()) {
|
|
|
624
660
|
...restProps,
|
|
625
661
|
accessibilityElementsHidden: _accessibilityElementsHidden,
|
|
626
662
|
accessibilityLabel: _accessibilityLabel,
|
|
663
|
+
accessibilityRole: _accessibilityRole,
|
|
627
664
|
accessibilityState: _accessibilityState,
|
|
628
665
|
accessible: _accessible,
|
|
629
666
|
allowFontScaling: allowFontScaling !== false,
|
|
@@ -635,6 +672,7 @@ if (ReactNativeFeatureFlags.reduceDefaultPropsInText()) {
|
|
|
635
672
|
selectable: _selectable,
|
|
636
673
|
selectionColor: _selectionColor,
|
|
637
674
|
style: _style,
|
|
675
|
+
role: _role,
|
|
638
676
|
children,
|
|
639
677
|
}}
|
|
640
678
|
textPressabilityProps={{
|
|
@@ -659,6 +697,7 @@ if (ReactNativeFeatureFlags.reduceDefaultPropsInText()) {
|
|
|
659
697
|
{...restProps}
|
|
660
698
|
accessibilityElementsHidden={_accessibilityElementsHidden}
|
|
661
699
|
accessibilityLabel={_accessibilityLabel}
|
|
700
|
+
accessibilityRole={_accessibilityRole}
|
|
662
701
|
accessibilityState={_accessibilityState}
|
|
663
702
|
// #[Windows
|
|
664
703
|
accessibilityLevel={_accessibilityLevel} // Windows
|
|
@@ -675,7 +714,8 @@ if (ReactNativeFeatureFlags.reduceDefaultPropsInText()) {
|
|
|
675
714
|
ref={forwardedRef}
|
|
676
715
|
selectable={_selectable}
|
|
677
716
|
selectionColor={_selectionColor}
|
|
678
|
-
style={_style}
|
|
717
|
+
style={_style}
|
|
718
|
+
role={_role}>
|
|
679
719
|
{children}
|
|
680
720
|
</NativeText>
|
|
681
721
|
);
|
|
@@ -719,10 +759,10 @@ const TextImpl: component(
|
|
|
719
759
|
TextImpl.displayName = 'Text';
|
|
720
760
|
|
|
721
761
|
type TextPressabilityProps = $ReadOnly<{
|
|
722
|
-
onLongPress?: ?(event: GestureResponderEvent) =>
|
|
723
|
-
onPress?: ?(event: GestureResponderEvent) =>
|
|
724
|
-
onPressIn?: ?(event: GestureResponderEvent) =>
|
|
725
|
-
onPressOut?: ?(event: GestureResponderEvent) =>
|
|
762
|
+
onLongPress?: ?(event: GestureResponderEvent) => unknown,
|
|
763
|
+
onPress?: ?(event: GestureResponderEvent) => unknown,
|
|
764
|
+
onPressIn?: ?(event: GestureResponderEvent) => unknown,
|
|
765
|
+
onPressOut?: ?(event: GestureResponderEvent) => unknown,
|
|
726
766
|
onResponderGrant?: ?(event: GestureResponderEvent) => void,
|
|
727
767
|
onResponderMove?: ?(event: GestureResponderEvent) => void,
|
|
728
768
|
onResponderRelease?: ?(event: GestureResponderEvent) => void,
|
|
@@ -21,7 +21,7 @@ export type NativeTextProps = $ReadOnly<{
|
|
|
21
21
|
...TextProps,
|
|
22
22
|
isHighlighted?: ?boolean,
|
|
23
23
|
selectionColor?: ?ProcessedColorValue,
|
|
24
|
-
onClick?: ?(event: GestureResponderEvent) =>
|
|
24
|
+
onClick?: ?(event: GestureResponderEvent) => unknown,
|
|
25
25
|
// This is only needed for platforms that optimize text hit testing, e.g.,
|
|
26
26
|
// react-native-windows. It can be used to only hit test virtual text spans
|
|
27
27
|
// that have pressable events attached to them.
|
|
@@ -122,7 +122,7 @@ export type TextPropsAndroid = {
|
|
|
122
122
|
};
|
|
123
123
|
|
|
124
124
|
type TextBaseProps = $ReadOnly<{
|
|
125
|
-
onAccessibilityAction?: ?(event: AccessibilityActionEvent) =>
|
|
125
|
+
onAccessibilityAction?: ?(event: AccessibilityActionEvent) => unknown,
|
|
126
126
|
|
|
127
127
|
/**
|
|
128
128
|
* Whether fonts should scale to respect Text Size accessibility settings.
|
|
@@ -204,7 +204,7 @@ type TextBaseProps = $ReadOnly<{
|
|
|
204
204
|
*
|
|
205
205
|
* See https://reactnative.dev/docs/text#onlayout
|
|
206
206
|
*/
|
|
207
|
-
onLayout?: ?(event: LayoutChangeEvent) =>
|
|
207
|
+
onLayout?: ?(event: LayoutChangeEvent) => unknown,
|
|
208
208
|
|
|
209
209
|
/**
|
|
210
210
|
* This function is called on long press.
|
|
@@ -212,7 +212,7 @@ type TextBaseProps = $ReadOnly<{
|
|
|
212
212
|
*
|
|
213
213
|
* See https://reactnative.dev/docs/text#onlongpress
|
|
214
214
|
*/
|
|
215
|
-
onLongPress?: ?(event: GestureResponderEvent) =>
|
|
215
|
+
onLongPress?: ?(event: GestureResponderEvent) => unknown,
|
|
216
216
|
|
|
217
217
|
/**
|
|
218
218
|
* This function is called on press.
|
|
@@ -220,9 +220,9 @@ type TextBaseProps = $ReadOnly<{
|
|
|
220
220
|
*
|
|
221
221
|
* See https://reactnative.dev/docs/text#onpress
|
|
222
222
|
*/
|
|
223
|
-
onPress?: ?(event: GestureResponderEvent) =>
|
|
224
|
-
onPressIn?: ?(event: GestureResponderEvent) =>
|
|
225
|
-
onPressOut?: ?(event: GestureResponderEvent) =>
|
|
223
|
+
onPress?: ?(event: GestureResponderEvent) => unknown,
|
|
224
|
+
onPressIn?: ?(event: GestureResponderEvent) => unknown,
|
|
225
|
+
onPressOut?: ?(event: GestureResponderEvent) => unknown,
|
|
226
226
|
onResponderGrant?: ?(event: GestureResponderEvent) => void,
|
|
227
227
|
onResponderMove?: ?(event: GestureResponderEvent) => void,
|
|
228
228
|
onResponderRelease?: ?(event: GestureResponderEvent) => void,
|
|
@@ -230,7 +230,7 @@ type TextBaseProps = $ReadOnly<{
|
|
|
230
230
|
onResponderTerminationRequest?: ?() => boolean,
|
|
231
231
|
onStartShouldSetResponder?: ?() => boolean,
|
|
232
232
|
onMoveShouldSetResponder?: ?() => boolean,
|
|
233
|
-
onTextLayout?: ?(event: TextLayoutEvent) =>
|
|
233
|
+
onTextLayout?: ?(event: TextLayoutEvent) => unknown,
|
|
234
234
|
|
|
235
235
|
/**
|
|
236
236
|
* Defines how far your touch may move off of the button, before
|
|
@@ -122,7 +122,7 @@ export type TextPropsAndroid = {
|
|
|
122
122
|
};
|
|
123
123
|
|
|
124
124
|
type TextBaseProps = $ReadOnly<{
|
|
125
|
-
onAccessibilityAction?: ?(event: AccessibilityActionEvent) =>
|
|
125
|
+
onAccessibilityAction?: ?(event: AccessibilityActionEvent) => unknown,
|
|
126
126
|
accessibilityLevel?: ?number, // Windows
|
|
127
127
|
accessibilityPosInSet?: ?number, // Windows
|
|
128
128
|
accessibilitySetSize?: ?number, // Windows
|
|
@@ -214,7 +214,7 @@ type TextBaseProps = $ReadOnly<{
|
|
|
214
214
|
*
|
|
215
215
|
* See https://reactnative.dev/docs/text#onlayout
|
|
216
216
|
*/
|
|
217
|
-
onLayout?: ?(event: LayoutChangeEvent) =>
|
|
217
|
+
onLayout?: ?(event: LayoutChangeEvent) => unknown,
|
|
218
218
|
|
|
219
219
|
/**
|
|
220
220
|
* This function is called on long press.
|
|
@@ -222,7 +222,7 @@ type TextBaseProps = $ReadOnly<{
|
|
|
222
222
|
*
|
|
223
223
|
* See https://reactnative.dev/docs/text#onlongpress
|
|
224
224
|
*/
|
|
225
|
-
onLongPress?: ?(event: GestureResponderEvent) =>
|
|
225
|
+
onLongPress?: ?(event: GestureResponderEvent) => unknown,
|
|
226
226
|
|
|
227
227
|
/**
|
|
228
228
|
* This function is called on press.
|
|
@@ -230,9 +230,9 @@ type TextBaseProps = $ReadOnly<{
|
|
|
230
230
|
*
|
|
231
231
|
* See https://reactnative.dev/docs/text#onpress
|
|
232
232
|
*/
|
|
233
|
-
onPress?: ?(event: GestureResponderEvent) =>
|
|
234
|
-
onPressIn?: ?(event: GestureResponderEvent) =>
|
|
235
|
-
onPressOut?: ?(event: GestureResponderEvent) =>
|
|
233
|
+
onPress?: ?(event: GestureResponderEvent) => unknown,
|
|
234
|
+
onPressIn?: ?(event: GestureResponderEvent) => unknown,
|
|
235
|
+
onPressOut?: ?(event: GestureResponderEvent) => unknown,
|
|
236
236
|
onResponderGrant?: ?(event: GestureResponderEvent) => void,
|
|
237
237
|
onResponderMove?: ?(event: GestureResponderEvent) => void,
|
|
238
238
|
onResponderRelease?: ?(event: GestureResponderEvent) => void,
|
|
@@ -240,7 +240,7 @@ type TextBaseProps = $ReadOnly<{
|
|
|
240
240
|
onResponderTerminationRequest?: ?() => boolean,
|
|
241
241
|
onStartShouldSetResponder?: ?() => boolean,
|
|
242
242
|
onMoveShouldSetResponder?: ?() => boolean,
|
|
243
|
-
onTextLayout?: ?(event: TextLayoutEvent) =>
|
|
243
|
+
onTextLayout?: ?(event: TextLayoutEvent) => unknown,
|
|
244
244
|
|
|
245
245
|
/**
|
|
246
246
|
* Defines how far your touch may move off of the button, before
|
|
@@ -31,7 +31,7 @@ export type Float = number;
|
|
|
31
31
|
export type Int32 = number;
|
|
32
32
|
/* $FlowFixMe[unclear-type] Object is forbidden in strict mode */
|
|
33
33
|
export type UnsafeObject = Object;
|
|
34
|
-
export type UnsafeMixed =
|
|
34
|
+
export type UnsafeMixed = unknown;
|
|
35
35
|
|
|
36
36
|
type DefaultTypes = number | boolean | string | $ReadOnlyArray<string>;
|
|
37
37
|
// Default handling, ignore the unused value
|
|
@@ -322,3 +322,34 @@ export type MouseEvent = NativeSyntheticEvent<
|
|
|
322
322
|
timestamp: number,
|
|
323
323
|
}>,
|
|
324
324
|
>;
|
|
325
|
+
|
|
326
|
+
export type KeyEvent = $ReadOnly<{
|
|
327
|
+
/**
|
|
328
|
+
* The actual key that was pressed. For example, F would be "f" or "F" depending on the shift key.
|
|
329
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key
|
|
330
|
+
*/
|
|
331
|
+
key: string,
|
|
332
|
+
/**
|
|
333
|
+
* The key code of the key that was pressed. For example, F would be "KeyF"
|
|
334
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/code
|
|
335
|
+
*/
|
|
336
|
+
code: string,
|
|
337
|
+
altKey: boolean,
|
|
338
|
+
ctrlKey: boolean,
|
|
339
|
+
metaKey: boolean,
|
|
340
|
+
shiftKey: boolean,
|
|
341
|
+
/**
|
|
342
|
+
* A boolean value that is true if the given key is being held down such that it is automatically repeating.
|
|
343
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/repeat
|
|
344
|
+
*/
|
|
345
|
+
repeat?: boolean,
|
|
346
|
+
/**
|
|
347
|
+
* Returns a boolean value indicating if the event is fired within a composition session
|
|
348
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/CompositionEvent/isComposing
|
|
349
|
+
*/
|
|
350
|
+
isComposing?: boolean,
|
|
351
|
+
}>;
|
|
352
|
+
|
|
353
|
+
export type KeyUpEvent = NativeSyntheticEvent<KeyEvent>;
|
|
354
|
+
|
|
355
|
+
export type KeyDownEvent = NativeSyntheticEvent<KeyEvent>;
|
|
@@ -357,16 +357,34 @@ export type MouseEvent = NativeSyntheticEvent<
|
|
|
357
357
|
>;
|
|
358
358
|
// Windows]
|
|
359
359
|
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
360
|
+
export type KeyEvent = $ReadOnly<{
|
|
361
|
+
/**
|
|
362
|
+
* The actual key that was pressed. For example, F would be "f" or "F" depending on the shift key.
|
|
363
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key
|
|
364
|
+
*/
|
|
365
|
+
key: string,
|
|
366
|
+
/**
|
|
367
|
+
* The key code of the key that was pressed. For example, F would be "KeyF"
|
|
368
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/code
|
|
369
|
+
*/
|
|
370
|
+
code: string,
|
|
371
|
+
altKey: boolean,
|
|
372
|
+
ctrlKey: boolean,
|
|
373
|
+
metaKey: boolean,
|
|
374
|
+
shiftKey: boolean,
|
|
375
|
+
/**
|
|
376
|
+
* A boolean value that is true if the given key is being held down such that it is automatically repeating.
|
|
377
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/repeat
|
|
378
|
+
*/
|
|
379
|
+
repeat?: boolean,
|
|
380
|
+
/**
|
|
381
|
+
* Returns a boolean value indicating if the event is fired within a composition session
|
|
382
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/CompositionEvent/isComposing
|
|
383
|
+
*/
|
|
384
|
+
isComposing?: boolean,
|
|
385
|
+
eventPhase: number, // Windows
|
|
386
|
+
}>;
|
|
387
|
+
|
|
388
|
+
export type KeyUpEvent = NativeSyntheticEvent<KeyEvent>;
|
|
389
|
+
|
|
390
|
+
export type KeyDownEvent = NativeSyntheticEvent<KeyEvent>;
|
|
@@ -32,7 +32,7 @@ export type ReactDevToolsAgentEvents = {
|
|
|
32
32
|
};
|
|
33
33
|
|
|
34
34
|
export type ReactDevToolsAgent = {
|
|
35
|
-
selectNode(node:
|
|
35
|
+
selectNode(node: unknown): void,
|
|
36
36
|
stopInspectingNative(value: boolean): void,
|
|
37
37
|
addListener<Event: $Keys<ReactDevToolsAgentEvents>>(
|
|
38
38
|
event: Event,
|
|
@@ -48,6 +48,6 @@ export type ReactDevToolsGlobalHook = {
|
|
|
48
48
|
on: (eventName: string, (agent: ReactDevToolsAgent) => void) => void,
|
|
49
49
|
off: (eventName: string, (agent: ReactDevToolsAgent) => void) => void,
|
|
50
50
|
reactDevtoolsAgent?: ReactDevToolsAgent,
|
|
51
|
-
resolveRNStyle?:
|
|
51
|
+
resolveRNStyle?: unknown,
|
|
52
52
|
nativeStyleEditorValidAttributes?: Array<string>,
|
|
53
53
|
};
|
|
@@ -35,7 +35,7 @@ let lazyState: ?{
|
|
|
35
35
|
/**
|
|
36
36
|
* Ensures that all state and listeners are lazily initialized correctly.
|
|
37
37
|
*/
|
|
38
|
-
function getState():
|
|
38
|
+
function getState(): NonNullable<typeof lazyState> {
|
|
39
39
|
if (lazyState != null) {
|
|
40
40
|
return lazyState;
|
|
41
41
|
}
|
|
@@ -50,7 +50,7 @@ function getState(): $NonMaybeType<typeof lazyState> {
|
|
|
50
50
|
eventEmitter,
|
|
51
51
|
};
|
|
52
52
|
} else {
|
|
53
|
-
const state:
|
|
53
|
+
const state: NonNullable<typeof lazyState> = {
|
|
54
54
|
NativeAppearance,
|
|
55
55
|
appearance: null,
|
|
56
56
|
eventEmitter,
|
|
@@ -44,7 +44,11 @@ const COLOR_SCHEME = {
|
|
|
44
44
|
};
|
|
45
45
|
|
|
46
46
|
export default {
|
|
47
|
-
showMessage(
|
|
47
|
+
showMessage(
|
|
48
|
+
message: string,
|
|
49
|
+
type: 'load' | 'refresh' | 'error',
|
|
50
|
+
options?: {dismissButton?: boolean},
|
|
51
|
+
) {
|
|
48
52
|
if (NativeDevLoadingView) {
|
|
49
53
|
const colorScheme =
|
|
50
54
|
getColorScheme() === 'dark' ? COLOR_SCHEME.dark : COLOR_SCHEME.default;
|
|
@@ -59,10 +63,13 @@ export default {
|
|
|
59
63
|
textColor = processColor(colorSet.textColor);
|
|
60
64
|
}
|
|
61
65
|
|
|
66
|
+
const hasDismissButton = options?.dismissButton ?? false;
|
|
67
|
+
|
|
62
68
|
NativeDevLoadingView.showMessage(
|
|
63
69
|
message,
|
|
64
70
|
typeof textColor === 'number' ? textColor : null,
|
|
65
71
|
typeof backgroundColor === 'number' ? backgroundColor : null,
|
|
72
|
+
hasDismissButton,
|
|
66
73
|
);
|
|
67
74
|
}
|
|
68
75
|
},
|
|
@@ -24,7 +24,7 @@ let DevSettings: {
|
|
|
24
24
|
* @param title - The title of the menu item. Is internally used as id and should therefore be unique.
|
|
25
25
|
* @param handler - The callback invoked when pressing the menu item.
|
|
26
26
|
*/
|
|
27
|
-
addMenuItem(title: string, handler: () =>
|
|
27
|
+
addMenuItem(title: string, handler: () => unknown): void,
|
|
28
28
|
/**
|
|
29
29
|
* Reload the application.
|
|
30
30
|
*
|
|
@@ -33,7 +33,7 @@ let DevSettings: {
|
|
|
33
33
|
reload(reason?: string): void,
|
|
34
34
|
onFastRefresh(): void,
|
|
35
35
|
} = {
|
|
36
|
-
addMenuItem(title: string, handler: () =>
|
|
36
|
+
addMenuItem(title: string, handler: () => unknown): void {},
|
|
37
37
|
reload(reason?: string): void {},
|
|
38
38
|
onFastRefresh(): void {},
|
|
39
39
|
};
|
|
@@ -51,7 +51,7 @@ if (__DEV__) {
|
|
|
51
51
|
const subscriptions = new Map<string, EventSubscription>();
|
|
52
52
|
|
|
53
53
|
DevSettings = {
|
|
54
|
-
addMenuItem(title: string, handler: () =>
|
|
54
|
+
addMenuItem(title: string, handler: () => unknown): void {
|
|
55
55
|
// Make sure items are not added multiple times. This can
|
|
56
56
|
// happen when hot reloading the module that registers the
|
|
57
57
|
// menu items. The title is used as the id which means we
|
|
@@ -26,7 +26,7 @@ let hmrUnavailableReason: string | null = null;
|
|
|
26
26
|
let hmrOrigin: string | null = null;
|
|
27
27
|
let currentCompileErrorMessage: string | null = null;
|
|
28
28
|
let didConnect: boolean = false;
|
|
29
|
-
let pendingLogs: Array<[LogLevel, $ReadOnlyArray<
|
|
29
|
+
let pendingLogs: Array<[LogLevel, $ReadOnlyArray<unknown>]> = [];
|
|
30
30
|
|
|
31
31
|
type LogLevel =
|
|
32
32
|
| 'trace'
|
|
@@ -43,7 +43,7 @@ export type HMRClientNativeInterface = {
|
|
|
43
43
|
enable(): void,
|
|
44
44
|
disable(): void,
|
|
45
45
|
registerBundle(requestUrl: string): void,
|
|
46
|
-
log(level: LogLevel, data: $ReadOnlyArray<
|
|
46
|
+
log(level: LogLevel, data: $ReadOnlyArray<unknown>): void,
|
|
47
47
|
setup(
|
|
48
48
|
platform: string,
|
|
49
49
|
bundleEntry: string,
|
|
@@ -113,7 +113,7 @@ const HMRClient: HMRClientNativeInterface = {
|
|
|
113
113
|
registerBundleEntryPoints(hmrClient);
|
|
114
114
|
},
|
|
115
115
|
|
|
116
|
-
log(level: LogLevel, data: $ReadOnlyArray<
|
|
116
|
+
log(level: LogLevel, data: $ReadOnlyArray<unknown>) {
|
|
117
117
|
if (!hmrClient) {
|
|
118
118
|
// Catch a reasonable number of early logs
|
|
119
119
|
// in case hmrClient gets initialized later.
|
|
@@ -307,6 +307,7 @@ function setHMRUnavailableReason(reason: string) {
|
|
|
307
307
|
DevLoadingView.showMessage(
|
|
308
308
|
'Fast Refresh disconnected. Reload app to reconnect.',
|
|
309
309
|
'error',
|
|
310
|
+
{dismissButton: true},
|
|
310
311
|
);
|
|
311
312
|
console.warn(reason);
|
|
312
313
|
// (Not using the `warning` module to prevent a Buck cycle.)
|
|
@@ -20,11 +20,11 @@ const levelsMap = {
|
|
|
20
20
|
fatal: 'error',
|
|
21
21
|
};
|
|
22
22
|
|
|
23
|
-
let warningHandler: ?(...Array<
|
|
23
|
+
let warningHandler: ?(...Array<unknown>) => void = null;
|
|
24
24
|
|
|
25
25
|
const RCTLog = {
|
|
26
26
|
// level one of log, info, warn, error, mustfix
|
|
27
|
-
logIfNoNativeHook(level: string, ...args: Array<
|
|
27
|
+
logIfNoNativeHook(level: string, ...args: Array<unknown>): void {
|
|
28
28
|
// We already printed in the native console, so only log here if using a js debugger
|
|
29
29
|
if (typeof global.nativeLoggingHook === 'undefined') {
|
|
30
30
|
RCTLog.logToConsole(level, ...args);
|
|
@@ -37,7 +37,7 @@ const RCTLog = {
|
|
|
37
37
|
},
|
|
38
38
|
|
|
39
39
|
// Log to console regardless of nativeLoggingHook
|
|
40
|
-
logToConsole(level: string, ...args: Array<
|
|
40
|
+
logToConsole(level: string, ...args: Array<unknown>): void {
|
|
41
41
|
// $FlowFixMe[invalid-computed-prop]
|
|
42
42
|
const logFn = levelsMap[level];
|
|
43
43
|
invariant(
|
|
@@ -17,7 +17,7 @@ type NativeCommandsOptions<T = string> = $ReadOnly<{
|
|
|
17
17
|
function codegenNativeCommands<T: interface {}>(
|
|
18
18
|
options: NativeCommandsOptions<$Keys<T>>,
|
|
19
19
|
): T {
|
|
20
|
-
const commandObj: {[$Keys<T>]: (...$ReadOnlyArray<
|
|
20
|
+
const commandObj: {[$Keys<T>]: (...$ReadOnlyArray<unknown>) => void} = {};
|
|
21
21
|
|
|
22
22
|
options.supportedCommands.forEach(command => {
|
|
23
23
|
// $FlowFixMe[missing-local-annot]
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
* Freezing the object and adding the throw mechanism is expensive and will
|
|
28
28
|
* only be used in DEV.
|
|
29
29
|
*/
|
|
30
|
-
function deepFreezeAndThrowOnMutationInDev<T: {...} | Array<
|
|
30
|
+
function deepFreezeAndThrowOnMutationInDev<T: {...} | Array<unknown>>(
|
|
31
31
|
object: T,
|
|
32
32
|
): T {
|
|
33
33
|
if (__DEV__) {
|
|
@@ -43,7 +43,7 @@ function deepFreezeAndThrowOnMutationInDev<T: {...} | Array<mixed>>(
|
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
// $FlowFixMe[not-an-object] `object` can be an array, but Object.keys works with arrays too
|
|
46
|
-
const keys = Object.keys((object: {...} | Array<
|
|
46
|
+
const keys = Object.keys((object: {...} | Array<unknown>));
|
|
47
47
|
// $FlowFixMe[method-unbinding] added when improving typing for this parameters
|
|
48
48
|
const hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
49
49
|
|
|
@@ -85,7 +85,7 @@ function throwOnImmutableMutation(key: empty, value) {
|
|
|
85
85
|
);
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
-
function identity(value:
|
|
88
|
+
function identity(value: unknown) {
|
|
89
89
|
return value;
|
|
90
90
|
}
|
|
91
91
|
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* `console.error` as a failure callback - it's not properly bound. If passes an
|
|
16
16
|
* `Error` object, it will print the message and stack.
|
|
17
17
|
*/
|
|
18
|
-
const logError = function (...args: $ReadOnlyArray<
|
|
18
|
+
const logError = function (...args: $ReadOnlyArray<unknown>) {
|
|
19
19
|
if (args.length === 1 && args[0] instanceof Error) {
|
|
20
20
|
const err = args[0];
|
|
21
21
|
console.error('Error: "' + err.message + '". Stack:\n' + err.stack);
|
|
@@ -19,17 +19,17 @@ export function createStringifySafeWithLimits(limits: {
|
|
|
19
19
|
maxStringLimit?: number,
|
|
20
20
|
maxArrayLimit?: number,
|
|
21
21
|
maxObjectKeysLimit?: number,
|
|
22
|
-
}):
|
|
22
|
+
}): unknown => string {
|
|
23
23
|
const {
|
|
24
24
|
maxDepth = Number.POSITIVE_INFINITY,
|
|
25
25
|
maxStringLimit = Number.POSITIVE_INFINITY,
|
|
26
26
|
maxArrayLimit = Number.POSITIVE_INFINITY,
|
|
27
27
|
maxObjectKeysLimit = Number.POSITIVE_INFINITY,
|
|
28
28
|
} = limits;
|
|
29
|
-
const stack: Array<
|
|
29
|
+
const stack: Array<unknown> = [];
|
|
30
30
|
/* $FlowFixMe[missing-this-annot] The 'this' type annotation(s) required by
|
|
31
31
|
* Flow's LTI update could not be added via codemod */
|
|
32
|
-
function replacer(key: string, value:
|
|
32
|
+
function replacer(key: string, value: unknown): unknown {
|
|
33
33
|
while (stack.length && this !== stack[0]) {
|
|
34
34
|
stack.shift();
|
|
35
35
|
}
|
|
@@ -45,7 +45,7 @@ export function createStringifySafeWithLimits(limits: {
|
|
|
45
45
|
return value;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
let retval:
|
|
48
|
+
let retval: unknown = value;
|
|
49
49
|
if (Array.isArray(value)) {
|
|
50
50
|
if (stack.length >= maxDepth) {
|
|
51
51
|
retval = `[ ... array with ${value.length} values ... ]`;
|
|
@@ -64,7 +64,7 @@ export function createStringifySafeWithLimits(limits: {
|
|
|
64
64
|
retval = `{ ... object with ${keys.length} keys ... }`;
|
|
65
65
|
} else if (keys.length > maxObjectKeysLimit) {
|
|
66
66
|
// Return a sample of the keys.
|
|
67
|
-
retval = ({}: {[string]:
|
|
67
|
+
retval = ({}: {[string]: unknown});
|
|
68
68
|
for (let k of keys.slice(0, maxObjectKeysLimit)) {
|
|
69
69
|
retval[k] = value[k];
|
|
70
70
|
}
|
|
@@ -76,7 +76,7 @@ export function createStringifySafeWithLimits(limits: {
|
|
|
76
76
|
return retval;
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
-
return function stringifySafe(arg:
|
|
79
|
+
return function stringifySafe(arg: unknown): string {
|
|
80
80
|
if (arg === undefined) {
|
|
81
81
|
return 'undefined';
|
|
82
82
|
} else if (arg === null) {
|
|
@@ -111,7 +111,7 @@ export function createStringifySafeWithLimits(limits: {
|
|
|
111
111
|
};
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
-
const stringifySafe:
|
|
114
|
+
const stringifySafe: unknown => string = createStringifySafeWithLimits({
|
|
115
115
|
maxDepth: 10,
|
|
116
116
|
maxStringLimit: 100,
|
|
117
117
|
maxArrayLimit: 50,
|
|
@@ -33,10 +33,10 @@ let isInterceptorEnabled = false;
|
|
|
33
33
|
|
|
34
34
|
/**
|
|
35
35
|
* A network interceptor which monkey-patches RCTWebSocketModule methods
|
|
36
|
-
* to gather all websocket network
|
|
37
|
-
*
|
|
36
|
+
* to gather all websocket network events.
|
|
37
|
+
*
|
|
38
|
+
* @deprecated Since React Native 0.84
|
|
38
39
|
*/
|
|
39
|
-
|
|
40
40
|
const WebSocketInterceptor = {
|
|
41
41
|
/**
|
|
42
42
|
* Invoked when RCTWebSocketModule.close(...) is called.
|