@office-iss/react-native-win32 0.0.0-canary.307 → 0.0.0-canary.309

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 (199) hide show
  1. package/.flowconfig +2 -2
  2. package/CHANGELOG.json +36 -0
  3. package/CHANGELOG.md +18 -1
  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/BatchedBridge/NativeModules.js +8 -6
  23. package/Libraries/Blob/URL.js +34 -3
  24. package/Libraries/Blob/URLSearchParams.js +1 -0
  25. package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.d.ts +6 -0
  26. package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js +13 -2
  27. package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.win32.js +15 -2
  28. package/Libraries/Components/Button.js +2 -5
  29. package/Libraries/Components/Button.win32.js +2 -5
  30. package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js +1 -1
  31. package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroidTypes.js +4 -4
  32. package/Libraries/Components/Keyboard/Keyboard.js +2 -2
  33. package/Libraries/Components/Pressable/Pressable.js +8 -8
  34. package/Libraries/Components/Pressable/Pressable.win32.js +14 -13
  35. package/Libraries/Components/TextInput/TextInput.flow.js +13 -13
  36. package/Libraries/Components/TextInput/TextInput.flow.win32.js +13 -13
  37. package/Libraries/Components/TextInput/TextInput.js +33 -34
  38. package/Libraries/Components/TextInput/TextInput.win32.js +39 -39
  39. package/Libraries/Components/Touchable/PooledClass.js +2 -2
  40. package/Libraries/Components/Touchable/TouchableBounce.js +3 -3
  41. package/Libraries/Components/Touchable/TouchableNativeFeedback.js +1 -1
  42. package/Libraries/Components/Touchable/TouchableNativeFeedback.win32.js +1 -1
  43. package/Libraries/Components/Touchable/TouchableWin32.js +9 -6
  44. package/Libraries/Components/Touchable/TouchableWin32.js.map +1 -1
  45. package/Libraries/Components/Touchable/TouchableWithoutFeedback.js +9 -9
  46. package/Libraries/Components/View/View.win32.js +5 -5
  47. package/Libraries/Components/View/ViewPropTypes.js +16 -6
  48. package/Libraries/Components/View/ViewPropTypes.win32.js +20 -10
  49. package/Libraries/Core/Devtools/loadBundleFromServer.js +6 -3
  50. package/Libraries/Core/Devtools/loadBundleFromServer.win32.js +6 -3
  51. package/Libraries/Core/Devtools/symbolicateStackTrace.js +1 -1
  52. package/Libraries/Core/ExceptionsManager.js +3 -3
  53. package/Libraries/Core/RawEventEmitter.js +1 -1
  54. package/Libraries/Core/ReactFiberErrorDialog.js +1 -1
  55. package/Libraries/Core/ReactNativeVersion.js +2 -2
  56. package/Libraries/Core/setUpDeveloperTools.js +1 -1
  57. package/Libraries/Core/setUpErrorHandling.js +1 -1
  58. package/Libraries/EventEmitter/NativeEventEmitter.js +2 -2
  59. package/Libraries/Image/Image.android.js +2 -2
  60. package/Libraries/Image/Image.ios.js +2 -2
  61. package/Libraries/Image/Image.win32.js +1 -1
  62. package/Libraries/Image/ImageProps.js +1 -1
  63. package/Libraries/Image/ImageTypes.flow.js +2 -2
  64. package/Libraries/Interaction/InteractionManager.js +3 -3
  65. package/Libraries/Interaction/PanResponder.js +1 -1
  66. package/Libraries/LayoutAnimation/LayoutAnimation.js +1 -1
  67. package/Libraries/Linking/Linking.js +1 -1
  68. package/Libraries/Lists/FlatList.js +2 -2
  69. package/Libraries/LogBox/Data/LogBoxData.js +31 -4
  70. package/Libraries/LogBox/Data/LogBoxLog.js +2 -2
  71. package/Libraries/LogBox/Data/LogBoxSymbolication.js +1 -1
  72. package/Libraries/LogBox/Data/parseLogBoxLog.js +5 -5
  73. package/Libraries/LogBox/LogBox.js +7 -7
  74. package/Libraries/NativeComponent/BaseViewConfig.android.js +12 -0
  75. package/Libraries/NativeComponent/StaticViewConfigValidator.js +4 -4
  76. package/Libraries/NativeComponent/ViewConfigIgnore.js +1 -1
  77. package/Libraries/Network/RCTNetworking.android.js +3 -3
  78. package/Libraries/Network/RCTNetworking.ios.js +2 -2
  79. package/Libraries/Network/RCTNetworking.js.flow +2 -2
  80. package/Libraries/Network/RCTNetworking.win32.js +2 -2
  81. package/Libraries/Pressability/Pressability.js +9 -9
  82. package/Libraries/Pressability/Pressability.win32.js +17 -16
  83. package/Libraries/Pressability/usePressability.js +3 -14
  84. package/Libraries/ReactNative/AppRegistry.flow.js +1 -1
  85. package/Libraries/ReactNative/BridgelessUIManager.js +1 -1
  86. package/Libraries/ReactNative/FabricUIManager.js +1 -1
  87. package/Libraries/ReactNative/PaperUIManager.js +1 -1
  88. package/Libraries/ReactNative/PaperUIManager.win32.js +1 -1
  89. package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstance.js +1 -1
  90. package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstanceUtils.js +2 -2
  91. package/Libraries/ReactNative/ReactFabricPublicInstance/ReactNativeAttributePayload.js +1 -1
  92. package/Libraries/ReactNative/RendererImplementation.js +1 -1
  93. package/Libraries/ReactNative/getNativeComponentAttributes.js +1 -1
  94. package/Libraries/ReactPrivate/ReactNativePrivateInterface.js +1 -2
  95. package/Libraries/Renderer/implementations/ReactFabric-dev.js +3 -3
  96. package/Libraries/Renderer/implementations/ReactFabric-prod.js +3 -3
  97. package/Libraries/Renderer/implementations/ReactFabric-profiling.js +3 -3
  98. package/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js +11 -3
  99. package/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js +11 -3
  100. package/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.js +11 -3
  101. package/Libraries/Renderer/shims/ReactFabric.js +3 -1
  102. package/Libraries/Renderer/shims/ReactFeatureFlags.js +3 -1
  103. package/Libraries/Renderer/shims/ReactNative.js +2 -1
  104. package/Libraries/Renderer/shims/ReactNativeTypes.js +3 -1
  105. package/Libraries/Renderer/shims/ReactNativeTypes.win32.js +3 -1
  106. package/Libraries/Renderer/shims/ReactNativeViewConfigRegistry.js +3 -1
  107. package/Libraries/Renderer/shims/createReactNativeComponentClass.js +3 -1
  108. package/Libraries/Settings/Settings.ios.js +1 -1
  109. package/Libraries/StyleSheet/PlatformColorValueTypes.android.js +2 -2
  110. package/Libraries/StyleSheet/PlatformColorValueTypes.ios.js +1 -1
  111. package/Libraries/StyleSheet/PlatformColorValueTypes.js.flow +4 -2
  112. package/Libraries/StyleSheet/StyleSheetExports.js +1 -1
  113. package/Libraries/StyleSheet/StyleSheetTypes.d.ts +99 -4
  114. package/Libraries/StyleSheet/StyleSheetTypes.js +6 -8
  115. package/Libraries/StyleSheet/processFilter.js +1 -1
  116. package/Libraries/Text/Text.js +46 -6
  117. package/Libraries/Text/Text.win32.js +46 -6
  118. package/Libraries/Text/TextNativeComponent.js +1 -1
  119. package/Libraries/Text/TextNativeComponent.win32.js +1 -1
  120. package/Libraries/Text/TextProps.js +7 -7
  121. package/Libraries/Text/TextProps.win32.js +7 -7
  122. package/Libraries/Types/CodegenTypes.js +1 -1
  123. package/Libraries/Types/CoreEventTypes.js +31 -0
  124. package/Libraries/Types/CoreEventTypes.win32.js +30 -13
  125. package/Libraries/Types/ReactDevToolsTypes.js +2 -2
  126. package/Libraries/Utilities/Appearance.js +2 -2
  127. package/Libraries/Utilities/DevLoadingView.js +8 -1
  128. package/Libraries/Utilities/DevSettings.js +3 -3
  129. package/Libraries/Utilities/HMRClient.js +4 -3
  130. package/Libraries/Utilities/RCTLog.js +3 -3
  131. package/Libraries/Utilities/ReactNativeTestTools.js +1 -1
  132. package/Libraries/Utilities/SceneTracker.js +1 -1
  133. package/Libraries/Utilities/codegenNativeCommands.js +1 -1
  134. package/Libraries/Utilities/deepFreezeAndThrowOnMutationInDev.js +3 -3
  135. package/Libraries/Utilities/logError.js +1 -1
  136. package/Libraries/Utilities/stringifySafe.js +7 -7
  137. package/Libraries/Utilities/useRefEffect.js +1 -1
  138. package/Libraries/WebSocket/WebSocketInterceptor.js +3 -3
  139. package/Libraries/promiseRejectionTrackingOptions.js +8 -8
  140. package/Libraries/vendor/core/ErrorUtils.js +10 -10
  141. package/Libraries/vendor/emitter/EventEmitter.js +6 -6
  142. package/flow/HermesInternalType.js +6 -6
  143. package/flow/bom.js.flow +35 -28
  144. package/flow/cssom.js.flow +3 -3
  145. package/flow/dom.js.flow +34 -33
  146. package/index.js +3 -0
  147. package/index.win32.js +3 -0
  148. package/index.win32.js.flow +8 -0
  149. package/jest/mock.js +2 -2
  150. package/jest/mockComponent.js +1 -1
  151. package/jest/setup.js +1 -1
  152. package/overrides.json +23 -23
  153. package/package.json +25 -23
  154. package/src/private/animated/NativeAnimatedHelper.js +130 -125
  155. package/src/private/animated/NativeAnimatedHelper.win32.js +130 -125
  156. package/src/private/animated/NativeAnimatedValidation.js +7 -4
  157. package/src/private/animated/createAnimatedPropsHook.js +13 -5
  158. package/src/private/animated/createAnimatedPropsMemoHook.js +10 -10
  159. package/src/private/components/virtualview/VirtualView.js +16 -9
  160. package/src/private/components/virtualview/logger/VirtualViewLogger.js +21 -0
  161. package/src/private/components/virtualview/logger/VirtualViewLoggerTypes.js +24 -0
  162. package/src/private/devsupport/devmenu/elementinspector/ElementProperties.js +1 -1
  163. package/src/private/devsupport/devmenu/elementinspector/Inspector.js +6 -25
  164. package/src/private/devsupport/devmenu/elementinspector/InspectorPanel.js +1 -27
  165. package/src/private/devsupport/devmenu/elementinspector/XHRInterceptor.js +3 -2
  166. package/src/private/featureflags/ReactNativeFeatureFlags.js +75 -55
  167. package/src/private/featureflags/ReactNativeFeatureFlagsBase.js +3 -3
  168. package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +14 -10
  169. package/src/private/renderer/errorhandling/ErrorHandlers.js +7 -4
  170. package/src/private/setup/setUpDefaultReactNativeEnvironment.js +6 -0
  171. package/src/private/specs_DEPRECATED/modules/NativeAccessibilityManager.js +1 -1
  172. package/src/private/specs_DEPRECATED/modules/NativeAnimatedModule.js +4 -0
  173. package/src/private/specs_DEPRECATED/modules/NativeDevLoadingView.js +1 -0
  174. package/src/private/webapis/dom/events/CustomEvent.js +3 -3
  175. package/src/private/webapis/dom/nodes/internals/ReactNativeDocumentElementInstanceHandle.js +1 -1
  176. package/src/private/webapis/dom/nodes/internals/ReactNativeDocumentInstanceHandle.js +1 -1
  177. package/src/private/webapis/dom/nodes/specs/NativeDOM.js +29 -29
  178. package/src/private/webapis/dom/oldstylecollections/HTMLCollection.js +1 -1
  179. package/src/private/webapis/dom/oldstylecollections/NodeList.js +2 -2
  180. package/src/private/webapis/geometry/DOMRectReadOnly.js +1 -1
  181. package/src/private/webapis/html/events/MessageEvent.js +3 -3
  182. package/src/private/webapis/idlecallbacks/specs/NativeIdleCallbacks.js +3 -3
  183. package/src/private/webapis/intersectionobserver/IntersectionObserver.js +5 -5
  184. package/src/private/webapis/intersectionobserver/internals/IntersectionObserverManager.js +2 -2
  185. package/src/private/webapis/intersectionobserver/specs/NativeIntersectionObserver.js +4 -4
  186. package/src/private/webapis/microtasks/specs/NativeMicrotasks.js +1 -1
  187. package/src/private/webapis/mutationobserver/MutationObserver.js +1 -1
  188. package/src/private/webapis/mutationobserver/MutationRecord.js +1 -1
  189. package/src/private/webapis/mutationobserver/specs/NativeMutationObserver.js +4 -4
  190. package/src/private/webapis/performance/Performance.js +1 -1
  191. package/src/private/webapis/performance/UserTiming.js +1 -1
  192. package/src/private/webapis/performance/specs/NativePerformance.js +3 -3
  193. package/src/private/webapis/structuredClone/structuredClone.js +3 -3
  194. package/src/types/globals.d.ts +30 -1
  195. package/src-win/Libraries/Components/AccessibilityInfo/AccessibilityInfo.d.ts +6 -0
  196. package/src-win/Libraries/Components/Touchable/TouchableWin32.tsx +6 -3
  197. package/src-win/index.win32.js.flow +8 -0
  198. package/src/private/devsupport/devmenu/elementinspector/NetworkOverlay.js +0 -628
  199. package/src/private/devsupport/devmenu/perfmonitor/PerformanceOverlay.js +0 -66
