@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.
Files changed (193) hide show
  1. package/.flowconfig +2 -2
  2. package/CHANGELOG.json +42 -6
  3. package/CHANGELOG.md +22 -5
  4. package/IntegrationTests/AccessibilityManagerTest.js +10 -7
  5. package/IntegrationTests/ImageCachePolicyTest.js +8 -8
  6. package/IntegrationTests/IntegrationTestsApp.js +3 -3
  7. package/IntegrationTests/LayoutEventsTest.js +1 -1
  8. package/IntegrationTests/TimersTest.js +1 -1
  9. package/IntegrationTests/WebSocketTest.js +1 -1
  10. package/Libraries/Animated/AnimatedEvent.js +2 -2
  11. package/Libraries/Animated/animations/Animation.js +1 -3
  12. package/Libraries/Animated/createAnimatedComponent.js +8 -5
  13. package/Libraries/Animated/nodes/AnimatedColor.js +1 -1
  14. package/Libraries/Animated/nodes/AnimatedInterpolation.js +40 -4
  15. package/Libraries/Animated/nodes/AnimatedNode.js +3 -3
  16. package/Libraries/Animated/nodes/AnimatedObject.js +16 -11
  17. package/Libraries/Animated/nodes/AnimatedProps.js +43 -12
  18. package/Libraries/Animated/nodes/AnimatedStyle.js +12 -12
  19. package/Libraries/Animated/nodes/AnimatedValue.js +6 -3
  20. package/Libraries/Animated/nodes/AnimatedValueXY.js +1 -1
  21. package/Libraries/BatchedBridge/MessageQueue.js +24 -22
  22. package/Libraries/Blob/URL.js +34 -3
  23. package/Libraries/Blob/URLSearchParams.js +1 -0
  24. package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.d.ts +6 -0
  25. package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js +6 -1
  26. package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.win32.js +8 -1
  27. package/Libraries/Components/Button.js +2 -5
  28. package/Libraries/Components/Button.win32.js +2 -5
  29. package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js +1 -1
  30. package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroidTypes.js +4 -4
  31. package/Libraries/Components/Keyboard/Keyboard.js +2 -2
  32. package/Libraries/Components/Pressable/Pressable.js +8 -8
  33. package/Libraries/Components/Pressable/Pressable.win32.js +14 -13
  34. package/Libraries/Components/TextInput/TextInput.flow.js +13 -13
  35. package/Libraries/Components/TextInput/TextInput.flow.win32.js +13 -13
  36. package/Libraries/Components/TextInput/TextInput.js +33 -34
  37. package/Libraries/Components/TextInput/TextInput.win32.js +39 -39
  38. package/Libraries/Components/Touchable/PooledClass.js +2 -2
  39. package/Libraries/Components/Touchable/TouchableBounce.js +3 -3
  40. package/Libraries/Components/Touchable/TouchableNativeFeedback.js +1 -1
  41. package/Libraries/Components/Touchable/TouchableNativeFeedback.win32.js +1 -1
  42. package/Libraries/Components/Touchable/TouchableWithoutFeedback.js +9 -9
  43. package/Libraries/Components/View/View.win32.js +5 -5
  44. package/Libraries/Components/View/ViewPropTypes.js +16 -6
  45. package/Libraries/Components/View/ViewPropTypes.win32.js +20 -10
  46. package/Libraries/Core/Devtools/loadBundleFromServer.js +6 -3
  47. package/Libraries/Core/Devtools/loadBundleFromServer.win32.js +6 -3
  48. package/Libraries/Core/Devtools/symbolicateStackTrace.js +1 -1
  49. package/Libraries/Core/ExceptionsManager.js +3 -3
  50. package/Libraries/Core/RawEventEmitter.js +1 -1
  51. package/Libraries/Core/ReactFiberErrorDialog.js +1 -1
  52. package/Libraries/Core/ReactNativeVersion.js +1 -1
  53. package/Libraries/Core/setUpDeveloperTools.js +1 -1
  54. package/Libraries/Core/setUpErrorHandling.js +1 -1
  55. package/Libraries/EventEmitter/NativeEventEmitter.js +2 -2
  56. package/Libraries/Image/Image.android.js +2 -2
  57. package/Libraries/Image/Image.ios.js +2 -2
  58. package/Libraries/Image/Image.win32.js +1 -1
  59. package/Libraries/Image/ImageProps.js +1 -1
  60. package/Libraries/Image/ImageTypes.flow.js +2 -2
  61. package/Libraries/Interaction/InteractionManager.js +3 -3
  62. package/Libraries/Interaction/PanResponder.js +1 -1
  63. package/Libraries/LayoutAnimation/LayoutAnimation.js +1 -1
  64. package/Libraries/Linking/Linking.js +1 -1
  65. package/Libraries/Lists/FlatList.js +2 -2
  66. package/Libraries/LogBox/Data/LogBoxData.js +31 -4
  67. package/Libraries/LogBox/Data/LogBoxLog.js +2 -2
  68. package/Libraries/LogBox/Data/LogBoxSymbolication.js +1 -1
  69. package/Libraries/LogBox/Data/parseLogBoxLog.js +5 -5
  70. package/Libraries/LogBox/LogBox.js +7 -7
  71. package/Libraries/NativeComponent/BaseViewConfig.android.js +12 -0
  72. package/Libraries/NativeComponent/StaticViewConfigValidator.js +4 -4
  73. package/Libraries/NativeComponent/ViewConfigIgnore.js +1 -1
  74. package/Libraries/Network/RCTNetworking.android.js +3 -3
  75. package/Libraries/Network/RCTNetworking.ios.js +2 -2
  76. package/Libraries/Network/RCTNetworking.js.flow +2 -2
  77. package/Libraries/Network/RCTNetworking.win32.js +2 -2
  78. package/Libraries/Pressability/Pressability.js +9 -9
  79. package/Libraries/Pressability/Pressability.win32.js +17 -16
  80. package/Libraries/ReactNative/AppRegistry.flow.js +1 -1
  81. package/Libraries/ReactNative/BridgelessUIManager.js +1 -1
  82. package/Libraries/ReactNative/FabricUIManager.js +1 -1
  83. package/Libraries/ReactNative/PaperUIManager.js +1 -1
  84. package/Libraries/ReactNative/PaperUIManager.win32.js +1 -1
  85. package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstance.js +1 -1
  86. package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstanceUtils.js +2 -2
  87. package/Libraries/ReactNative/ReactFabricPublicInstance/ReactNativeAttributePayload.js +1 -1
  88. package/Libraries/ReactNative/RendererImplementation.js +1 -1
  89. package/Libraries/ReactNative/getNativeComponentAttributes.js +1 -1
  90. package/Libraries/ReactPrivate/ReactNativePrivateInterface.js +1 -2
  91. package/Libraries/Renderer/implementations/ReactFabric-dev.js +3 -3
  92. package/Libraries/Renderer/implementations/ReactFabric-prod.js +3 -3
  93. package/Libraries/Renderer/implementations/ReactFabric-profiling.js +3 -3
  94. package/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js +11 -4
  95. package/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js +11 -4
  96. package/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.js +11 -4
  97. package/Libraries/Renderer/shims/ReactFabric.js +3 -1
  98. package/Libraries/Renderer/shims/ReactFeatureFlags.js +3 -1
  99. package/Libraries/Renderer/shims/ReactNative.js +2 -2
  100. package/Libraries/Renderer/shims/ReactNativeTypes.js +3 -1
  101. package/Libraries/Renderer/shims/ReactNativeTypes.win32.js +3 -1
  102. package/Libraries/Renderer/shims/ReactNativeViewConfigRegistry.js +3 -1
  103. package/Libraries/Renderer/shims/createReactNativeComponentClass.js +3 -1
  104. package/Libraries/Settings/Settings.ios.js +1 -1
  105. package/Libraries/StyleSheet/PlatformColorValueTypes.android.js +2 -2
  106. package/Libraries/StyleSheet/PlatformColorValueTypes.ios.js +1 -1
  107. package/Libraries/StyleSheet/PlatformColorValueTypes.js.flow +4 -2
  108. package/Libraries/StyleSheet/StyleSheetExports.js +1 -1
  109. package/Libraries/StyleSheet/StyleSheetTypes.d.ts +99 -4
  110. package/Libraries/StyleSheet/StyleSheetTypes.js +6 -8
  111. package/Libraries/StyleSheet/processFilter.js +1 -1
  112. package/Libraries/Text/Text.js +46 -6
  113. package/Libraries/Text/Text.win32.js +46 -6
  114. package/Libraries/Text/TextNativeComponent.js +1 -1
  115. package/Libraries/Text/TextNativeComponent.win32.js +1 -1
  116. package/Libraries/Text/TextProps.js +7 -7
  117. package/Libraries/Text/TextProps.win32.js +7 -7
  118. package/Libraries/Types/CodegenTypes.js +1 -1
  119. package/Libraries/Types/CoreEventTypes.js +31 -0
  120. package/Libraries/Types/CoreEventTypes.win32.js +30 -13
  121. package/Libraries/Types/ReactDevToolsTypes.js +2 -2
  122. package/Libraries/Utilities/Appearance.js +2 -2
  123. package/Libraries/Utilities/DevLoadingView.js +8 -1
  124. package/Libraries/Utilities/DevSettings.js +3 -3
  125. package/Libraries/Utilities/HMRClient.js +4 -3
  126. package/Libraries/Utilities/RCTLog.js +3 -3
  127. package/Libraries/Utilities/ReactNativeTestTools.js +1 -1
  128. package/Libraries/Utilities/SceneTracker.js +1 -1
  129. package/Libraries/Utilities/codegenNativeCommands.js +1 -1
  130. package/Libraries/Utilities/deepFreezeAndThrowOnMutationInDev.js +3 -3
  131. package/Libraries/Utilities/logError.js +1 -1
  132. package/Libraries/Utilities/stringifySafe.js +7 -7
  133. package/Libraries/Utilities/useRefEffect.js +1 -1
  134. package/Libraries/WebSocket/WebSocketInterceptor.js +3 -3
  135. package/Libraries/promiseRejectionTrackingOptions.js +8 -8
  136. package/Libraries/vendor/core/ErrorUtils.js +10 -10
  137. package/Libraries/vendor/emitter/EventEmitter.js +6 -6
  138. package/flow/HermesInternalType.js +6 -6
  139. package/flow/bom.js.flow +35 -28
  140. package/flow/cssom.js.flow +3 -3
  141. package/flow/dom.js.flow +34 -33
  142. package/index.js +3 -0
  143. package/index.win32.js +3 -0
  144. package/index.win32.js.flow +8 -0
  145. package/jest/mock.js +2 -2
  146. package/jest/mockComponent.js +1 -1
  147. package/jest/setup.js +1 -1
  148. package/overrides.json +23 -23
  149. package/package.json +19 -18
  150. package/src/private/animated/NativeAnimatedHelper.js +130 -125
  151. package/src/private/animated/NativeAnimatedHelper.win32.js +130 -125
  152. package/src/private/animated/NativeAnimatedValidation.js +7 -4
  153. package/src/private/animated/createAnimatedPropsHook.js +13 -5
  154. package/src/private/animated/createAnimatedPropsMemoHook.js +10 -10
  155. package/src/private/components/virtualview/VirtualView.js +16 -9
  156. package/src/private/components/virtualview/logger/VirtualViewLogger.js +21 -0
  157. package/src/private/components/virtualview/logger/VirtualViewLoggerTypes.js +24 -0
  158. package/src/private/devsupport/devmenu/elementinspector/ElementProperties.js +1 -1
  159. package/src/private/devsupport/devmenu/elementinspector/Inspector.js +6 -25
  160. package/src/private/devsupport/devmenu/elementinspector/InspectorPanel.js +1 -27
  161. package/src/private/devsupport/devmenu/elementinspector/XHRInterceptor.js +3 -2
  162. package/src/private/featureflags/ReactNativeFeatureFlags.js +63 -42
  163. package/src/private/featureflags/ReactNativeFeatureFlagsBase.js +3 -3
  164. package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +12 -9
  165. package/src/private/renderer/errorhandling/ErrorHandlers.js +7 -4
  166. package/src/private/specs_DEPRECATED/modules/NativeAccessibilityManager.js +1 -1
  167. package/src/private/specs_DEPRECATED/modules/NativeAnimatedModule.js +4 -0
  168. package/src/private/specs_DEPRECATED/modules/NativeDevLoadingView.js +1 -0
  169. package/src/private/webapis/dom/events/CustomEvent.js +3 -3
  170. package/src/private/webapis/dom/nodes/internals/ReactNativeDocumentElementInstanceHandle.js +1 -1
  171. package/src/private/webapis/dom/nodes/internals/ReactNativeDocumentInstanceHandle.js +1 -1
  172. package/src/private/webapis/dom/nodes/specs/NativeDOM.js +29 -29
  173. package/src/private/webapis/dom/oldstylecollections/HTMLCollection.js +1 -1
  174. package/src/private/webapis/dom/oldstylecollections/NodeList.js +2 -2
  175. package/src/private/webapis/geometry/DOMRectReadOnly.js +1 -1
  176. package/src/private/webapis/html/events/MessageEvent.js +3 -3
  177. package/src/private/webapis/idlecallbacks/specs/NativeIdleCallbacks.js +3 -3
  178. package/src/private/webapis/intersectionobserver/IntersectionObserver.js +53 -5
  179. package/src/private/webapis/intersectionobserver/internals/IntersectionObserverManager.js +2 -2
  180. package/src/private/webapis/intersectionobserver/specs/NativeIntersectionObserver.js +4 -4
  181. package/src/private/webapis/microtasks/specs/NativeMicrotasks.js +1 -1
  182. package/src/private/webapis/mutationobserver/MutationObserver.js +1 -1
  183. package/src/private/webapis/mutationobserver/MutationRecord.js +1 -1
  184. package/src/private/webapis/mutationobserver/specs/NativeMutationObserver.js +4 -4
  185. package/src/private/webapis/performance/Performance.js +1 -1
  186. package/src/private/webapis/performance/UserTiming.js +1 -1
  187. package/src/private/webapis/performance/specs/NativePerformance.js +3 -3
  188. package/src/private/webapis/structuredClone/structuredClone.js +3 -3
  189. package/src/types/globals.d.ts +30 -1
  190. package/src-win/Libraries/Components/AccessibilityInfo/AccessibilityInfo.d.ts +6 -0
  191. package/src-win/index.win32.js.flow +8 -0
  192. package/src/private/devsupport/devmenu/elementinspector/NetworkOverlay.js +0 -628
  193. 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<mixed>) => void,
