react-native-windows 0.83.0-preview.2 → 0.84.0-preview.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (221) hide show
  1. package/.flowconfig +2 -2
  2. package/Folly/Folly.vcxproj +2 -0
  3. package/Libraries/Animated/AnimatedEvent.js +2 -2
  4. package/Libraries/Animated/animations/Animation.js +1 -3
  5. package/Libraries/Animated/createAnimatedComponent.js +8 -5
  6. package/Libraries/Animated/nodes/AnimatedColor.js +1 -1
  7. package/Libraries/Animated/nodes/AnimatedInterpolation.js +40 -4
  8. package/Libraries/Animated/nodes/AnimatedNode.js +3 -3
  9. package/Libraries/Animated/nodes/AnimatedObject.js +16 -11
  10. package/Libraries/Animated/nodes/AnimatedProps.js +43 -12
  11. package/Libraries/Animated/nodes/AnimatedStyle.js +12 -12
  12. package/Libraries/Animated/nodes/AnimatedValue.js +6 -3
  13. package/Libraries/Animated/nodes/AnimatedValueXY.js +1 -1
  14. package/Libraries/BatchedBridge/MessageQueue.js +24 -22
  15. package/Libraries/Blob/URL.js +34 -3
  16. package/Libraries/Blob/URLSearchParams.js +1 -0
  17. package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.d.ts +9 -1
  18. package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js +6 -1
  19. package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.windows.js +6 -1
  20. package/Libraries/Components/Button.js +2 -5
  21. package/Libraries/Components/Button.windows.js +2 -5
  22. package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js +1 -1
  23. package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroidTypes.js +4 -4
  24. package/Libraries/Components/Keyboard/Keyboard.js +2 -2
  25. package/Libraries/Components/Pressable/Pressable.js +8 -8
  26. package/Libraries/Components/Pressable/Pressable.windows.js +14 -13
  27. package/Libraries/Components/TextInput/TextInput.flow.js +13 -13
  28. package/Libraries/Components/TextInput/TextInput.flow.windows.js +19 -18
  29. package/Libraries/Components/TextInput/TextInput.js +33 -34
  30. package/Libraries/Components/TextInput/TextInput.windows.js +40 -39
  31. package/Libraries/Components/Touchable/PooledClass.js +2 -2
  32. package/Libraries/Components/Touchable/TouchableBounce.js +3 -3
  33. package/Libraries/Components/Touchable/TouchableBounce.windows.js +3 -3
  34. package/Libraries/Components/Touchable/TouchableNativeFeedback.js +1 -1
  35. package/Libraries/Components/Touchable/TouchableNativeFeedback.windows.js +1 -1
  36. package/Libraries/Components/Touchable/TouchableWithoutFeedback.js +9 -9
  37. package/Libraries/Components/Touchable/TouchableWithoutFeedback.windows.js +9 -9
  38. package/Libraries/Components/View/ViewPropTypes.js +16 -6
  39. package/Libraries/Components/View/ViewPropTypes.windows.js +21 -11
  40. package/Libraries/Core/Devtools/loadBundleFromServer.js +6 -3
  41. package/Libraries/Core/Devtools/loadBundleFromServer.windows.js +6 -3
  42. package/Libraries/Core/Devtools/symbolicateStackTrace.js +1 -1
  43. package/Libraries/Core/ExceptionsManager.js +3 -3
  44. package/Libraries/Core/RawEventEmitter.js +1 -1
  45. package/Libraries/Core/ReactFiberErrorDialog.js +1 -1
  46. package/Libraries/Core/ReactNativeVersion.js +3 -3
  47. package/Libraries/Core/setUpDeveloperTools.js +1 -1
  48. package/Libraries/Core/setUpErrorHandling.js +1 -1
  49. package/Libraries/EventEmitter/NativeEventEmitter.js +2 -2
  50. package/Libraries/Image/Image.android.js +2 -2
  51. package/Libraries/Image/Image.ios.js +2 -2
  52. package/Libraries/Image/Image.windows.js +2 -2
  53. package/Libraries/Image/ImageProps.js +1 -1
  54. package/Libraries/Image/ImageTypes.flow.js +2 -2
  55. package/Libraries/Interaction/InteractionManager.js +3 -3
  56. package/Libraries/Interaction/PanResponder.js +1 -1
  57. package/Libraries/LayoutAnimation/LayoutAnimation.js +1 -1
  58. package/Libraries/Linking/Linking.js +1 -1
  59. package/Libraries/Lists/FlatList.js +2 -2
  60. package/Libraries/LogBox/Data/LogBoxData.js +31 -4
  61. package/Libraries/LogBox/Data/LogBoxLog.js +2 -2
  62. package/Libraries/LogBox/Data/LogBoxSymbolication.js +1 -1
  63. package/Libraries/LogBox/Data/parseLogBoxLog.js +5 -5
  64. package/Libraries/LogBox/LogBox.js +7 -7
  65. package/Libraries/NativeComponent/BaseViewConfig.android.js +12 -0
  66. package/Libraries/NativeComponent/StaticViewConfigValidator.js +4 -4
  67. package/Libraries/NativeComponent/ViewConfigIgnore.js +1 -1
  68. package/Libraries/NativeComponent/ViewConfigIgnore.windows.js +1 -1
  69. package/Libraries/Network/RCTNetworking.android.js +3 -3
  70. package/Libraries/Network/RCTNetworking.ios.js +2 -2
  71. package/Libraries/Network/RCTNetworking.js.flow +2 -2
  72. package/Libraries/Network/RCTNetworking.windows.js +2 -2
  73. package/Libraries/Pressability/Pressability.js +9 -9
  74. package/Libraries/Pressability/Pressability.windows.js +17 -16
  75. package/Libraries/ReactNative/AppRegistry.flow.js +1 -1
  76. package/Libraries/ReactNative/BridgelessUIManager.js +1 -1
  77. package/Libraries/ReactNative/FabricUIManager.js +1 -1
  78. package/Libraries/ReactNative/PaperUIManager.js +1 -1
  79. package/Libraries/ReactNative/PaperUIManager.windows.js +1 -1
  80. package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstance.js +1 -1
  81. package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstanceUtils.js +2 -2
  82. package/Libraries/ReactNative/ReactFabricPublicInstance/ReactNativeAttributePayload.js +1 -1
  83. package/Libraries/ReactNative/RendererImplementation.js +1 -1
  84. package/Libraries/ReactNative/getNativeComponentAttributes.js +1 -1
  85. package/Libraries/ReactPrivate/ReactNativePrivateInterface.js +1 -2
  86. package/Libraries/Renderer/implementations/ReactFabric-dev.js +3 -3
  87. package/Libraries/Renderer/implementations/ReactFabric-prod.js +3 -3
  88. package/Libraries/Renderer/implementations/ReactFabric-profiling.js +3 -3
  89. package/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js +11 -4
  90. package/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js +11 -4
  91. package/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.js +11 -4
  92. package/Libraries/Renderer/shims/ReactFabric.js +3 -1
  93. package/Libraries/Renderer/shims/ReactFeatureFlags.js +3 -1
  94. package/Libraries/Renderer/shims/ReactNative.js +2 -2
  95. package/Libraries/Renderer/shims/ReactNativeTypes.js +3 -1
  96. package/Libraries/Renderer/shims/ReactNativeTypes.windows.js +3 -1
  97. package/Libraries/Renderer/shims/ReactNativeViewConfigRegistry.js +3 -1
  98. package/Libraries/Renderer/shims/createReactNativeComponentClass.js +3 -1
  99. package/Libraries/Settings/Settings.ios.js +1 -1
  100. package/Libraries/StyleSheet/PlatformColorValueTypes.android.js +2 -2
  101. package/Libraries/StyleSheet/PlatformColorValueTypes.ios.js +1 -1
  102. package/Libraries/StyleSheet/PlatformColorValueTypes.js.flow +4 -2
  103. package/Libraries/StyleSheet/StyleSheetExports.js +1 -1
  104. package/Libraries/StyleSheet/StyleSheetTypes.d.ts +99 -4
  105. package/Libraries/StyleSheet/StyleSheetTypes.js +6 -8
  106. package/Libraries/StyleSheet/processFilter.js +1 -1
  107. package/Libraries/Text/Text.js +46 -6
  108. package/Libraries/Text/Text.windows.js +46 -6
  109. package/Libraries/Text/TextNativeComponent.js +1 -1
  110. package/Libraries/Text/TextProps.js +7 -7
  111. package/Libraries/Text/TextProps.windows.js +7 -7
  112. package/Libraries/Types/CodegenTypes.js +1 -1
  113. package/Libraries/Types/CoreEventTypes.js +31 -0
  114. package/Libraries/Types/CoreEventTypes.windows.js +31 -13
  115. package/Libraries/Types/ReactDevToolsTypes.js +2 -2
  116. package/Libraries/Utilities/Appearance.js +2 -2
  117. package/Libraries/Utilities/DevLoadingView.js +8 -1
  118. package/Libraries/Utilities/DevSettings.js +3 -3
  119. package/Libraries/Utilities/HMRClient.js +4 -3
  120. package/Libraries/Utilities/RCTLog.js +3 -3
  121. package/Libraries/Utilities/ReactNativeTestTools.js +1 -1
  122. package/Libraries/Utilities/SceneTracker.js +1 -1
  123. package/Libraries/Utilities/codegenNativeCommands.js +1 -1
  124. package/Libraries/Utilities/deepFreezeAndThrowOnMutationInDev.js +3 -3
  125. package/Libraries/Utilities/logError.js +1 -1
  126. package/Libraries/Utilities/stringifySafe.js +7 -7
  127. package/Libraries/Utilities/useRefEffect.js +1 -1
  128. package/Libraries/WebSocket/WebSocketInterceptor.js +3 -3
  129. package/Libraries/promiseRejectionTrackingOptions.js +8 -8
  130. package/Libraries/vendor/core/ErrorUtils.js +10 -10
  131. package/Libraries/vendor/emitter/EventEmitter.js +6 -6
  132. package/Microsoft.ReactNative/Fabric/AbiViewProps.cpp +5 -0
  133. package/Microsoft.ReactNative/Fabric/AbiViewProps.h +1 -0
  134. package/Microsoft.ReactNative/Fabric/Composition/CompositionEventHandler.cpp +25 -5
  135. package/Microsoft.ReactNative/Fabric/Composition/CompositionEventHandler.h +2 -1
  136. package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.cpp +9 -3
  137. package/Microsoft.ReactNative/Fabric/FabricUIManagerModule.cpp +2 -3
  138. package/Microsoft.ReactNative/Fabric/ReactTaggedView.h +2 -2
  139. package/Microsoft.ReactNative/IReactCompositionViewComponentBuilder.idl +2 -0
  140. package/Microsoft.ReactNative/ReactHost/ReactInstanceWin.cpp +6 -0
  141. package/Microsoft.ReactNative/ViewProps.idl +9 -0
  142. package/Microsoft.ReactNative.Cxx/ReactCommon/TurboModule.h +12 -2
  143. package/PropertySheets/Generated/PackageVersion.g.props +3 -3
  144. package/ReactCommon/ReactCommon.vcxproj +7 -1
  145. package/ReactCommon/ReactCommon.vcxproj.filters +0 -3
  146. package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/JSIndexedRAMBundle.cpp +5 -5
  147. package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/ReactMarker.cpp +0 -1
  148. package/ReactCommon/TEMP_UntilReactCommonUpdate/jsiexecutor/jsireact/JSIExecutor.cpp +2 -43
  149. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/nativemodule/core/ReactCommon/TurboModule.h +12 -2
  150. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/attributedstring/TextAttributes.cpp +291 -0
  151. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/core/EventDispatcher.cpp +0 -1
  152. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/core/EventQueueProcessor.cpp +1 -3
  153. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/core/propsConversions.h +199 -0
  154. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/uimanager/UIManager.cpp +6 -0
  155. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/runtime/ReactInstance.cpp +17 -10
  156. package/Scripts/creaternwapp.cmd +8 -1
  157. package/Scripts/creaternwlib.cmd +21 -2
  158. package/Shared/DevSettings.h +0 -3
  159. package/Shared/Modules/WebSocketModule.cpp +0 -1
  160. package/Shared/Modules/WebSocketModule.h +62 -3
  161. package/Shared/OInstance.cpp +5 -0
  162. package/Shared/Shared.vcxitems +4 -6
  163. package/Shared/Shared.vcxitems.filters +218 -709
  164. package/codegen/NativeAccessibilityManagerSpec.g.h +2 -0
  165. package/codegen/NativeAnimatedModuleSpec.g.h +21 -15
  166. package/codegen/NativeDevLoadingViewSpec.g.h +3 -3
  167. package/codegen/NativeIntentAndroidSpec.g.h +16 -3
  168. package/codegen/NativeReactNativeFeatureFlagsSpec.g.h +209 -191
  169. package/codegen/react/components/rnwcore/EventEmitters.h +1 -0
  170. package/codegen/react/components/rnwcore/Props.h +14 -0
  171. package/codegen/rnwcoreJSI.h +246 -211
  172. package/index.js +3 -0
  173. package/index.windows.js +3 -0
  174. package/jest/mock.js +2 -2
  175. package/jest/mockComponent.js +1 -1
  176. package/jest/setup.js +1 -1
  177. package/package.json +22 -21
  178. package/src/private/animated/NativeAnimatedHelper.js +130 -125
  179. package/src/private/animated/NativeAnimatedValidation.js +7 -4
  180. package/src/private/animated/createAnimatedPropsHook.js +13 -5
  181. package/src/private/animated/createAnimatedPropsMemoHook.js +10 -10
  182. package/src/private/components/virtualview/VirtualView.js +16 -9
  183. package/src/private/components/virtualview/logger/VirtualViewLogger.js +21 -0
  184. package/src/private/components/virtualview/logger/VirtualViewLoggerTypes.js +24 -0
  185. package/src/private/devsupport/devmenu/elementinspector/ElementProperties.js +1 -1
  186. package/src/private/devsupport/devmenu/elementinspector/Inspector.js +6 -25
  187. package/src/private/devsupport/devmenu/elementinspector/InspectorPanel.js +1 -27
  188. package/src/private/devsupport/devmenu/elementinspector/XHRInterceptor.js +3 -2
  189. package/src/private/featureflags/ReactNativeFeatureFlags.js +63 -42
  190. package/src/private/featureflags/ReactNativeFeatureFlagsBase.js +3 -3
  191. package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +12 -9
  192. package/src/private/renderer/errorhandling/ErrorHandlers.js +7 -4
  193. package/src/private/specs_DEPRECATED/modules/NativeAccessibilityManager.js +1 -1
  194. package/src/private/specs_DEPRECATED/modules/NativeAnimatedModule.js +4 -0
  195. package/src/private/specs_DEPRECATED/modules/NativeDevLoadingView.js +1 -0
  196. package/src/private/webapis/dom/events/CustomEvent.js +3 -3
  197. package/src/private/webapis/dom/nodes/internals/ReactNativeDocumentElementInstanceHandle.js +1 -1
  198. package/src/private/webapis/dom/nodes/internals/ReactNativeDocumentInstanceHandle.js +1 -1
  199. package/src/private/webapis/dom/nodes/specs/NativeDOM.js +29 -29
  200. package/src/private/webapis/dom/oldstylecollections/HTMLCollection.js +1 -1
  201. package/src/private/webapis/dom/oldstylecollections/NodeList.js +2 -2
  202. package/src/private/webapis/geometry/DOMRectReadOnly.js +1 -1
  203. package/src/private/webapis/html/events/MessageEvent.js +3 -3
  204. package/src/private/webapis/idlecallbacks/specs/NativeIdleCallbacks.js +3 -3
  205. package/src/private/webapis/intersectionobserver/IntersectionObserver.js +53 -5
  206. package/src/private/webapis/intersectionobserver/internals/IntersectionObserverManager.js +2 -2
  207. package/src/private/webapis/intersectionobserver/specs/NativeIntersectionObserver.js +4 -4
  208. package/src/private/webapis/microtasks/specs/NativeMicrotasks.js +1 -1
  209. package/src/private/webapis/mutationobserver/MutationObserver.js +1 -1
  210. package/src/private/webapis/mutationobserver/MutationRecord.js +1 -1
  211. package/src/private/webapis/mutationobserver/specs/NativeMutationObserver.js +4 -4
  212. package/src/private/webapis/performance/Performance.js +1 -1
  213. package/src/private/webapis/performance/UserTiming.js +1 -1
  214. package/src/private/webapis/performance/specs/NativePerformance.js +3 -3
  215. package/src/private/webapis/structuredClone/structuredClone.js +3 -3
  216. package/src/types/globals.d.ts +30 -1
  217. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/image/conversions.h +0 -178
  218. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/imagemanager/primitives.h +0 -183
  219. package/Shared/Modules/WebSocketTurboModule.h +0 -71
  220. package/src/private/devsupport/devmenu/elementinspector/NetworkOverlay.js +0 -628
  221. package/src/private/devsupport/devmenu/perfmonitor/PerformanceOverlay.js +0 -66
