@office-iss/react-native-win32 0.83.0-preview.1 → 0.84.0-preview.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (193) hide show
  1. package/.flowconfig +2 -2
  2. package/CHANGELOG.json +57 -6
  3. package/CHANGELOG.md +30 -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 +3 -3
  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
@@ -8,12 +8,15 @@
8
8
  * @format
9
9
  */
10
10
 
11
+ import type {RootTag} from '../../Types/RootTagTypes';
11
12
  import type {PlatformConfig} from '../AnimatedPlatformConfig';
12
13
  import type {AnimatedNodeConfig} from './AnimatedNode';
13
14
  import type {AnimatedStyleAllowlist} from './AnimatedStyle';
14
15
 
15
16
  import NativeAnimatedHelper from '../../../src/private/animated/NativeAnimatedHelper';
17
+ import * as ReactNativeFeatureFlags from '../../../src/private/featureflags/ReactNativeFeatureFlags';
16
18
  import {findNodeHandle} from '../../ReactNative/RendererProxy';
19
+ import {getNodeFromPublicInstance} from '../../ReactPrivate/ReactNativePrivateInterface';
17
20
  import flattenStyle from '../../StyleSheet/flattenStyle';
18
21
  import {AnimatedEvent} from '../AnimatedEvent';
19
22
  import AnimatedNode from './AnimatedNode';