139
- _errorOriginal: (...data: $ReadOnlyArray<mixed>) => void,
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: mixed, isFatal: boolean) {
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]: mixed},
20
+ nativeEvent: {[string]: unknown},
21
21
  }>;
22
22
 
23
23
  type RawEventDefinitions = {
@@ -14,7 +14,7 @@ import ExceptionsManager, {SyntheticError} from './ExceptionsManager';
14
14
 
15
15
  export type CapturedError = {
16
16
  +componentStack: string,
17
- +error: mixed,
17
+ +error: unknown,
18
18
  +errorBoundary: ?{...},
19
19
  ...
20
20
  };
@@ -27,7 +27,7 @@
27
27
  */
28
28
  export default class ReactNativeVersion {
29
29
  static major: number = 0;
30
- static minor: number = 83;
30
+ static minor: number = 84;
31
31
  static patch: number = 0;
32
32
  static prerelease: string | null = 'rc.5';
33
33
 
@@ -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<mixed>) {
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: mixed, isFatal: boolean) => {
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]) => mixed,
89
- context?: mixed,
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: mixed) => void,
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: mixed) => void,
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: mixed) => void,
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: mixed) => void,
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: mixed) => void,
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) => mixed,
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: mixed) => void,
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: mixed) => void,
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: mixed) => ?(Promise<U> | U),
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) => mixed,
169
- context: mixed,
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
- ) => mixed;
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<mixed>) {
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]) => mixed,
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: mixed): boolean {
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]: mixed, ...}) {
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
- selectedLogIndex: -1,
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 = observe(data => {
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?: mixed,
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: mixed | void;
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'}>
@@ -53,7 +53,7 @@ export function deleteStack(stack: Stack): void {
53
53
 
54
54
  export function symbolicate(
55
55
  stack: Stack,
56
- extraData?: mixed,
56
+ extraData?: unknown,
57
57
  ): Promise<SymbolicatedStackTrace> {
58
58
  let promise = cache.get(stack);
59
59
  if (promise == null) {
@@ -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<mixed>): boolean {
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<mixed>): $ReadOnly<{
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: mixed): mixed {
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<mixed>): {
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<mixed> = [];
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<mixed>): void;
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<mixed>) => void;
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: () => mixed}) => {
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<mixed>) {
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<mixed>) => {
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<mixed>): void => {
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<mixed>): void {
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: mixed,
18
+ nativeValue: unknown,
19
19
  }
20
20
  | {
21
21
  type: 'unequal',
22
22
  path: Array<string>,
23
- nativeValue: mixed,
24
- staticValue: mixed,
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: mixed): ?{...} {
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: mixed): boolean {
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]) => mixed,
54
- context?: mixed,
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) => mixed,
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]) => mixed,
24
- context?: mixed,
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]) => mixed,
23
- context?: mixed,
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]) => mixed,
24
- context?: mixed,
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) => mixed,
91
+ onBlur?: ?(event: BlurEvent) => unknown,
92
92
 
93
93
  /**
94
94
  * Called after the element is focused.
95
95
  */
96
- onFocus?: ?(event: FocusEvent) => mixed,
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) => mixed,
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) => mixed,
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) => mixed,
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) => mixed,
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) => mixed,
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) => mixed,
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) => mixed,
131
+ onPressOut?: ?(event: GestureResponderEvent) => unknown,
132
132
 
133
133
  /**
134
134
  * Whether to prevent any other native components from becoming responder