@office-iss/react-native-win32 0.83.0-preview.1 → 0.84.0-preview.1
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/CHANGELOG.json +42 -6
- package/CHANGELOG.md +22 -5
- package/IntegrationTests/AccessibilityManagerTest.js +10 -7
- package/IntegrationTests/ImageCachePolicyTest.js +8 -8
- package/IntegrationTests/IntegrationTestsApp.js +3 -3
- package/IntegrationTests/LayoutEventsTest.js +1 -1
- package/IntegrationTests/TimersTest.js +1 -1
- package/IntegrationTests/WebSocketTest.js +1 -1
- 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 +6 -0
- package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js +6 -1
- package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.win32.js +8 -1
- package/Libraries/Components/Button.js +2 -5
- package/Libraries/Components/Button.win32.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.win32.js +14 -13
- package/Libraries/Components/TextInput/TextInput.flow.js +13 -13
- package/Libraries/Components/TextInput/TextInput.flow.win32.js +13 -13
- package/Libraries/Components/TextInput/TextInput.js +33 -34
- package/Libraries/Components/TextInput/TextInput.win32.js +39 -39
- package/Libraries/Components/Touchable/PooledClass.js +2 -2
- package/Libraries/Components/Touchable/TouchableBounce.js +3 -3
- package/Libraries/Components/Touchable/TouchableNativeFeedback.js +1 -1
- package/Libraries/Components/Touchable/TouchableNativeFeedback.win32.js +1 -1
- package/Libraries/Components/Touchable/TouchableWithoutFeedback.js +9 -9
- package/Libraries/Components/View/View.win32.js +5 -5
- package/Libraries/Components/View/ViewPropTypes.js +16 -6
- package/Libraries/Components/View/ViewPropTypes.win32.js +20 -10
- package/Libraries/Core/Devtools/loadBundleFromServer.js +6 -3
- package/Libraries/Core/Devtools/loadBundleFromServer.win32.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 +1 -1
- 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.win32.js +1 -1
- 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/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.win32.js +2 -2
- package/Libraries/Pressability/Pressability.js +9 -9
- package/Libraries/Pressability/Pressability.win32.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.win32.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.win32.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.win32.js +46 -6
- package/Libraries/Text/TextNativeComponent.js +1 -1
- package/Libraries/Text/TextNativeComponent.win32.js +1 -1
- package/Libraries/Text/TextProps.js +7 -7
- package/Libraries/Text/TextProps.win32.js +7 -7
- package/Libraries/Types/CodegenTypes.js +1 -1
- package/Libraries/Types/CoreEventTypes.js +31 -0
- package/Libraries/Types/CoreEventTypes.win32.js +30 -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/flow/HermesInternalType.js +6 -6
- package/flow/bom.js.flow +35 -28
- package/flow/cssom.js.flow +3 -3
- package/flow/dom.js.flow +34 -33
- package/index.js +3 -0
- package/index.win32.js +3 -0
- package/index.win32.js.flow +8 -0
- package/jest/mock.js +2 -2
- package/jest/mockComponent.js +1 -1
- package/jest/setup.js +1 -1
- package/overrides.json +23 -23
- package/package.json +19 -18
- package/src/private/animated/NativeAnimatedHelper.js +130 -125
- package/src/private/animated/NativeAnimatedHelper.win32.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/src-win/Libraries/Components/AccessibilityInfo/AccessibilityInfo.d.ts +6 -0
- package/src-win/index.win32.js.flow +8 -0
- package/src/private/devsupport/devmenu/elementinspector/NetworkOverlay.js +0 -628
- package/src/private/devsupport/devmenu/perfmonitor/PerformanceOverlay.js +0 -66
|
@@ -135,8 +135,8 @@ function reportException(
|
|
|
135
135
|
}
|
|
136
136
|
|
|
137
137
|
declare var console: {
|
|
138
|
-
error: (...data: $ReadOnlyArray<
|
|
139
|
-
_errorOriginal: (...data: $ReadOnlyArray<
|
|
138
|
+
error: (...data: $ReadOnlyArray<unknown>) => void,
|
|
139
|
+
_errorOriginal: (...data: $ReadOnlyArray<unknown>) => void,
|
|
140
140
|
reportErrorsAsExceptions: boolean,
|
|
141
141
|
...
|
|
142
142
|
};
|
|
@@ -148,7 +148,7 @@ let inExceptionHandler = false;
|
|
|
148
148
|
/**
|
|
149
149
|
* Logs exceptions to the (native) console and displays them
|
|
150
150
|
*/
|
|
151
|
-
function handleException(e:
|
|
151
|
+
function handleException(e: unknown, isFatal: boolean) {
|
|
152
152
|
// TODO(T196834299): We should really use a c++ turbomodule for this
|
|
153
153
|
const reportToConsole = true;
|
|
154
154
|
if (
|
|
@@ -17,7 +17,7 @@ export type RawEventEmitterEvent = $ReadOnly<{
|
|
|
17
17
|
// We expect, but do not/cannot require, that nativeEvent is an object
|
|
18
18
|
// with the properties: key, elementType (string), type (string), tag (numeric),
|
|
19
19
|
// and a stateNode of the native element/Fiber the event was emitted to.
|
|
20
|
-
nativeEvent: {[string]:
|
|
20
|
+
nativeEvent: {[string]: unknown},
|
|
21
21
|
}>;
|
|
22
22
|
|
|
23
23
|
type RawEventDefinitions = {
|
|
@@ -37,7 +37,7 @@ if (__DEV__) {
|
|
|
37
37
|
] as const
|
|
38
38
|
).forEach(level => {
|
|
39
39
|
const originalFunction = console[level];
|
|
40
|
-
console[level] = function (...args: $ReadOnlyArray<
|
|
40
|
+
console[level] = function (...args: $ReadOnlyArray<unknown>) {
|
|
41
41
|
HMRClient.log(level, args);
|
|
42
42
|
originalFunction.apply(console, args);
|
|
43
43
|
};
|
|
@@ -20,7 +20,7 @@ if (global.RN$useAlwaysAvailableJSErrorHandling !== true) {
|
|
|
20
20
|
|
|
21
21
|
// Set up error handler
|
|
22
22
|
if (!global.__fbDisableExceptionsManager) {
|
|
23
|
-
const handleError = (e:
|
|
23
|
+
const handleError = (e: unknown, isFatal: boolean) => {
|
|
24
24
|
try {
|
|
25
25
|
ExceptionsManager.handleException(e, isFatal);
|
|
26
26
|
} catch (ee) {
|
|
@@ -85,8 +85,8 @@ export default class NativeEventEmitter<
|
|
|
85
85
|
|
|
86
86
|
addListener<TEvent: $Keys<TEventToArgsMap>>(
|
|
87
87
|
eventType: TEvent,
|
|
88
|
-
listener: (...args: TEventToArgsMap[TEvent]) =>
|
|
89
|
-
context?:
|
|
88
|
+
listener: (...args: TEventToArgsMap[TEvent]) => unknown,
|
|
89
|
+
context?: unknown,
|
|
90
90
|
): EventSubscription {
|
|
91
91
|
this._nativeModule?.addListener(eventType);
|
|
92
92
|
let subscription: ?EventSubscription = RCTDeviceEventEmitter.addListener(
|
|
@@ -48,7 +48,7 @@ function generateRequestId() {
|
|
|
48
48
|
function getSize(
|
|
49
49
|
url: string,
|
|
50
50
|
success?: (width: number, height: number) => void,
|
|
51
|
-
failure?: (error:
|
|
51
|
+
failure?: (error: unknown) => void,
|
|
52
52
|
): void | Promise<ImageSize> {
|
|
53
53
|
const promise = NativeImageLoaderAndroid.getSize(url);
|
|
54
54
|
if (typeof success !== 'function') {
|
|
@@ -74,7 +74,7 @@ function getSizeWithHeaders(
|
|
|
74
74
|
url: string,
|
|
75
75
|
headers: {[string]: string, ...},
|
|
76
76
|
success?: (width: number, height: number) => void,
|
|
77
|
-
failure?: (error:
|
|
77
|
+
failure?: (error: unknown) => void,
|
|
78
78
|
): void | Promise<ImageSize> {
|
|
79
79
|
const promise = NativeImageLoaderAndroid.getSizeWithHeaders(url, headers);
|
|
80
80
|
if (typeof success !== 'function') {
|
|
@@ -33,7 +33,7 @@ import * as React from 'react';
|
|
|
33
33
|
function getSize(
|
|
34
34
|
uri: string,
|
|
35
35
|
success?: (width: number, height: number) => void,
|
|
36
|
-
failure?: (error:
|
|
36
|
+
failure?: (error: unknown) => void,
|
|
37
37
|
): void | Promise<ImageSize> {
|
|
38
38
|
const promise = NativeImageLoaderIOS.getSize(uri).then(([width, height]) => ({
|
|
39
39
|
width,
|
|
@@ -56,7 +56,7 @@ function getSizeWithHeaders(
|
|
|
56
56
|
uri: string,
|
|
57
57
|
headers: {[string]: string, ...},
|
|
58
58
|
success?: (width: number, height: number) => void,
|
|
59
|
-
failure?: (error:
|
|
59
|
+
failure?: (error: unknown) => void,
|
|
60
60
|
): void | Promise<ImageSize> {
|
|
61
61
|
const promise = NativeImageLoaderIOS.getSizeWithHeaders(uri, headers);
|
|
62
62
|
if (typeof success !== 'function') {
|
|
@@ -73,7 +73,7 @@ function getSizeWithHeaders(
|
|
|
73
73
|
uri: string,
|
|
74
74
|
headers: {[string]: string, ...},
|
|
75
75
|
success?: (width: number, height: number) => void,
|
|
76
|
-
failure?: (error:
|
|
76
|
+
failure?: (error: unknown) => void,
|
|
77
77
|
// $FlowFixMe[unclear-type]
|
|
78
78
|
): any {
|
|
79
79
|
return NativeImageLoaderWin32.getSizeWithHeaders(uri, headers)
|
|
@@ -220,7 +220,7 @@ export type ImagePropsBase = $ReadOnly<{
|
|
|
220
220
|
* See https://reactnative.dev/docs/image#onlayout
|
|
221
221
|
*/
|
|
222
222
|
|
|
223
|
-
onLayout?: ?(event: LayoutChangeEvent) =>
|
|
223
|
+
onLayout?: ?(event: LayoutChangeEvent) => unknown,
|
|
224
224
|
|
|
225
225
|
/**
|
|
226
226
|
* Invoked when load completes successfully.
|
|
@@ -28,7 +28,7 @@ type ImageComponentStaticsIOS = $ReadOnly<{
|
|
|
28
28
|
getSize(
|
|
29
29
|
uri: string,
|
|
30
30
|
success: (width: number, height: number) => void,
|
|
31
|
-
failure?: (error:
|
|
31
|
+
failure?: (error: unknown) => void,
|
|
32
32
|
): void,
|
|
33
33
|
|
|
34
34
|
getSizeWithHeaders(
|
|
@@ -39,7 +39,7 @@ type ImageComponentStaticsIOS = $ReadOnly<{
|
|
|
39
39
|
uri: string,
|
|
40
40
|
headers: {[string]: string, ...},
|
|
41
41
|
success: (width: number, height: number) => void,
|
|
42
|
-
failure?: (error:
|
|
42
|
+
failure?: (error: unknown) => void,
|
|
43
43
|
): void,
|
|
44
44
|
|
|
45
45
|
prefetch(url: string): Promise<boolean>,
|
|
@@ -98,7 +98,7 @@ const InteractionManagerStub = {
|
|
|
98
98
|
runAfterInteractions(task: ?Task): {
|
|
99
99
|
then: <U>(
|
|
100
100
|
onFulfill?: ?(void) => ?(Promise<U> | U),
|
|
101
|
-
onReject?: ?(error:
|
|
101
|
+
onReject?: ?(error: unknown) => ?(Promise<U> | U),
|
|
102
102
|
) => Promise<U>,
|
|
103
103
|
cancel: () => void,
|
|
104
104
|
...
|
|
@@ -165,8 +165,8 @@ const InteractionManagerStub = {
|
|
|
165
165
|
addListener(
|
|
166
166
|
eventType: string,
|
|
167
167
|
// $FlowFixMe[unclear-type]
|
|
168
|
-
listener: (...args: any) =>
|
|
169
|
-
context:
|
|
168
|
+
listener: (...args: any) => unknown,
|
|
169
|
+
context: unknown,
|
|
170
170
|
): EventSubscription {
|
|
171
171
|
return {
|
|
172
172
|
remove() {},
|
|
@@ -187,7 +187,7 @@ type ActiveCallback = (
|
|
|
187
187
|
type PassiveCallback = (
|
|
188
188
|
event: GestureResponderEvent,
|
|
189
189
|
gestureState: PanResponderGestureState,
|
|
190
|
-
) =>
|
|
190
|
+
) => unknown;
|
|
191
191
|
|
|
192
192
|
export type GestureResponderHandlerMethods = {
|
|
193
193
|
onMoveShouldSetResponder: (event: GestureResponderEvent) => boolean,
|
|
@@ -201,7 +201,7 @@ const LayoutAnimation = {
|
|
|
201
201
|
scaleY: 'scaleY',
|
|
202
202
|
scaleXY: 'scaleXY',
|
|
203
203
|
}) as LayoutAnimationProperties,
|
|
204
|
-
checkConfig(...args: Array<
|
|
204
|
+
checkConfig(...args: Array<unknown>) {
|
|
205
205
|
console.error('LayoutAnimation.checkConfig(...) has been disabled.');
|
|
206
206
|
},
|
|
207
207
|
Presets,
|
|
@@ -34,7 +34,7 @@ class LinkingImpl extends NativeEventEmitter<LinkingEventDefinitions> {
|
|
|
34
34
|
*/
|
|
35
35
|
addEventListener<K: $Keys<LinkingEventDefinitions>>(
|
|
36
36
|
eventType: K,
|
|
37
|
-
listener: (...LinkingEventDefinitions[K]) =>
|
|
37
|
+
listener: (...LinkingEventDefinitions[K]) => unknown,
|
|
38
38
|
): EventSubscription {
|
|
39
39
|
return this.addListener(eventType, listener);
|
|
40
40
|
}
|
|
@@ -172,7 +172,7 @@ function numColumnsOrDefault(numColumns: ?number) {
|
|
|
172
172
|
return numColumns ?? 1;
|
|
173
173
|
}
|
|
174
174
|
|
|
175
|
-
function isArrayLike(data:
|
|
175
|
+
function isArrayLike(data: unknown): boolean {
|
|
176
176
|
// $FlowExpectedError[incompatible-use]
|
|
177
177
|
return typeof Object(data).length === 'number';
|
|
178
178
|
}
|
|
@@ -413,7 +413,7 @@ class FlatList<ItemT = any> extends React.PureComponent<FlatListProps<ItemT>> {
|
|
|
413
413
|
}
|
|
414
414
|
}
|
|
415
415
|
|
|
416
|
-
setNativeProps(props: {[string]:
|
|
416
|
+
setNativeProps(props: {[string]: unknown, ...}) {
|
|
417
417
|
if (this._listRef) {
|
|
418
418
|
this._listRef.setNativeProps(props);
|
|
419
419
|
}
|
|
@@ -412,6 +412,21 @@ export function observe(observer: Observer): Subscription {
|
|
|
412
412
|
};
|
|
413
413
|
}
|
|
414
414
|
|
|
415
|
+
/**
|
|
416
|
+
* Same as observe(), but doesn't call notify observer sync at the time of subscription.
|
|
417
|
+
* Expected to be used only in LogBoxStateSubscription.
|
|
418
|
+
*/
|
|
419
|
+
function observeNext(observer: Observer): Subscription {
|
|
420
|
+
const subscription = {observer};
|
|
421
|
+
observers.add(subscription);
|
|
422
|
+
|
|
423
|
+
return {
|
|
424
|
+
unsubscribe(): void {
|
|
425
|
+
observers.delete(subscription);
|
|
426
|
+
},
|
|
427
|
+
};
|
|
428
|
+
}
|
|
429
|
+
|
|
415
430
|
type LogBoxStateSubscriptionProps = $ReadOnly<{}>;
|
|
416
431
|
type LogBoxStateSubscriptionState = $ReadOnly<{
|
|
417
432
|
logs: LogBoxLogs,
|
|
@@ -447,12 +462,11 @@ export function withSubscription(
|
|
|
447
462
|
}
|
|
448
463
|
|
|
449
464
|
_subscription: ?Subscription;
|
|
465
|
+
_updateStateOnMountTimeoutId: ?TimeoutID;
|
|
450
466
|
|
|
451
467
|
state: LogBoxStateSubscriptionState = {
|
|
452
|
-
logs: new Set(),
|
|
453
|
-
isDisabled: false,
|
|
454
468
|
hasError: false,
|
|
455
|
-
|
|
469
|
+
...getNextState(),
|
|
456
470
|
};
|
|
457
471
|
|
|
458
472
|
render(): React.Node {
|
|
@@ -472,12 +486,25 @@ export function withSubscription(
|
|
|
472
486
|
}
|
|
473
487
|
|
|
474
488
|
componentDidMount(): void {
|
|
475
|
-
this._subscription =
|
|
489
|
+
this._subscription = observeNext(data => {
|
|
476
490
|
this.setState(data);
|
|
477
491
|
});
|
|
492
|
+
|
|
493
|
+
/**
|
|
494
|
+
* This should cover the case when the state changes in between the first render and mount effect.
|
|
495
|
+
* We defer the state update to next task to avoid cascading update.
|
|
496
|
+
*/
|
|
497
|
+
this._updateStateOnMountTimeoutId = setTimeout(() => {
|
|
498
|
+
this._updateStateOnMountTimeoutId = null;
|
|
499
|
+
this.setState(getNextState());
|
|
500
|
+
}, 0);
|
|
478
501
|
}
|
|
479
502
|
|
|
480
503
|
componentWillUnmount(): void {
|
|
504
|
+
if (this._updateStateOnMountTimeoutId != null) {
|
|
505
|
+
clearTimeout(this._updateStateOnMountTimeoutId);
|
|
506
|
+
}
|
|
507
|
+
|
|
481
508
|
if (this._subscription != null) {
|
|
482
509
|
this._subscription.unsubscribe();
|
|
483
510
|
}
|
|
@@ -65,7 +65,7 @@ export type LogBoxLogData = $ReadOnly<{
|
|
|
65
65
|
componentStack: ComponentStack,
|
|
66
66
|
codeFrame?: ?CodeFrame,
|
|
67
67
|
isComponentError: boolean,
|
|
68
|
-
extraData?:
|
|
68
|
+
extraData?: unknown,
|
|
69
69
|
onNotificationPress?: ?() => void,
|
|
70
70
|
}>;
|
|
71
71
|
|
|
@@ -81,7 +81,7 @@ class LogBoxLog {
|
|
|
81
81
|
codeFrame: ?CodeFrame;
|
|
82
82
|
componentCodeFrame: ?CodeFrame;
|
|
83
83
|
isComponentError: boolean;
|
|
84
|
-
extraData:
|
|
84
|
+
extraData: unknown | void;
|
|
85
85
|
symbolicated:
|
|
86
86
|
| $ReadOnly<{error: null, stack: null, status: 'NONE'}>
|
|
87
87
|
| $ReadOnly<{error: null, stack: null, status: 'PENDING'}>
|
|
@@ -93,7 +93,7 @@ const RE_BABEL_CODE_FRAME_MARKER_PATTERN = new RegExp(
|
|
|
93
93
|
'm',
|
|
94
94
|
);
|
|
95
95
|
|
|
96
|
-
export function hasComponentStack(args: $ReadOnlyArray<
|
|
96
|
+
export function hasComponentStack(args: $ReadOnlyArray<unknown>): boolean {
|
|
97
97
|
for (const arg of args) {
|
|
98
98
|
if (typeof arg === 'string' && isComponentStack(arg)) {
|
|
99
99
|
return true;
|
|
@@ -136,7 +136,7 @@ export type ComponentStackType = 'legacy' | 'stack';
|
|
|
136
136
|
|
|
137
137
|
const SUBSTITUTION = UTFSequence.BOM + '%s';
|
|
138
138
|
|
|
139
|
-
export function parseInterpolation(args: $ReadOnlyArray<
|
|
139
|
+
export function parseInterpolation(args: $ReadOnlyArray<unknown>): $ReadOnly<{
|
|
140
140
|
category: Category,
|
|
141
141
|
message: Message,
|
|
142
142
|
}> {
|
|
@@ -444,7 +444,7 @@ export function parseLogBoxException(
|
|
|
444
444
|
};
|
|
445
445
|
}
|
|
446
446
|
|
|
447
|
-
export function withoutANSIColorStyles(message:
|
|
447
|
+
export function withoutANSIColorStyles(message: unknown): unknown {
|
|
448
448
|
if (typeof message !== 'string') {
|
|
449
449
|
return message;
|
|
450
450
|
}
|
|
@@ -456,14 +456,14 @@ export function withoutANSIColorStyles(message: mixed): mixed {
|
|
|
456
456
|
);
|
|
457
457
|
}
|
|
458
458
|
|
|
459
|
-
export function parseLogBoxLog(args: $ReadOnlyArray<
|
|
459
|
+
export function parseLogBoxLog(args: $ReadOnlyArray<unknown>): {
|
|
460
460
|
componentStack: ComponentStack,
|
|
461
461
|
componentStackType: ComponentStackType,
|
|
462
462
|
category: Category,
|
|
463
463
|
message: Message,
|
|
464
464
|
} {
|
|
465
465
|
const message = withoutANSIColorStyles(args[0]);
|
|
466
|
-
let argsWithoutComponentStack: Array<
|
|
466
|
+
let argsWithoutComponentStack: Array<unknown> = [];
|
|
467
467
|
let componentStack: ComponentStack = [];
|
|
468
468
|
let componentStackType = 'legacy';
|
|
469
469
|
|
|
@@ -27,7 +27,7 @@ interface ILogBox {
|
|
|
27
27
|
ignoreAllLogs(value?: boolean): void;
|
|
28
28
|
clearAllLogs(): void;
|
|
29
29
|
addLog(log: LogData): void;
|
|
30
|
-
addConsoleLog(level: 'warn' | 'error', ...args: Array<
|
|
30
|
+
addConsoleLog(level: 'warn' | 'error', ...args: Array<unknown>): void;
|
|
31
31
|
addException(error: ExtendedExceptionData): void;
|
|
32
32
|
}
|
|
33
33
|
|
|
@@ -42,7 +42,7 @@ if (__DEV__) {
|
|
|
42
42
|
} = require('./Data/parseLogBoxLog');
|
|
43
43
|
|
|
44
44
|
let originalConsoleWarn;
|
|
45
|
-
let consoleWarnImpl: (...args: Array<
|
|
45
|
+
let consoleWarnImpl: (...args: Array<unknown>) => void;
|
|
46
46
|
|
|
47
47
|
let isLogBoxInstalled: boolean = false;
|
|
48
48
|
|
|
@@ -56,7 +56,7 @@ if (__DEV__) {
|
|
|
56
56
|
|
|
57
57
|
if (global.RN$registerExceptionListener != null) {
|
|
58
58
|
global.RN$registerExceptionListener(
|
|
59
|
-
(error: ExtendedExceptionData & {preventDefault: () =>
|
|
59
|
+
(error: ExtendedExceptionData & {preventDefault: () => unknown}) => {
|
|
60
60
|
if (global.RN$isRuntimeReady?.() || !error.isFatal) {
|
|
61
61
|
error.preventDefault();
|
|
62
62
|
addException(error);
|
|
@@ -140,7 +140,7 @@ if (__DEV__) {
|
|
|
140
140
|
}
|
|
141
141
|
},
|
|
142
142
|
|
|
143
|
-
addConsoleLog(level: 'warn' | 'error', ...args: Array<
|
|
143
|
+
addConsoleLog(level: 'warn' | 'error', ...args: Array<unknown>) {
|
|
144
144
|
if (isLogBoxInstalled) {
|
|
145
145
|
let filteredLevel: 'warn' | 'error' | 'fatal' = level;
|
|
146
146
|
try {
|
|
@@ -207,13 +207,13 @@ if (__DEV__) {
|
|
|
207
207
|
}
|
|
208
208
|
}
|
|
209
209
|
|
|
210
|
-
const isRCTLogAdviceWarning = (...args: Array<
|
|
210
|
+
const isRCTLogAdviceWarning = (...args: Array<unknown>) => {
|
|
211
211
|
// RCTLogAdvice is a native logging function designed to show users
|
|
212
212
|
// a message in the console, but not show it to them in Logbox.
|
|
213
213
|
return typeof args[0] === 'string' && args[0].startsWith('(ADVICE)');
|
|
214
214
|
};
|
|
215
215
|
|
|
216
|
-
const registerWarning = (...args: Array<
|
|
216
|
+
const registerWarning = (...args: Array<unknown>): void => {
|
|
217
217
|
// Let warnings within LogBox itself fall through.
|
|
218
218
|
if (LogBoxData.isLogBoxErrorMessage(String(args[0]))) {
|
|
219
219
|
return;
|
|
@@ -271,7 +271,7 @@ if (__DEV__) {
|
|
|
271
271
|
// Do nothing.
|
|
272
272
|
},
|
|
273
273
|
|
|
274
|
-
addConsoleLog(level: 'warn' | 'error', ...args: Array<
|
|
274
|
+
addConsoleLog(level: 'warn' | 'error', ...args: Array<unknown>): void {
|
|
275
275
|
// Do nothing.
|
|
276
276
|
},
|
|
277
277
|
|
|
@@ -122,6 +122,18 @@ const bubblingEventTypes = {
|
|
|
122
122
|
bubbled: 'onFocus',
|
|
123
123
|
},
|
|
124
124
|
},
|
|
125
|
+
topKeyDown: {
|
|
126
|
+
phasedRegistrationNames: {
|
|
127
|
+
captured: 'onKeyDownCapture',
|
|
128
|
+
bubbled: 'onKeyDown',
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
topKeyUp: {
|
|
132
|
+
phasedRegistrationNames: {
|
|
133
|
+
captured: 'onKeyUpCapture',
|
|
134
|
+
bubbled: 'onKeyUp',
|
|
135
|
+
},
|
|
136
|
+
},
|
|
125
137
|
};
|
|
126
138
|
|
|
127
139
|
const directEventTypes = {
|
|
@@ -15,13 +15,13 @@ export type Difference =
|
|
|
15
15
|
| {
|
|
16
16
|
type: 'missing',
|
|
17
17
|
path: Array<string>,
|
|
18
|
-
nativeValue:
|
|
18
|
+
nativeValue: unknown,
|
|
19
19
|
}
|
|
20
20
|
| {
|
|
21
21
|
type: 'unequal',
|
|
22
22
|
path: Array<string>,
|
|
23
|
-
nativeValue:
|
|
24
|
-
staticValue:
|
|
23
|
+
nativeValue: unknown,
|
|
24
|
+
staticValue: unknown,
|
|
25
25
|
};
|
|
26
26
|
|
|
27
27
|
export type ValidationResult = ValidResult | InvalidResult;
|
|
@@ -143,6 +143,6 @@ function accumulateDifferences(
|
|
|
143
143
|
}
|
|
144
144
|
}
|
|
145
145
|
|
|
146
|
-
function ifObject(value:
|
|
146
|
+
function ifObject(value: unknown): ?{...} {
|
|
147
147
|
return typeof value === 'object' && !Array.isArray(value) ? value : null;
|
|
148
148
|
}
|
|
@@ -43,7 +43,7 @@ export function ConditionallyIgnoredEventHandlers<
|
|
|
43
43
|
return undefined;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
export function isIgnored(value:
|
|
46
|
+
export function isIgnored(value: unknown): boolean {
|
|
47
47
|
if (typeof value === 'object' && value != null) {
|
|
48
48
|
return ignoredViewConfigProps.has(value);
|
|
49
49
|
}
|
|
@@ -50,8 +50,8 @@ const emitter = new NativeEventEmitter<$FlowFixMe>(
|
|
|
50
50
|
const RCTNetworking = {
|
|
51
51
|
addListener<K: $Keys<RCTNetworkingEventDefinitions>>(
|
|
52
52
|
eventType: K,
|
|
53
|
-
listener: (...RCTNetworkingEventDefinitions[K]) =>
|
|
54
|
-
context?:
|
|
53
|
+
listener: (...RCTNetworkingEventDefinitions[K]) => unknown,
|
|
54
|
+
context?: unknown,
|
|
55
55
|
): EventSubscription {
|
|
56
56
|
// $FlowFixMe[incompatible-type]
|
|
57
57
|
return emitter.addListener(eventType, listener, context);
|
|
@@ -66,7 +66,7 @@ const RCTNetworking = {
|
|
|
66
66
|
responseType: NativeResponseType,
|
|
67
67
|
incrementalUpdates: boolean,
|
|
68
68
|
timeout: number,
|
|
69
|
-
callback: (requestId: number) =>
|
|
69
|
+
callback: (requestId: number) => unknown,
|
|
70
70
|
withCredentials: boolean,
|
|
71
71
|
) {
|
|
72
72
|
const body = convertRequestBody(data);
|
|
@@ -20,8 +20,8 @@ import {type NativeResponseType} from './XMLHttpRequest';
|
|
|
20
20
|
const RCTNetworking = {
|
|
21
21
|
addListener<K: $Keys<RCTNetworkingEventDefinitions>>(
|
|
22
22
|
eventType: K,
|
|
23
|
-
listener: (...RCTNetworkingEventDefinitions[K]) =>
|
|
24
|
-
context?:
|
|
23
|
+
listener: (...RCTNetworkingEventDefinitions[K]) => unknown,
|
|
24
|
+
context?: unknown,
|
|
25
25
|
): EventSubscription {
|
|
26
26
|
// $FlowFixMe[incompatible-type]
|
|
27
27
|
return RCTDeviceEventEmitter.addListener(eventType, listener, context);
|
|
@@ -19,8 +19,8 @@ declare const RCTNetworking: interface {
|
|
|
19
19
|
addListener<K: $Keys<RCTNetworkingEventDefinitions>>(
|
|
20
20
|
eventType: K,
|
|
21
21
|
// $FlowFixMe[invalid-computed-prop]
|
|
22
|
-
listener: (...RCTNetworkingEventDefinitions[K]) =>
|
|
23
|
-
context?:
|
|
22
|
+
listener: (...RCTNetworkingEventDefinitions[K]) => unknown,
|
|
23
|
+
context?: unknown,
|
|
24
24
|
): EventSubscription,
|
|
25
25
|
|
|
26
26
|
sendRequest(
|
|
@@ -20,8 +20,8 @@ import {type NativeResponseType} from './XMLHttpRequest';
|
|
|
20
20
|
const RCTNetworking = {
|
|
21
21
|
addListener<K: $Keys<RCTNetworkingEventDefinitions>>(
|
|
22
22
|
eventType: K,
|
|
23
|
-
listener: (...RCTNetworkingEventDefinitions[K]) =>
|
|
24
|
-
context?:
|
|
23
|
+
listener: (...RCTNetworkingEventDefinitions[K]) => unknown,
|
|
24
|
+
context?: unknown,
|
|
25
25
|
): EventSubscription {
|
|
26
26
|
// $FlowFixMe[incompatible-type]
|
|
27
27
|
return RCTDeviceEventEmitter.addListener(eventType, listener, context);
|
|
@@ -88,47 +88,47 @@ export type PressabilityConfig = $ReadOnly<{
|
|
|
88
88
|
/**
|
|
89
89
|
* Called after the element loses focus.
|
|
90
90
|
*/
|
|
91
|
-
onBlur?: ?(event: BlurEvent) =>
|
|
91
|
+
onBlur?: ?(event: BlurEvent) => unknown,
|
|
92
92
|
|
|
93
93
|
/**
|
|
94
94
|
* Called after the element is focused.
|
|
95
95
|
*/
|
|
96
|
-
onFocus?: ?(event: FocusEvent) =>
|
|
96
|
+
onFocus?: ?(event: FocusEvent) => unknown,
|
|
97
97
|
|
|
98
98
|
/**
|
|
99
99
|
* Called when the hover is activated to provide visual feedback.
|
|
100
100
|
*/
|
|
101
|
-
onHoverIn?: ?(event: MouseEvent) =>
|
|
101
|
+
onHoverIn?: ?(event: MouseEvent) => unknown,
|
|
102
102
|
|
|
103
103
|
/**
|
|
104
104
|
* Called when the hover is deactivated to undo visual feedback.
|
|
105
105
|
*/
|
|
106
|
-
onHoverOut?: ?(event: MouseEvent) =>
|
|
106
|
+
onHoverOut?: ?(event: MouseEvent) => unknown,
|
|
107
107
|
|
|
108
108
|
/**
|
|
109
109
|
* Called when a long press gesture has been triggered.
|
|
110
110
|
*/
|
|
111
|
-
onLongPress?: ?(event: GestureResponderEvent) =>
|
|
111
|
+
onLongPress?: ?(event: GestureResponderEvent) => unknown,
|
|
112
112
|
|
|
113
113
|
/**
|
|
114
114
|
* Called when a press gesture has been triggered.
|
|
115
115
|
*/
|
|
116
|
-
onPress?: ?(event: GestureResponderEvent) =>
|
|
116
|
+
onPress?: ?(event: GestureResponderEvent) => unknown,
|
|
117
117
|
|
|
118
118
|
/**
|
|
119
119
|
* Called when the press is activated to provide visual feedback.
|
|
120
120
|
*/
|
|
121
|
-
onPressIn?: ?(event: GestureResponderEvent) =>
|
|
121
|
+
onPressIn?: ?(event: GestureResponderEvent) => unknown,
|
|
122
122
|
|
|
123
123
|
/**
|
|
124
124
|
* Called when the press location moves. (This should rarely be used.)
|
|
125
125
|
*/
|
|
126
|
-
onPressMove?: ?(event: GestureResponderEvent) =>
|
|
126
|
+
onPressMove?: ?(event: GestureResponderEvent) => unknown,
|
|
127
127
|
|
|
128
128
|
/**
|
|
129
129
|
* Called when the press is deactivated to undo visual feedback.
|
|
130
130
|
*/
|
|
131
|
-
onPressOut?: ?(event: GestureResponderEvent) =>
|
|
131
|
+
onPressOut?: ?(event: GestureResponderEvent) => unknown,
|
|
132
132
|
|
|
133
133
|
/**
|
|
134
134
|
* Whether to prevent any other native components from becoming responder
|