@@ -33,12 +36,12 @@ type TargetView = {
33
36
  type TargetViewInstance = React.ElementRef<React.ElementType>;
34
37
 
35
38
  function createAnimatedProps(
36
- inputProps: {[string]: mixed},
39
+ inputProps: {[string]: unknown},
37
40
  allowlist: ?AnimatedPropsAllowlist,
38
- ): [$ReadOnlyArray<string>, $ReadOnlyArray<AnimatedNode>, {[string]: mixed}] {
41
+ ): [$ReadOnlyArray<string>, $ReadOnlyArray<AnimatedNode>, {[string]: unknown}] {
39
42
  const nodeKeys: Array<string> = [];
40
43
  const nodes: Array<AnimatedNode> = [];
41
- const props: {[string]: mixed} = {};
44
+ const props: {[string]: unknown} = {};
42
45
 
43
46
  const keys = Object.keys(inputProps);
44
47
  for (let ii = 0, length = keys.length; ii < length; ii++) {
@@ -95,13 +98,15 @@ export default class AnimatedProps extends AnimatedNode {
95
98
  _callback: () => void;
96
99
  _nodeKeys: $ReadOnlyArray<string>;
97
100
  _nodes: $ReadOnlyArray<AnimatedNode>;
98
- _props: {[string]: mixed};
101
+ _props: {[string]: unknown};
99
102
  _target: ?TargetView = null;
103
+ _rootTag: ?RootTag = undefined;
100
104
 
101
105
  constructor(
102
- inputProps: {[string]: mixed},
106
+ inputProps: {[string]: unknown},
103
107
  callback: () => void,
104
108
  allowlist?: ?AnimatedPropsAllowlist,
109
+ rootTag?: RootTag,
105
110
  config?: ?AnimatedNodeConfig,
106
111
  ) {
107
112
  super(config);
@@ -110,10 +115,11 @@ export default class AnimatedProps extends AnimatedNode {
110
115
  this._nodes = nodes;
111
116
  this._props = props;
112
117
  this._callback = callback;
118
+ this._rootTag = rootTag;
113
119
  }
114
120
 
115
121
  __getValue(): Object {
116
- const props: {[string]: mixed} = {};
122
+ const props: {[string]: unknown} = {};
117
123
 
118
124
  const keys = Object.keys(this._props);
119
125
  for (let ii = 0, length = keys.length; ii < length; ii++) {
@@ -138,7 +144,7 @@ export default class AnimatedProps extends AnimatedNode {
138
144
  * created by this `AnimatedProps` instance.
139
145
  */
140
146
  __getValueWithStaticProps(staticProps: Object): Object {
141
- const props: {[string]: mixed} = {...staticProps};
147
+ const props: {[string]: unknown} = {...staticProps};
142
148
 
143
149
  const keys = Object.keys(staticProps);
144
150
  for (let ii = 0, length = keys.length; ii < length; ii++) {
@@ -149,7 +155,7 @@ export default class AnimatedProps extends AnimatedNode {
149
155
  const staticStyle = staticProps.style;
150
156
  const flatStaticStyle = flattenStyle(staticStyle);
151
157
  if (maybeNode instanceof AnimatedStyle) {
152
- const mutableStyle: {[string]: mixed} =
158
+ const mutableStyle: {[string]: unknown} =
153
159
  flatStaticStyle == null
154
160
  ? {}
155
161
  : flatStaticStyle === staticStyle
@@ -190,7 +196,7 @@ export default class AnimatedProps extends AnimatedNode {
190
196
  }
191
197
 
192
198
  __getAnimatedValue(): Object {
193
- const props: {[string]: mixed} = {};
199
+ const props: {[string]: unknown} = {};
194
200
 
195
201
  const nodeKeys = this._nodeKeys;
196
202
  const nodes = this._nodes;
@@ -247,7 +253,9 @@ export default class AnimatedProps extends AnimatedNode {
247
253
  super.__setPlatformConfig(platformConfig);
248
254
 
249
255
  if (this._target != null) {
250
- this.#connectAnimatedView(this._target);
256
+ const target = this._target;
257
+ this.#connectAnimatedView(target);
258
+ this.#connectShadowNode(target);
251
259
  }
252
260
  }
253
261
  }
@@ -256,9 +264,10 @@ export default class AnimatedProps extends AnimatedNode {
256
264
  if (this._target?.instance === instance) {
257
265
  return;
258
266
  }
259
- this._target = {instance, connectedViewTag: null};
267
+ const target = (this._target = {instance, connectedViewTag: null});
260
268
  if (this.__isNative) {
261
- this.#connectAnimatedView(this._target);
269
+ this.#connectAnimatedView(target);
270
+ this.#connectShadowNode(target);
262
271
  }
263
272
  }
264
273
 
@@ -279,6 +288,27 @@ export default class AnimatedProps extends AnimatedNode {
279
288
  target.connectedViewTag = viewTag;
280
289
  }
281
290
 
291
+ #connectShadowNode(target: TargetView): void {
292
+ if (
293
+ !ReactNativeFeatureFlags.cxxNativeAnimatedEnabled() ||
294
+ //eslint-disable-next-line
295
+ !ReactNativeFeatureFlags.useSharedAnimatedBackend()
296
+ ) {
297
+ return;
298
+ }
299
+
300
+ invariant(this.__isNative, 'Expected node to be marked as "native"');
301
+ // $FlowExpectedError[incompatible-type] - target.instance may be an HTMLElement but we need ReactNativeElement for Fabric
302
+ const shadowNode = getNodeFromPublicInstance(target.instance);
303
+ if (shadowNode == null) {
304
+ return;
305
+ }
306
+ NativeAnimatedHelper.API.connectAnimatedNodeToShadowNodeFamily(
307
+ this.__getNativeTag(),
308
+ shadowNode,
309
+ );
310
+ }
311
+
282
312
  #disconnectAnimatedView(target: TargetView): void {
283
313
  invariant(this.__isNative, 'Expected node to be marked as "native"');
284
314
  const viewTag = target.connectedViewTag;
@@ -318,6 +348,7 @@ export default class AnimatedProps extends AnimatedNode {
318
348
  return {
319
349
  type: 'props',
320
350
  props: propsConfig,
351
+ rootTag: this._rootTag ?? undefined,
321
352
  debugID: this.__getDebugID(),
322
353
  };
323
354
  }
@@ -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
 
@@ -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;
@@ -476,10 +476,15 @@ const AccessibilityInfo = {
476
476
  * - `announcement`: The string announced by the screen reader.
477
477
  * - `options`: An object that configures the reading options.
478
478
  * - `queue`: The announcement will be queued behind existing announcements. iOS only.
479
+ * - `priority`: The priority of the announcement. Possible values: 'low' | 'default' | 'high'.
480
+ * High priority announcements will interrupt any ongoing speech and cannot be interrupted.
481
+ * Default priority announcements will interrupt any ongoing speech but can be interrupted.
482
+ * Low priority announcements will not interrupt ongoing speech and can be interrupted.
483
+ * (iOS only).
479
484
  */
480
485
  announceForAccessibilityWithOptions(
481
486
  announcement: string,
482
- options: {queue?: boolean},
487
+ options: {queue?: boolean, priority?: 'low' | 'default' | 'high'},
483
488
  ): void {
484
489
  if (Platform.OS === 'android') {
485
490
  NativeAccessibilityInfoAndroid?.announceForAccessibility(announcement);
@@ -502,12 +502,18 @@ const AccessibilityInfo = {
502
502
  * - `announcement`: The string announced by the screen reader.
503
503
  * - `options`: An object that configures the reading options.
504
504
  * - `queue`: The announcement will be queued behind existing announcements. iOS only.
505
+ * - `priority`: The priority of the announcement. Possible values: 'low' | 'default' | 'high'.
506
+ * High priority announcements will interrupt any ongoing speech and cannot be interrupted.
507
+ * Default priority announcements will interrupt any ongoing speech but can be interrupted.
508
+ * Low priority announcements will not interrupt ongoing speech and can be interrupted.
509
+ * (iOS only).
505
510
  * - `nativeID`: The nativeID of the element to send the announcement from. win32 only.
506
511
  */
507
512
  announceForAccessibilityWithOptions(
508
513
  announcement: string,
509
514
  options: {
510
515
  queue?: boolean,
516
+ priority?: 'low' | 'default' | 'high',
511
517
  nativeID?: string, // win32
512
518
  },
513
519
  ): void {
@@ -515,9 +521,10 @@ const AccessibilityInfo = {
515
521
  NativeAccessibilityInfo?.announceForAccessibility(announcement);
516
522
  } else if (Platform.OS === 'win32') {
517
523
  if (NativeAccessibilityInfoWin32?.announceForAccessibilityWithOptions) {
524
+ const {priority: _, ...win32Options} = options;
518
525
  NativeAccessibilityInfoWin32?.announceForAccessibilityWithOptions(
519
526
  announcement,
520
- options,
527
+ win32Options,
521
528
  );
522
529
  } else {
523
530
  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
  }