@@ -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,10 +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
  */
154
159
  announceForAccessibilityWithOptions(
155
160
  announcement: string,
156
- options: {queue?: boolean | undefined},
161
+ options: {
162
+ queue?: boolean | undefined;
163
+ priority?: 'low' | 'default' | 'high' | undefined;
164
+ },
157
165
  ): void;
158
166
 
159
167
  /**
@@ -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);
@@ -487,10 +487,15 @@ const AccessibilityInfo = {
487
487
  * - `announcement`: The string announced by the screen reader.
488
488
  * - `options`: An object that configures the reading options.
489
489
  * - `queue`: The announcement will be queued behind existing announcements. iOS only.
490
+ * - `priority`: The priority of the announcement. Possible values: 'low' | 'default' | 'high'.
491
+ * High priority announcements will interrupt any ongoing speech and cannot be interrupted.
492
+ * Default priority announcements will interrupt any ongoing speech but can be interrupted.
493
+ * Low priority announcements will not interrupt ongoing speech and can be interrupted.
494
+ * (iOS only).
490
495
  */
491
496
  announceForAccessibilityWithOptions(
492
497
  announcement: string,
493
- options: {queue?: boolean},
498
+ options: {queue?: boolean, priority?: 'low' | 'default' | 'high'},
494
499
  ): void {
495
500
  if (Platform.OS === 'android' || Platform.OS === 'windows') {
496
501
  NativeAccessibilityInfo?.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}
@@ -43,7 +43,7 @@ export type ButtonProps = $ReadOnly<{
43
43
  Handler to be called when the user taps the button. The first function
44
44
  argument is an event in form of [GestureResponderEvent](pressevent).
45
45
  */
46
- onPress?: (event?: GestureResponderEvent) => mixed,
46
+ onPress?: (event?: GestureResponderEvent) => unknown,
47
47
 
48
48
  /**
49
49
  If `true`, doesn't play system sound on touch.
@@ -153,7 +153,7 @@ export type ButtonProps = $ReadOnly<{
153
153
  */
154
154
  accessible?: ?boolean,
155
155
  accessibilityActions?: ?$ReadOnlyArray<AccessibilityActionInfo>,
156
- onAccessibilityAction?: ?(event: AccessibilityActionEvent) => mixed,
156
+ onAccessibilityAction?: ?(event: AccessibilityActionEvent) => unknown,
157
157
  onAccessibilityTap?: ?() => void, // Windows
158
158
  accessibilityState?: ?AccessibilityState,
159
159
  accessibilityValue?: ?AccessibilityValue, // Windows
@@ -209,9 +209,6 @@ export type ButtonProps = $ReadOnly<{
209
209
  [button:source]:
210
210
  https://github.com/facebook/react-native/blob/HEAD/Libraries/Components/Button.js
211
211
 
212
- [button:examples]:
213
- https://js.coach/?menu%5Bcollections%5D=React%20Native&page=1&query=button
214
-
215
212
  ```jsx
216
213
  <Button
217
214
  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
@@ -16,7 +16,8 @@ import type {
16
16
  // [Windows
17
17
  BlurEvent,
18
18
  FocusEvent,
19
- KeyEvent, // Windows]
19
+ KeyUpEvent, // Windows]
20
+ KeyDownEvent, // Windows]
20
21
  } from '../../Types/CoreEventTypes';
21
22
  import type {ViewProps} from '../View/ViewPropTypes';
22
23
 
@@ -93,41 +94,41 @@ type PressableBaseProps = $ReadOnly<{
93
94
  /**
94
95
  * Called when this view's layout changes.
95
96
  */
96
- onLayout?: ?(event: LayoutChangeEvent) => mixed,
97
+ onLayout?: ?(event: LayoutChangeEvent) => unknown,
97
98
 
98
99
  /**
99
100
  * Called when the hover is activated to provide visual feedback.
100
101
  */
101
- onHoverIn?: ?(event: MouseEvent) => mixed,
102
+ onHoverIn?: ?(event: MouseEvent) => unknown,
102
103
 
103
104
  /**
104
105
  * Called when the hover is deactivated to undo visual feedback.
105
106
  */
106
- onHoverOut?: ?(event: MouseEvent) => mixed,
107
+ onHoverOut?: ?(event: MouseEvent) => unknown,
107
108
 
108
109
  /**
109
110
  * Called when a long-tap gesture is detected.
110
111
  */
111
- onLongPress?: ?(event: GestureResponderEvent) => mixed,
112
+ onLongPress?: ?(event: GestureResponderEvent) => unknown,
112
113
 
113
114
  /**
114
115
  * Called when a single tap gesture is detected.
115
116
  */
116
- onPress?: ?(event: GestureResponderEvent) => mixed,
117
+ onPress?: ?(event: GestureResponderEvent) => unknown,
117
118
 
118
119
  /**
119
120
  * Called when a touch is engaged before `onPress`.
120
121
  */
121
- onPressIn?: ?(event: GestureResponderEvent) => mixed,
122
+ onPressIn?: ?(event: GestureResponderEvent) => unknown,
122
123
  /**
123
124
  * Called when the press location moves.
124
125
  */
125
- onPressMove?: ?(event: GestureResponderEvent) => mixed,
126
+ onPressMove?: ?(event: GestureResponderEvent) => unknown,
126
127
 
127
128
  /**
128
129
  * Called when a touch is released before `onPress`.
129
130
  */
130
- onPressOut?: ?(event: GestureResponderEvent) => mixed,
131
+ onPressOut?: ?(event: GestureResponderEvent) => unknown,
131
132
 
132
133
  /**
133
134
  * Whether to prevent any other native components from becoming responder
@@ -148,12 +149,12 @@ type PressableBaseProps = $ReadOnly<{
148
149
  /*
149
150
  * Called after a key down event is detected.
150
151
  */
151
- onKeyDown?: ?(event: KeyEvent) => mixed,
152
+ onKeyDown?: ?(event: KeyDownEvent) => mixed,
152
153
 
153
154
  /*
154
155
  * Called after a key up event is detected.
155
156
  */
156
- onKeyUp?: ?(event: KeyEvent) => mixed,
157
+ onKeyUp?: ?(event: KeyUpEvent) => mixed,
157
158
 
158
159
  /*
159
160
  * List of keys handled only by JS.
@@ -168,12 +169,12 @@ type PressableBaseProps = $ReadOnly<{
168
169
  /*
169
170
  * Called in the tunneling phase after a key up event is detected.
170
171
  */
171
- onKeyDownCapture?: ?(event: KeyEvent) => void,
172
+ onKeyDownCapture?: ?(event: KeyDownEvent) => void,
172
173
 
173
174
  /*
174
175
  * Called in the tunneling phase after a key up event is detected.
175
176
  */
176
- onKeyUpCapture?: ?(event: KeyEvent) => void,
177
+ onKeyUpCapture?: ?(event: KeyUpEvent) => void,
177
178
 
178
179
  /**
179
180
  * Either view styles or a function that receives a boolean reflecting whether
@@ -809,18 +809,18 @@ type TextInputBaseProps = $ReadOnly<{
809
809
  /**
810
810
  * Callback that is called when the text input is blurred.
811
811
  */
812
- onBlur?: ?(e: TextInputBlurEvent) => mixed,
812
+ onBlur?: ?(e: TextInputBlurEvent) => unknown,
813
813
 
814
814
  /**
815
815
  * Callback that is called when the text input's text changes.
816
816
  */
817
- onChange?: ?(e: TextInputChangeEvent) => mixed,
817
+ onChange?: ?(e: TextInputChangeEvent) => unknown,
818
818
 
819
819
  /**
820
820
  * Callback that is called when the text input's text changes.
821
821
  * Changed text is passed as an argument to the callback handler.
822
822
  */
823
- onChangeText?: ?(text: string) => mixed,
823
+ onChangeText?: ?(text: string) => unknown,
824
824
 
825
825
  /**
826
826
  * Callback that is called when the text input's content size changes.
@@ -829,17 +829,17 @@ type TextInputBaseProps = $ReadOnly<{
829
829
  *
830
830
  * Only called for multiline text inputs.
831
831
  */
832
- onContentSizeChange?: ?(e: TextInputContentSizeChangeEvent) => mixed,
832
+ onContentSizeChange?: ?(e: TextInputContentSizeChangeEvent) => unknown,
833
833
 
834
834
  /**
835
835
  * Callback that is called when text input ends.
836
836
  */
837
- onEndEditing?: ?(e: TextInputEndEditingEvent) => mixed,
837
+ onEndEditing?: ?(e: TextInputEndEditingEvent) => unknown,
838
838
 
839
839
  /**
840
840
  * Callback that is called when the text input is focused.
841
841
  */
842
- onFocus?: ?(e: TextInputFocusEvent) => mixed,
842
+ onFocus?: ?(e: TextInputFocusEvent) => unknown,
843
843
 
844
844
  /**
845
845
  * Callback that is called when a key is pressed.
@@ -848,42 +848,42 @@ type TextInputBaseProps = $ReadOnly<{
848
848
  * the typed-in character otherwise including `' '` for space.
849
849
  * Fires before `onChange` callbacks.
850
850
  */
851
- onKeyPress?: ?(e: TextInputKeyPressEvent) => mixed,
851
+ onKeyPress?: ?(e: TextInputKeyPressEvent) => unknown,
852
852
 
853
853
  /**
854
854
  * Called when a single tap gesture is detected.
855
855
  */
856
- onPress?: ?(event: GestureResponderEvent) => mixed,
856
+ onPress?: ?(event: GestureResponderEvent) => unknown,
857
857
 
858
858
  /**
859
859
  * Called when a touch is engaged.
860
860
  */
861
- onPressIn?: ?(event: GestureResponderEvent) => mixed,
861
+ onPressIn?: ?(event: GestureResponderEvent) => unknown,
862
862
 
863
863
  /**
864
864
  * Called when a touch is released.
865
865
  */
866
- onPressOut?: ?(event: GestureResponderEvent) => mixed,
866
+ onPressOut?: ?(event: GestureResponderEvent) => unknown,
867
867
 
868
868
  /**
869
869
  * Callback that is called when the text input selection is changed.
870
870
  * This will be called with
871
871
  * `{ nativeEvent: { selection: { start, end } } }`.
872
872
  */
873
- onSelectionChange?: ?(e: TextInputSelectionChangeEvent) => mixed,
873
+ onSelectionChange?: ?(e: TextInputSelectionChangeEvent) => unknown,
874
874
 
875
875
  /**
876
876
  * Callback that is called when the text input's submit button is pressed.
877
877
  * Invalid if `multiline={true}` is specified.
878
878
  */
879
- onSubmitEditing?: ?(e: TextInputSubmitEditingEvent) => mixed,
879
+ onSubmitEditing?: ?(e: TextInputSubmitEditingEvent) => unknown,
880
880
 
881
881
  /**
882
882
  * Invoked on content scroll with `{ nativeEvent: { contentOffset: { x, y } } }`.
883
883
  * May also contain other properties from ScrollEvent but on Android contentSize
884
884
  * is not provided for performance reasons.
885
885
  */
886
- onScroll?: ?(e: ScrollEvent) => mixed,
886
+ onScroll?: ?(e: ScrollEvent) => unknown,
887
887
 
888
888
  /**
889
889
  * The string that will be rendered before text input has been entered.