@@ -21,17 +21,17 @@ import AnimatedWithChildren from './AnimatedWithChildren';
21
21
 
22
22
  export type AnimatedStyleAllowlist = $ReadOnly<{[string]: true}>;
23
23
 
24
- type FlatStyle = {[string]: mixed};
25
- type FlatStyleForWeb<TStyle: FlatStyle> = [mixed, TStyle];
24
+ type FlatStyle = {[string]: unknown};
25
+ type FlatStyleForWeb<TStyle: FlatStyle> = [unknown, TStyle];
26
26
 
27
27
  function createAnimatedStyle(
28
28
  flatStyle: FlatStyle,
29
29
  allowlist: ?AnimatedStyleAllowlist,
30
30
  keepUnanimatedValues: boolean,
31
- ): [$ReadOnlyArray<string>, $ReadOnlyArray<AnimatedNode>, {[string]: mixed}] {
31
+ ): [$ReadOnlyArray<string>, $ReadOnlyArray<AnimatedNode>, {[string]: unknown}] {
32
32
  const nodeKeys: Array<string> = [];
33
33
  const nodes: Array<AnimatedNode> = [];
34
- const style: {[string]: mixed} = {};
34
+ const style: {[string]: unknown} = {};
35
35
 
36
36
  const keys = Object.keys(flatStyle);
37
37
  for (let ii = 0, length = keys.length; ii < length; ii++) {
@@ -82,10 +82,10 @@ function createAnimatedStyle(
82
82
  }
83
83
 
84
84
  export default class AnimatedStyle extends AnimatedWithChildren {
85
- _originalStyleForWeb: ?mixed;
85
+ _originalStyleForWeb: ?unknown;
86
86
  _nodeKeys: $ReadOnlyArray<string>;
87
87
  _nodes: $ReadOnlyArray<AnimatedNode>;
88
- _style: {[string]: mixed};
88
+ _style: {[string]: unknown};
89
89
 
90
90
  /**
91
91
  * Creates an `AnimatedStyle` if `value` contains `AnimatedNode` instances.
@@ -94,7 +94,7 @@ export default class AnimatedStyle extends AnimatedWithChildren {
94
94
  static from(
95
95
  flatStyle: ?FlatStyle,
96
96
  allowlist: ?AnimatedStyleAllowlist,
97
- originalStyleForWeb: ?mixed,
97
+ originalStyleForWeb: ?unknown,
98
98
  ): ?AnimatedStyle {
99
99
  if (flatStyle == null) {
100
100
  return null;
@@ -115,8 +115,8 @@ export default class AnimatedStyle extends AnimatedWithChildren {
115
115
  constructor(
116
116
  nodeKeys: $ReadOnlyArray<string>,
117
117
  nodes: $ReadOnlyArray<AnimatedNode>,
118
- style: {[string]: mixed},
119
- originalStyleForWeb: ?mixed,
118
+ style: {[string]: unknown},
119
+ originalStyleForWeb: ?unknown,
120
120
  config?: ?AnimatedNodeConfig,
121
121
  ) {
122
122
  super(config);
@@ -134,7 +134,7 @@ export default class AnimatedStyle extends AnimatedWithChildren {
134
134
  }
135
135
 
136
136
  __getValue(): FlatStyleForWeb<FlatStyle> | FlatStyle {
137
- const style: {[string]: mixed} = {};
137
+ const style: {[string]: unknown} = {};
138
138
 
139
139
  const keys = Object.keys(this._style);
140
140
  for (let ii = 0, length = keys.length; ii < length; ii++) {
@@ -164,7 +164,7 @@ export default class AnimatedStyle extends AnimatedWithChildren {
164
164
  * Mutates the supplied `style` object such that animated nodes are replaced
165
165
  * with rasterized values.
166
166
  */
167
- __replaceAnimatedNodeWithValues(style: {[string]: mixed}): void {
167
+ __replaceAnimatedNodeWithValues(style: {[string]: unknown}): void {
168
168
  const keys = Object.keys(style);
169
169
  for (let ii = 0, length = keys.length; ii < length; ii++) {
170
170
  const key = keys[ii];
@@ -185,7 +185,7 @@ export default class AnimatedStyle extends AnimatedWithChildren {
185
185
  }
186
186
 
187
187
  __getAnimatedValue(): Object {
188
- const style: {[string]: mixed} = {};
188
+ const style: {[string]: unknown} = {};
189
189
 
190
190
  const nodeKeys = this._nodeKeys;
191
191
  const nodes = this._nodes;
@@ -12,7 +12,10 @@ import type {EventSubscription} from '../../vendor/emitter/EventEmitter';
12
12
  import type {PlatformConfig} from '../AnimatedPlatformConfig';
13
13
  import type Animation from '../animations/Animation';
14
14
  import type {EndCallback} from '../animations/Animation';
15
- import type {InterpolationConfigType} from './AnimatedInterpolation';
15
+ import type {
16
+ InterpolationConfigSupportedOutputType,
17
+ InterpolationConfigType,
18
+ } from './AnimatedInterpolation';
16
19
  import type AnimatedNode from './AnimatedNode';
17
20
  import type {AnimatedNodeConfig} from './AnimatedNode';
18
21
  import type AnimatedTracking from './AnimatedTracking';
@@ -131,7 +134,7 @@ export default class AnimatedValue extends AnimatedWithChildren {
131
134
  }
132
135
  }
133
136
 
134
- addListener(callback: (value: any) => mixed): string {
137
+ addListener(callback: (value: any) => unknown): string {
135
138
  const id = super.addListener(callback);
136
139
  this._listenerCount++;
137
140
  if (this.__isNative) {
@@ -298,7 +301,7 @@ export default class AnimatedValue extends AnimatedWithChildren {
298
301
  * Interpolates the value before updating the property, e.g. mapping 0-1 to
299
302
  * 0-10.
300
303
  */
301
- interpolate<OutputT: number | string>(
304
+ interpolate<OutputT: InterpolationConfigSupportedOutputType>(
302
305
  config: InterpolationConfigType<OutputT>,
303
306
  ): AnimatedInterpolation<OutputT> {
304
307
  return new AnimatedInterpolation(this, config);
@@ -21,7 +21,7 @@ export type AnimatedValueXYConfig = $ReadOnly<{
21
21
  ...AnimatedNodeConfig,
22
22
  useNativeDriver: boolean,
23
23
  }>;
24
- type ValueXYListenerCallback = (value: {x: number, y: number, ...}) => mixed;
24
+ type ValueXYListenerCallback = (value: {x: number, y: number, ...}) => unknown;
25
25
 
26
26
  let _uniqueId = 1;
27
27
 
@@ -23,7 +23,7 @@ export type SpyData = {
23
23
  type: number,
24
24
  module: ?string,
25
25
  method: string | number,
26
- args: mixed[],
26
+ args: unknown[],
27
27
  ...
28
28
  };
29
29
 
@@ -42,9 +42,9 @@ const DEBUG_INFO_LIMIT = 32;
42
42
 
43
43
  class MessageQueue {
44
44
  _lazyCallableModules: {[key: string]: (void) => {...}, ...};
45
- _queue: [number[], number[], mixed[], number];
46
- _successCallbacks: Map<number, ?(...mixed[]) => void>;
47
- _failureCallbacks: Map<number, ?(...mixed[]) => void>;
45
+ _queue: [number[], number[], unknown[], number];
46
+ _successCallbacks: Map<number, ?(...unknown[]) => void>;
47
+ _failureCallbacks: Map<number, ?(...unknown[]) => void>;
48
48
  _callID: number;
49
49
  _lastFlush: number;
50
50
  _eventLoopStartTime: number;
@@ -109,8 +109,8 @@ class MessageQueue {
109
109
  callFunctionReturnFlushedQueue(
110
110
  module: string,
111
111
  method: string,
112
- args: mixed[],
113
- ): null | [Array<number>, Array<number>, Array<mixed>, number] {
112
+ args: unknown[],
113
+ ): null | [Array<number>, Array<number>, Array<unknown>, number] {
114
114
  this.__guard(() => {
115
115
  this.__callFunction(module, method, args);
116
116
  });
@@ -120,8 +120,8 @@ class MessageQueue {
120
120
 
121
121
  invokeCallbackAndReturnFlushedQueue(
122
122
  cbID: number,
123
- args: mixed[],
124
- ): null | [Array<number>, Array<number>, Array<mixed>, number] {
123
+ args: unknown[],
124
+ ): null | [Array<number>, Array<number>, Array<unknown>, number] {
125
125
  this.__guard(() => {
126
126
  this.__invokeCallback(cbID, args);
127
127
  });
@@ -129,7 +129,9 @@ class MessageQueue {
129
129
  return this.flushedQueue();
130
130
  }
131
131
 
132
- flushedQueue(): null | [Array<number>, Array<number>, Array<mixed>, number] {
132
+ flushedQueue():
133
+ | null
134
+ | [Array<number>, Array<number>, Array<unknown>, number] {
133
135
  this.__guard(() => {
134
136
  this.__callReactNativeMicrotasks();
135
137
  });
@@ -171,10 +173,10 @@ class MessageQueue {
171
173
  callNativeSyncHook(
172
174
  moduleID: number,
173
175
  methodID: number,
174
- params: mixed[],
175
- onFail: ?(...mixed[]) => void,
176
- onSucc: ?(...mixed[]) => void,
177
- ): mixed {
176
+ params: unknown[],
177
+ onFail: ?(...unknown[]) => void,
178
+ onSucc: ?(...unknown[]) => void,
179
+ ): unknown {
178
180
  if (__DEV__) {
179
181
  invariant(
180
182
  global.nativeCallSyncHook,
@@ -191,9 +193,9 @@ class MessageQueue {
191
193
  processCallbacks(
192
194
  moduleID: number,
193
195
  methodID: number,
194
- params: mixed[],
195
- onFail: ?(...mixed[]) => void,
196
- onSucc: ?(...mixed[]) => void,
196
+ params: unknown[],
197
+ onFail: ?(...unknown[]) => void,
198
+ onSucc: ?(...unknown[]) => void,
197
199
  ): void {
198
200
  if (onFail || onSucc) {
199
201
  if (__DEV__) {
@@ -242,9 +244,9 @@ class MessageQueue {
242
244
  enqueueNativeCall(
243
245
  moduleID: number,
244
246
  methodID: number,
245
- params: mixed[],
246
- onFail: ?(...mixed[]) => void,
247
- onSucc: ?(...mixed[]) => void,
247
+ params: unknown[],
248
+ onFail: ?(...unknown[]) => void,
249
+ onSucc: ?(...unknown[]) => void,
248
250
  ): void {
249
251
  this.processCallbacks(moduleID, methodID, params, onFail, onSucc);
250
252
 
@@ -256,7 +258,7 @@ class MessageQueue {
256
258
  // folly-convertible. As a special case, if a prop value is a
257
259
  // function it is permitted here, and special-cased in the
258
260
  // conversion.
259
- const isValidArgument = (val: mixed): boolean => {
261
+ const isValidArgument = (val: unknown): boolean => {
260
262
  switch (typeof val) {
261
263
  case 'undefined':
262
264
  case 'boolean':
@@ -401,7 +403,7 @@ class MessageQueue {
401
403
  }
402
404
  }
403
405
 
404
- __callFunction(module: string, method: string, args: mixed[]): void {
406
+ __callFunction(module: string, method: string, args: unknown[]): void {
405
407
  this._lastFlush = Date.now();
406
408
  this._eventLoopStartTime = this._lastFlush;
407
409
  if (__DEV__ || this.__spy) {
@@ -441,7 +443,7 @@ class MessageQueue {
441
443
  }
442
444
  }
443
445
 
444
- __invokeCallback(cbID: number, args: mixed[]): void {
446
+ __invokeCallback(cbID: number, args: unknown[]): void {
445
447
  this._lastFlush = Date.now();
446
448
  this._eventLoopStartTime = this._lastFlush;
447
449
 
@@ -50,7 +50,7 @@ function genModule(
50
50
  return {name: moduleName};
51
51
  }
52
52
 
53
- const module: {[string]: mixed} = {};
53
+ const module: {[string]: unknown} = {};
54
54
  methods &&
55
55
  methods.forEach((methodName, methodID) => {
56
56
  const isPromise =
@@ -99,7 +99,7 @@ function loadModule(name: string, moduleID: number): ?{...} {
99
99
  function genMethod(moduleID: number, methodID: number, type: MethodType) {
100
100
  let fn = null;
101
101
  if (type === 'promise') {
102
- fn = function promiseMethodWrapper(...args: Array<mixed>) {
102
+ fn = function promiseMethodWrapper(...args: Array<unknown>) {
103
103
  // In case we reject, capture a useful stack trace here.
104
104
  /* $FlowFixMe[class-object-subtyping] added when improving typing for
105
105
  * this parameters */
@@ -122,7 +122,7 @@ function genMethod(moduleID: number, methodID: number, type: MethodType) {
122
122
  });
123
123
  };
124
124
  } else {
125
- fn = function nonPromiseMethodWrapper(...args: Array<mixed>) {
125
+ fn = function nonPromiseMethodWrapper(...args: Array<unknown>) {
126
126
  const lastArg = args.length > 0 ? args[args.length - 1] : null;
127
127
  const secondLastArg = args.length > 1 ? args[args.length - 2] : null;
128
128
  const hasSuccessCallback = typeof lastArg === 'function';
@@ -133,9 +133,11 @@ function genMethod(moduleID: number, methodID: number, type: MethodType) {
133
133
  'Cannot have a non-function arg after a function arg.',
134
134
  );
135
135
  // $FlowFixMe[incompatible-type]
136
- const onSuccess: ?(mixed) => void = hasSuccessCallback ? lastArg : null;
137
- // $FlowFixMe[incompatible-type]
138
- const onFail: ?(mixed) => void = hasErrorCallback ? secondLastArg : null;
136
+ const onSuccess: ?(unknown) => void = hasSuccessCallback ? lastArg : null;
137
+ const onFail: ?(unknown) => void = hasErrorCallback
138
+ ? // $FlowFixMe[incompatible-type]
139
+ secondLastArg
140
+ : null;
139
141
  // $FlowFixMe[unsafe-addition]
140
142
  const callbackCount = hasSuccessCallback + hasErrorCallback;
141
143
  const newArgs = args.slice(0, args.length - callbackCount);
@@ -90,11 +90,15 @@ export class URL {
90
90
  }
91
91
  }
92
92
 
93
+ // Only add trailing slash if URL has no path (just domain)
93
94
  if (
94
95
  !this._url.endsWith('/') &&
95
96
  !(this._url.includes('?') || this._url.includes('#'))
96
97
  ) {
97
- this._url += '/';
98
+ const afterProtocol = this._url.split('://')[1];
99
+ if (afterProtocol && !afterProtocol.includes('/')) {
100
+ this._url += '/';
101
+ }
98
102
  }
99
103
  } else {
100
104
  if (typeof base === 'string') {
@@ -170,6 +174,24 @@ export class URL {
170
174
  return searchMatch ? `?${searchMatch[1]}` : '';
171
175
  }
172
176
 
177
+ set search(value: string) {
178
+ // Remove leading '?' if present
179
+ const searchString = value.startsWith('?') ? value.slice(1) : value;
180
+
181
+ // Update the internal URL
182
+ const baseUrl = this._url.split('?')[0].split('#')[0];
183
+ const hash = this.hash;
184
+
185
+ if (searchString) {
186
+ this._url = baseUrl + '?' + searchString + hash;
187
+ } else {
188
+ this._url = baseUrl + hash;
189
+ }
190
+
191
+ // Reset the searchParams instance so it gets recreated with new values
192
+ this._searchParamsInstance = null;
193
+ }
194
+
173
195
  get searchParams(): URLSearchParams {
174
196
  if (this._searchParamsInstance == null) {
175
197
  this._searchParamsInstance = new URLSearchParams(this.search);
@@ -185,10 +207,19 @@ export class URL {
185
207
  if (this._searchParamsInstance === null) {
186
208
  return this._url;
187
209
  }
210
+
211
+ // Remove existing search params and hash from the URL
212
+ const baseUrl = this._url.split('?')[0].split('#')[0];
213
+ const hash = this.hash;
214
+
188
215
  // $FlowFixMe[incompatible-use]
189
216
  const instanceString = this._searchParamsInstance.toString();
190
- const separator = this._url.indexOf('?') > -1 ? '&' : '?';
191
- return this._url + separator + instanceString;
217
+
218
+ if (instanceString) {
219
+ return baseUrl + '?' + instanceString + hash;
220
+ } else {
221
+ return baseUrl + hash;
222
+ }
192
223
  }
193
224
 
194
225
  get username(): string {
@@ -131,6 +131,7 @@ export class URLSearchParams {
131
131
  }
132
132
  }
133
133
 
134
+ // $FlowFixMe[incompatible-use]
134
135
  return entries[Symbol.iterator]();
135
136
  }
136
137
 
@@ -150,12 +150,18 @@ export interface AccessibilityInfoStatic {
150
150
  * - `announcement`: The string announced by the screen reader.
151
151
  * - `options`: An object that configures the reading options.
152
152
  * - `queue`: The announcement will be queued behind existing announcements. iOS only.
153
+ * - `priority`: The priority of the announcement. Possible values: 'low' | 'default' | 'high'.
154
+ * High priority announcements will interrupt any ongoing speech and cannot be interrupted.
155
+ * Default priority announcements will interrupt any ongoing speech but can be interrupted.
156
+ * Low priority announcements will not interrupt ongoing speech and can be interrupted.
157
+ * (iOS only).
153
158
  * - `nativeID`: The nativeID of the element to send the announcement from. win32 only.
154
159
  */
155
160
  announceForAccessibilityWithOptions(
156
161
  announcement: string,
157
162
  options: {
158
163
  queue?: boolean | undefined;
164
+ priority?: 'low' | 'default' | 'high' | undefined;
159
165
  nativeID?: string | undefined; // win32
160
166
  },
161
167
  ): void;
@@ -42,7 +42,11 @@ type AccessibilityEventDefinitions = {
42
42
  screenReaderChanged: [boolean],
43
43
  };
44
44
 
45
- type AccessibilityEventTypes = 'click' | 'focus' | 'viewHoverEnter';
45
+ type AccessibilityEventTypes =
46
+ | 'click'
47
+ | 'focus'
48
+ | 'viewHoverEnter'
49
+ | 'windowStateChange';
46
50
 
47
51
  // Mapping of public event names to platform-specific event names.
48
52
  const EventNames: Map<
@@ -438,6 +442,8 @@ const AccessibilityInfo = {
438
442
  * Set accessibility focus to a React component.
439
443
  *
440
444
  * See https://reactnative.dev/docs/accessibilityinfo#setaccessibilityfocus
445
+ *
446
+ * @deprecated Use `sendAccessibilityEvent` with eventType `focus` instead.
441
447
  */
442
448
  setAccessibilityFocus(reactTag: number): void {
443
449
  legacySendAccessibilityEvent(reactTag, 'focus');
@@ -476,10 +482,15 @@ const AccessibilityInfo = {
476
482
  * - `announcement`: The string announced by the screen reader.
477
483
  * - `options`: An object that configures the reading options.
478
484
  * - `queue`: The announcement will be queued behind existing announcements. iOS only.
485
+ * - `priority`: The priority of the announcement. Possible values: 'low' | 'default' | 'high'.
486
+ * High priority announcements will interrupt any ongoing speech and cannot be interrupted.
487
+ * Default priority announcements will interrupt any ongoing speech but can be interrupted.
488
+ * Low priority announcements will not interrupt ongoing speech and can be interrupted.
489
+ * (iOS only).
479
490
  */
480
491
  announceForAccessibilityWithOptions(
481
492
  announcement: string,
482
- options: {queue?: boolean},
493
+ options: {queue?: boolean, priority?: 'low' | 'default' | 'high'},
483
494
  ): void {
484
495
  if (Platform.OS === 'android') {
485
496
  NativeAccessibilityInfoAndroid?.announceForAccessibility(announcement);
@@ -44,7 +44,11 @@ type AccessibilityEventDefinitions = {
44
44
  screenReaderChanged: [boolean],
45
45
  };
46
46
 
47
- type AccessibilityEventTypes = 'click' | 'focus' | 'viewHoverEnter';
47
+ type AccessibilityEventTypes =
48
+ | 'click'
49
+ | 'focus'
50
+ | 'viewHoverEnter'
51
+ | 'windowStateChange';
48
52
 
49
53
  // Mapping of public event names to platform-specific event names.
50
54
  const EventNames: Map<
@@ -462,6 +466,8 @@ const AccessibilityInfo = {
462
466
  * Set accessibility focus to a React component.
463
467
  *
464
468
  * See https://reactnative.dev/docs/accessibilityinfo#setaccessibilityfocus
469
+ *
470
+ * @deprecated Use `sendAccessibilityEvent` with eventType `focus` instead.
465
471
  */
466
472
  setAccessibilityFocus(reactTag: number): void {
467
473
  legacySendAccessibilityEvent(reactTag, 'focus');
@@ -502,12 +508,18 @@ const AccessibilityInfo = {
502
508
  * - `announcement`: The string announced by the screen reader.
503
509
  * - `options`: An object that configures the reading options.
504
510
  * - `queue`: The announcement will be queued behind existing announcements. iOS only.
511
+ * - `priority`: The priority of the announcement. Possible values: 'low' | 'default' | 'high'.
512
+ * High priority announcements will interrupt any ongoing speech and cannot be interrupted.
513
+ * Default priority announcements will interrupt any ongoing speech but can be interrupted.
514
+ * Low priority announcements will not interrupt ongoing speech and can be interrupted.
515
+ * (iOS only).
505
516
  * - `nativeID`: The nativeID of the element to send the announcement from. win32 only.
506
517
  */
507
518
  announceForAccessibilityWithOptions(
508
519
  announcement: string,
509
520
  options: {
510
521
  queue?: boolean,
522
+ priority?: 'low' | 'default' | 'high',
511
523
  nativeID?: string, // win32
512
524
  },
513
525
  ): void {
@@ -515,9 +527,10 @@ const AccessibilityInfo = {
515
527
  NativeAccessibilityInfo?.announceForAccessibility(announcement);
516
528
  } else if (Platform.OS === 'win32') {
517
529
  if (NativeAccessibilityInfoWin32?.announceForAccessibilityWithOptions) {
530
+ const {priority: _, ...win32Options} = options;
518
531
  NativeAccessibilityInfoWin32?.announceForAccessibilityWithOptions(
519
532
  announcement,
520
- options,
533
+ win32Options,
521
534
  );
522
535
  } else {
523
536
  NativeAccessibilityInfoWin32?.announceForAccessibility(announcement);
@@ -38,7 +38,7 @@ export type ButtonProps = $ReadOnly<{
38
38
  Handler to be called when the user taps the button. The first function
39
39
  argument is an event in form of [GestureResponderEvent](pressevent).
40
40
  */
41
- onPress?: (event?: GestureResponderEvent) => mixed,
41
+ onPress?: (event?: GestureResponderEvent) => unknown,
42
42
 
43
43
  /**
44
44
  If `true`, doesn't play system sound on touch.
@@ -148,7 +148,7 @@ export type ButtonProps = $ReadOnly<{
148
148
  */
149
149
  accessible?: ?boolean,
150
150
  accessibilityActions?: ?$ReadOnlyArray<AccessibilityActionInfo>,
151
- onAccessibilityAction?: ?(event: AccessibilityActionEvent) => mixed,
151
+ onAccessibilityAction?: ?(event: AccessibilityActionEvent) => unknown,
152
152
  accessibilityState?: ?AccessibilityState,
153
153
 
154
154
  /**
@@ -184,9 +184,6 @@ export type ButtonProps = $ReadOnly<{
184
184
  [button:source]:
185
185
  https://github.com/facebook/react-native/blob/HEAD/Libraries/Components/Button.js
186
186
 
187
- [button:examples]:
188
- https://js.coach/?menu%5Bcollections%5D=React%20Native&page=1&query=button
189
-
190
187
  ```jsx
191
188
  <Button
192
189
  onPress={onPressLearnMore}
@@ -39,7 +39,7 @@ export type ButtonProps = $ReadOnly<{
39
39
  Handler to be called when the user taps the button. The first function
40
40
  argument is an event in form of [GestureResponderEvent](pressevent).
41
41
  */
42
- onPress?: (event?: GestureResponderEvent) => mixed,
42
+ onPress?: (event?: GestureResponderEvent) => unknown,
43
43
 
44
44
  /**
45
45
  If `true`, doesn't play system sound on touch.
@@ -149,7 +149,7 @@ export type ButtonProps = $ReadOnly<{
149
149
  */
150
150
  accessible?: ?boolean,
151
151
  accessibilityActions?: ?$ReadOnlyArray<AccessibilityActionInfo>,
152
- onAccessibilityAction?: ?(event: AccessibilityActionEvent) => mixed,
152
+ onAccessibilityAction?: ?(event: AccessibilityActionEvent) => unknown,
153
153
  accessibilityState?: ?AccessibilityState,
154
154
 
155
155
  /**
@@ -187,9 +187,6 @@ export type ButtonProps = $ReadOnly<{
187
187
  [button:source]:
188
188
  https://github.com/facebook/react-native/blob/HEAD/Libraries/Components/Button.js
189
189
 
190
- [button:examples]:
191
- https://js.coach/?menu%5Bcollections%5D=React%20Native&page=1&query=button
192
-
193
190
  ```jsx
194
191
  <Button
195
192
  onPress={onPressLearnMore}
@@ -67,7 +67,7 @@ class DrawerLayoutAndroid
67
67
  extends React.Component<DrawerLayoutAndroidProps, DrawerLayoutAndroidState>
68
68
  implements DrawerLayoutAndroidMethods
69
69
  {
70
- static get positions(): mixed {
70
+ static get positions(): unknown {
71
71
  console.warn(
72
72
  'Setting DrawerLayoutAndroid drawerPosition using `DrawerLayoutAndroid.positions` is deprecated. Instead pass the string value "left" or "right"',
73
73
  );
@@ -73,7 +73,7 @@ export type DrawerLayoutAndroidProps = $ReadOnly<{
73
73
  /**
74
74
  * Function called whenever there is an interaction with the navigation view.
75
75
  */
76
- onDrawerSlide?: ?(event: DrawerSlideEvent) => mixed,
76
+ onDrawerSlide?: ?(event: DrawerSlideEvent) => unknown,
77
77
 
78
78
  /**
79
79
  * Function called when the drawer state has changed. The drawer can be in 3 states:
@@ -82,17 +82,17 @@ export type DrawerLayoutAndroidProps = $ReadOnly<{
82
82
  * - Settling, meaning that there was an interaction with the navigation view, and the
83
83
  * navigation view is now finishing its closing or opening animation
84
84
  */
85
- onDrawerStateChanged?: ?(state: DrawerStates) => mixed,
85
+ onDrawerStateChanged?: ?(state: DrawerStates) => unknown,
86
86
 
87
87
  /**
88
88
  * Function called whenever the navigation view has been opened.
89
89
  */
90
- onDrawerOpen?: ?() => mixed,
90
+ onDrawerOpen?: ?() => unknown,
91
91
 
92
92
  /**
93
93
  * Function called whenever the navigation view has been closed.
94
94
  */
95
- onDrawerClose?: ?() => mixed,
95
+ onDrawerClose?: ?() => unknown,
96
96
 
97
97
  /**
98
98
  * The navigation view that will be rendered to the side of the screen and can be pulled in.
@@ -148,8 +148,8 @@ class KeyboardImpl {
148
148
  */
149
149
  addListener<K: $Keys<KeyboardEventDefinitions>>(
150
150
  eventType: K,
151
- listener: (...KeyboardEventDefinitions[K]) => mixed,
152
- context?: mixed,
151
+ listener: (...KeyboardEventDefinitions[K]) => unknown,
152
+ context?: unknown,
153
153
  ): EventSubscription {
154
154
  return this._emitter.addListener(eventType, listener);
155
155
  }
@@ -80,41 +80,41 @@ type PressableBaseProps = $ReadOnly<{
80
80
  /**
81
81
  * Called when this view's layout changes.
82
82
  */
83
- onLayout?: ?(event: LayoutChangeEvent) => mixed,
83
+ onLayout?: ?(event: LayoutChangeEvent) => unknown,
84
84
 
85
85
  /**
86
86
  * Called when the hover is activated to provide visual feedback.
87
87
  */
88
- onHoverIn?: ?(event: MouseEvent) => mixed,
88
+ onHoverIn?: ?(event: MouseEvent) => unknown,
89
89
 
90
90
  /**
91
91
  * Called when the hover is deactivated to undo visual feedback.
92
92
  */
93
- onHoverOut?: ?(event: MouseEvent) => mixed,
93
+ onHoverOut?: ?(event: MouseEvent) => unknown,
94
94
 
95
95
  /**
96
96
  * Called when a long-tap gesture is detected.
97
97
  */
98
- onLongPress?: ?(event: GestureResponderEvent) => mixed,
98
+ onLongPress?: ?(event: GestureResponderEvent) => unknown,
99
99
 
100
100
  /**
101
101
  * Called when a single tap gesture is detected.
102
102
  */
103
- onPress?: ?(event: GestureResponderEvent) => mixed,
103
+ onPress?: ?(event: GestureResponderEvent) => unknown,
104
104
 
105
105
  /**
106
106
  * Called when a touch is engaged before `onPress`.
107
107
  */
108
- onPressIn?: ?(event: GestureResponderEvent) => mixed,
108
+ onPressIn?: ?(event: GestureResponderEvent) => unknown,
109
109
  /**
110
110
  * Called when the press location moves.
111
111
  */
112
- onPressMove?: ?(event: GestureResponderEvent) => mixed,
112
+ onPressMove?: ?(event: GestureResponderEvent) => unknown,
113
113
 
114
114
  /**
115
115
  * Called when a touch is released before `onPress`.
116
116
  */
117
- onPressOut?: ?(event: GestureResponderEvent) => mixed,
117
+ onPressOut?: ?(event: GestureResponderEvent) => unknown,
118
118
 
119
119
  /**
120
120
  * Whether to prevent any other native components from becoming responder