@office-iss/react-native-win32 0.72.8 → 0.73.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 (277) hide show
  1. package/.flowconfig +15 -5
  2. package/CHANGELOG.json +530 -101
  3. package/CHANGELOG.md +213 -56
  4. package/IntegrationTests/PromiseTest.js +1 -0
  5. package/IntegrationTests/websocket_integration_test_server.js +1 -1
  6. package/Libraries/Animated/Animated.js +1 -1
  7. package/Libraries/Animated/AnimatedImplementation.js +1 -1
  8. package/Libraries/Animated/NativeAnimatedHelper.js +14 -10
  9. package/Libraries/Animated/NativeAnimatedHelper.win32.js +16 -12
  10. package/Libraries/Animated/NativeAnimatedModule.js +6 -2
  11. package/Libraries/Animated/NativeAnimatedTurboModule.js +7 -4
  12. package/Libraries/Animated/animations/Animation.js +57 -3
  13. package/Libraries/Animated/animations/DecayAnimation.js +9 -0
  14. package/Libraries/Animated/animations/SpringAnimation.js +8 -0
  15. package/Libraries/Animated/animations/TimingAnimation.js +8 -0
  16. package/Libraries/Animated/components/AnimatedFlatList.js +2 -1
  17. package/Libraries/Animated/components/AnimatedScrollView.js +2 -0
  18. package/Libraries/Animated/components/AnimatedSectionList.js +2 -1
  19. package/Libraries/Animated/createAnimatedComponent.js +1 -0
  20. package/Libraries/Animated/nodes/AnimatedColor.js +1 -1
  21. package/Libraries/Animated/nodes/AnimatedObject.js +146 -0
  22. package/Libraries/Animated/nodes/AnimatedProps.js +19 -7
  23. package/Libraries/Animated/nodes/AnimatedStyle.js +29 -55
  24. package/Libraries/Animated/nodes/AnimatedValueXY.js +3 -17
  25. package/Libraries/Animated/shouldUseTurboAnimatedModule.js +17 -0
  26. package/Libraries/Animated/useAnimatedProps.js +9 -10
  27. package/Libraries/AppState/AppState.d.ts +1 -1
  28. package/Libraries/AppState/NativeAppState.js +8 -4
  29. package/Libraries/BatchedBridge/MessageQueue.js +45 -36
  30. package/Libraries/Blob/Blob.js +6 -2
  31. package/Libraries/Blob/BlobManager.js +9 -10
  32. package/Libraries/Blob/BlobRegistry.js +14 -9
  33. package/Libraries/Blob/File.js +1 -1
  34. package/Libraries/Blob/FileReader.js +1 -2
  35. package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.d.ts +1 -5
  36. package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.win32.js +7 -48
  37. package/Libraries/Components/Button/ButtonWin32.Props.d.ts +1 -1
  38. package/Libraries/Components/Button/ButtonWin32.Props.js.map +1 -1
  39. package/Libraries/Components/Button/ButtonWin32.d.ts +1 -1
  40. package/Libraries/Components/Button/ButtonWin32.js +1 -4
  41. package/Libraries/Components/Button/ButtonWin32.js.map +1 -1
  42. package/Libraries/Components/Clipboard/Clipboard.d.ts +4 -4
  43. package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js +3 -1
  44. package/Libraries/Components/EnterString.win32.d.ts +1 -1
  45. package/Libraries/Components/Keyboard/KeyboardAvoidingView.js +26 -6
  46. package/Libraries/Components/Pressable/Pressable.js +3 -2
  47. package/Libraries/Components/Pressable/Pressable.win32.js +4 -3
  48. package/Libraries/Components/Pressable/useAndroidRippleForView.js +1 -1
  49. package/Libraries/Components/SafeAreaView/SafeAreaView.js +7 -7
  50. package/Libraries/Components/SafeAreaView/SafeAreaView.win32.js +7 -8
  51. package/Libraries/Components/ScrollView/ScrollView.js +3 -1
  52. package/Libraries/Components/ScrollView/ScrollView.win32.js +3 -1
  53. package/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +39 -46
  54. package/Libraries/Components/Switch/Switch.js +1 -0
  55. package/Libraries/Components/Text/TextWin32.d.ts +1 -1
  56. package/Libraries/Components/TextInput/RCTTextInputViewConfig.js +1 -0
  57. package/Libraries/Components/TextInput/TextInput.d.ts +49 -7
  58. package/Libraries/Components/TextInput/TextInput.flow.js +43 -10
  59. package/Libraries/Components/TextInput/TextInput.js +62 -10
  60. package/Libraries/Components/TextInput/TextInput.win32.js +953 -206
  61. package/Libraries/Components/TextInput/Win32TextInputNativeComponent.js +23 -0
  62. package/Libraries/Components/ToastAndroid/{ToastAndroid.ios.js → ToastAndroid.js} +9 -1
  63. package/Libraries/Components/ToastAndroid/ToastAndroid.win32.js +9 -1
  64. package/Libraries/Components/Touchable/Tests/TouchableWin32Test.js +2 -2
  65. package/Libraries/Components/Touchable/Tests/TouchableWin32Test.js.map +1 -1
  66. package/Libraries/Components/Touchable/TouchableBounce.js +1 -1
  67. package/Libraries/Components/Touchable/TouchableHighlight.js +1 -1
  68. package/Libraries/Components/Touchable/TouchableNativeFeedback.js +1 -1
  69. package/Libraries/Components/Touchable/TouchableOpacity.js +4 -1
  70. package/Libraries/Components/Touchable/TouchableWin32.d.ts +1 -1
  71. package/Libraries/Components/Touchable/TouchableWin32.js.map +1 -1
  72. package/Libraries/Components/Touchable/TouchableWithoutFeedback.js +1 -0
  73. package/Libraries/Components/TraceUpdateOverlay/TraceUpdateOverlay.js +16 -6
  74. package/Libraries/Components/View/ReactNativeStyleAttributes.js +9 -0
  75. package/Libraries/Components/View/ReactNativeViewAttributes.js +1 -0
  76. package/Libraries/Components/View/ReactNativeViewAttributes.win32.js +1 -0
  77. package/Libraries/Components/View/View.js +46 -32
  78. package/Libraries/Components/View/View.win32.js +37 -6
  79. package/Libraries/Components/View/ViewAccessibility.d.ts +8 -2
  80. package/Libraries/Components/View/ViewNativeComponent.js +1 -0
  81. package/Libraries/Components/View/ViewPropTypes.js +18 -3
  82. package/Libraries/Components/View/ViewPropTypes.win32.js +30 -4
  83. package/Libraries/Components/View/ViewWin32.js +3 -2
  84. package/Libraries/Core/Devtools/loadBundleFromServer.js +152 -0
  85. package/Libraries/Core/Devtools/symbolicateStackTrace.js +2 -1
  86. package/Libraries/Core/ExceptionsManager.js +16 -7
  87. package/Libraries/Core/ExtendedError.js +12 -0
  88. package/Libraries/Core/ReactNativeVersion.js +3 -3
  89. package/Libraries/Core/ReactNativeVersionCheck.js +0 -2
  90. package/Libraries/Core/ReactNativeVersionCheck.win32.js +0 -2
  91. package/Libraries/Core/__mocks__/NativeExceptionsManager.js +20 -0
  92. package/Libraries/Core/setUpDeveloperTools.js +5 -1
  93. package/Libraries/Core/setUpIntersectionObserver.js +16 -0
  94. package/Libraries/{Components/ProgressBarAndroid/ProgressBarAndroid.ios.js → Core/setUpMutationObserver.js} +6 -2
  95. package/Libraries/Core/setUpPerformance.js +6 -13
  96. package/Libraries/Core/setUpPerformanceObserver.js +16 -0
  97. package/Libraries/Core/setUpRegeneratorRuntime.js +4 -2
  98. package/Libraries/DOM/Nodes/ReactNativeElement.js +135 -18
  99. package/Libraries/DOM/Nodes/ReadOnlyCharacterData.js +72 -0
  100. package/Libraries/DOM/Nodes/ReadOnlyElement.js +209 -21
  101. package/Libraries/DOM/Nodes/ReadOnlyNode.js +206 -17
  102. package/Libraries/DOM/Nodes/ReadOnlyText.js +30 -0
  103. package/Libraries/DOM/Nodes/Utilities/Traversal.js +54 -0
  104. package/Libraries/EventEmitter/NativeEventEmitter.d.ts +0 -6
  105. package/Libraries/EventEmitter/RCTDeviceEventEmitter.js +15 -4
  106. package/Libraries/Image/Image.android.js +8 -2
  107. package/Libraries/Image/Image.d.ts +1 -1
  108. package/Libraries/Image/Image.ios.js +4 -1
  109. package/Libraries/Image/Image.win32.js +6 -3
  110. package/Libraries/Image/ImageBackground.js +3 -0
  111. package/Libraries/Image/resolveAssetSource.win32.js +1 -1
  112. package/Libraries/Inspector/DevtoolsOverlay.js +6 -3
  113. package/Libraries/Inspector/NetworkOverlay.js +2 -2
  114. package/Libraries/Interaction/JSEventLoopWatchdog.js +1 -5
  115. package/Libraries/Interaction/PanResponder.js +1 -4
  116. package/Libraries/IntersectionObserver/IntersectionObserver.js +252 -0
  117. package/Libraries/IntersectionObserver/IntersectionObserverEntry.js +140 -0
  118. package/Libraries/IntersectionObserver/IntersectionObserverManager.js +221 -0
  119. package/Libraries/IntersectionObserver/NativeIntersectionObserver.js +41 -0
  120. package/Libraries/IntersectionObserver/__mocks__/NativeIntersectionObserver.js +162 -0
  121. package/Libraries/LayoutAnimation/LayoutAnimation.js +1 -1
  122. package/Libraries/Lists/FlatList.d.ts +2 -1
  123. package/Libraries/Lists/FlatList.js +15 -5
  124. package/Libraries/Lists/SectionList.js +4 -0
  125. package/Libraries/LogBox/Data/LogBoxData.js +2 -1
  126. package/Libraries/LogBox/Data/LogBoxLog.js +4 -1
  127. package/Libraries/LogBox/Data/LogBoxSymbolication.js +5 -2
  128. package/Libraries/LogBox/Data/parseLogBoxLog.js +57 -20
  129. package/Libraries/LogBox/UI/AnsiHighlight.js +1 -1
  130. package/Libraries/LogBox/UI/LogBoxInspectorFooter.js +24 -31
  131. package/Libraries/LogBox/UI/LogBoxInspectorHeader.js +1 -1
  132. package/Libraries/LogBox/UI/LogBoxMessage.js +4 -7
  133. package/Libraries/MutationObserver/MutationObserver.js +184 -0
  134. package/Libraries/MutationObserver/MutationObserverManager.js +218 -0
  135. package/Libraries/MutationObserver/MutationRecord.js +82 -0
  136. package/Libraries/MutationObserver/NativeMutationObserver.js +58 -0
  137. package/Libraries/MutationObserver/__mocks__/NativeMutationObserver.js +327 -0
  138. package/Libraries/NativeComponent/BaseViewConfig.android.js +18 -3
  139. package/Libraries/NativeComponent/BaseViewConfig.ios.js +33 -0
  140. package/Libraries/NativeComponent/BaseViewConfig.win32.js +33 -0
  141. package/Libraries/NativeComponent/NativeComponentRegistry.js +13 -9
  142. package/Libraries/NativeModules/specs/NativeSourceCode.js +6 -6
  143. package/Libraries/Network/RCTNetworking.android.js +2 -1
  144. package/Libraries/Network/XMLHttpRequest.js +1 -1
  145. package/Libraries/NewAppScreen/components/DebugInstructions.js +4 -4
  146. package/Libraries/NewAppScreen/components/LearnMoreLinks.js +9 -2
  147. package/Libraries/Performance/QuickPerformanceLogger.js +1 -1
  148. package/Libraries/PermissionsAndroid/NativePermissionsAndroid.js +1 -0
  149. package/Libraries/PermissionsAndroid/PermissionsAndroid.d.ts +1 -0
  150. package/Libraries/PermissionsAndroid/PermissionsAndroid.js +3 -1
  151. package/Libraries/Pressability/Pressability.js +28 -3
  152. package/Libraries/Pressability/Pressability.win32.js +30 -5
  153. package/Libraries/ReactNative/AppContainer.js +2 -3
  154. package/Libraries/ReactNative/AppRegistry.d.ts +0 -5
  155. package/Libraries/ReactNative/AppRegistry.js +66 -53
  156. package/Libraries/ReactNative/BridgelessUIManager.js +38 -9
  157. package/Libraries/ReactNative/FabricUIManager.js +143 -34
  158. package/Libraries/ReactNative/I18nManager.js +5 -11
  159. package/Libraries/ReactNative/NativeI18nManager.js +7 -5
  160. package/Libraries/ReactNative/PaperUIManager.win32.js +2 -2
  161. package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricHostComponent.js +151 -0
  162. package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstance.js +81 -0
  163. package/Libraries/ReactNative/ReactFabricPublicInstance/ReactNativeAttributePayload.js +492 -0
  164. package/Libraries/ReactNative/ReactFabricPublicInstance/warnForStyleProps.js +32 -0
  165. package/Libraries/ReactNative/ReactNativeFeatureFlags.js +19 -3
  166. package/Libraries/ReactNative/UIManager.js +8 -0
  167. package/Libraries/ReactNative/__mocks__/FabricUIManager.js +648 -0
  168. package/Libraries/ReactPrivate/ReactNativePrivateInterface.js +38 -2
  169. package/Libraries/Renderer/implementations/ReactFabric-dev.js +27 -27
  170. package/Libraries/Renderer/implementations/ReactFabric-prod.js +3 -3
  171. package/Libraries/Renderer/implementations/ReactFabric-profiling.js +3 -3
  172. package/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js +27 -27
  173. package/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js +3 -3
  174. package/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.js +3 -3
  175. package/Libraries/Renderer/shims/ReactFabric.js +5 -6
  176. package/Libraries/Renderer/shims/ReactFeatureFlags.js +2 -3
  177. package/Libraries/Renderer/shims/ReactNative.js +2 -3
  178. package/Libraries/Renderer/shims/ReactNativeTypes.js +35 -17
  179. package/Libraries/Renderer/shims/ReactNativeViewConfigRegistry.js +3 -3
  180. package/Libraries/Renderer/shims/createReactNativeComponentClass.js +2 -3
  181. package/Libraries/Settings/{Settings.android.js → Settings.js} +4 -4
  182. package/Libraries/Share/Share.d.ts +3 -9
  183. package/Libraries/StyleSheet/PlatformColorValueTypes.android.js +9 -4
  184. package/Libraries/StyleSheet/PlatformColorValueTypes.ios.js +28 -13
  185. package/Libraries/StyleSheet/PlatformColorValueTypes.win32.js +14 -4
  186. package/Libraries/StyleSheet/PlatformColorValueTypesIOS.ios.js +1 -1
  187. package/Libraries/StyleSheet/PlatformColorValueTypesWin32.d.ts +1 -1
  188. package/Libraries/StyleSheet/StyleSheet.d.ts +10 -1
  189. package/Libraries/StyleSheet/StyleSheet.js +3 -0
  190. package/Libraries/StyleSheet/StyleSheet.win32.js +3 -0
  191. package/Libraries/StyleSheet/StyleSheetTypes.d.ts +31 -17
  192. package/Libraries/StyleSheet/StyleSheetTypes.js +90 -6
  193. package/Libraries/StyleSheet/flattenStyle.js +4 -0
  194. package/Libraries/StyleSheet/private/_TransformStyle.js +16 -2
  195. package/Libraries/StyleSheet/processColor.js +1 -2
  196. package/Libraries/StyleSheet/processTransformOrigin.js +136 -0
  197. package/Libraries/StyleSheet/splitLayoutProps.js +1 -0
  198. package/Libraries/Text/Text.d.ts +5 -5
  199. package/Libraries/Text/Text.js +17 -10
  200. package/Libraries/Text/Text.win32.js +354 -0
  201. package/Libraries/Text/TextProps.win32.js +281 -0
  202. package/Libraries/TurboModule/TurboModuleRegistry.js +47 -7
  203. package/Libraries/TurboModule/samples/NativeSampleTurboModule.js +6 -0
  204. package/Libraries/Types/CoreEventTypes.d.ts +5 -2
  205. package/Libraries/Utilities/GlobalPerformanceLogger.js +2 -12
  206. package/Libraries/Utilities/NativeDeviceInfo.js +8 -9
  207. package/Libraries/Utilities/NativePlatformConstantsAndroid.js +23 -18
  208. package/Libraries/Utilities/NativePlatformConstantsIOS.js +16 -13
  209. package/Libraries/Utilities/NativePlatformConstantsWin.js +13 -10
  210. package/Libraries/Utilities/PerformanceLoggerContext.js +1 -1
  211. package/Libraries/Utilities/Platform.android.js +12 -8
  212. package/Libraries/Utilities/Platform.d.ts +1 -0
  213. package/Libraries/Utilities/Platform.flow.js +84 -0
  214. package/Libraries/Utilities/Platform.flow.win32.js +111 -0
  215. package/Libraries/Utilities/Platform.ios.js +12 -8
  216. package/Libraries/Utilities/Platform.win32.js +12 -8
  217. package/Libraries/Utilities/PolyfillFunctions.js +1 -1
  218. package/Libraries/Utilities/ReactNativeTestTools.js +1 -2
  219. package/Libraries/Utilities/SceneTracker.js +1 -1
  220. package/Libraries/Utilities/createPerformanceLogger.js +63 -32
  221. package/Libraries/Utilities/useColorScheme.js +7 -8
  222. package/Libraries/WebPerformance/MemoryInfo.js +1 -1
  223. package/Libraries/WebPerformance/NativePerformance.js +3 -8
  224. package/Libraries/WebPerformance/NativePerformanceObserver.js +4 -0
  225. package/Libraries/WebPerformance/Performance.js +42 -15
  226. package/Libraries/WebPerformance/PerformanceEntry.js +14 -6
  227. package/Libraries/WebPerformance/PerformanceEventTiming.js +18 -1
  228. package/Libraries/WebPerformance/ReactNativeStartupTiming.js +40 -14
  229. package/Libraries/WebPerformance/__mocks__/NativePerformance.js +4 -2
  230. package/Libraries/WebPerformance/__mocks__/NativePerformanceObserver.js +21 -3
  231. package/Libraries/promiseRejectionTrackingOptions.js +21 -9
  232. package/Libraries/vendor/emitter/EventEmitter.js +17 -17
  233. package/flow/global.js +1 -3
  234. package/flow/jest.js +5 -1
  235. package/{Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.ios.js → jest/ReactNativeInternalFeatureFlagsMock.js} +2 -1
  236. package/jest/__tests__/setup-test.js +18 -0
  237. package/jest/mockModal.js +6 -4
  238. package/jest/setup.js +61 -30
  239. package/jest.config.js +1 -1
  240. package/just-task.js +1 -0
  241. package/overrides.json +54 -60
  242. package/package.json +35 -33
  243. package/src/Libraries/Components/Button/ButtonWin32.Props.ts +1 -1
  244. package/src/Libraries/Components/Button/ButtonWin32.tsx +0 -2
  245. package/src/Libraries/Components/Touchable/Tests/TouchableWin32Test.tsx +2 -2
  246. package/src/Libraries/Components/Touchable/TouchableWin32.tsx +1 -1
  247. package/src/Libraries/Components/View/ViewAccessibility.d.ts +8 -2
  248. package/src/Libraries/StyleSheet/PlatformColorValueTypesWin32.d.ts +1 -1
  249. package/types/experimental.d.ts +44 -0
  250. package/types/index.d.ts +2 -1
  251. package/types/modules/Devtools.d.ts +1 -0
  252. package/types/modules/globals.d.ts +16 -1
  253. package/IntegrationTests/BUCK +0 -32
  254. package/IntegrationTests/PropertiesUpdateTest.js +0 -29
  255. package/IntegrationTests/RCTRootViewIntegrationTestApp.js +0 -86
  256. package/IntegrationTests/ReactContentSizeUpdateTest.js +0 -89
  257. package/IntegrationTests/SizeFlexibilityUpdateTest.js +0 -106
  258. package/Libraries/Components/AccessibilityInfo/NativeAccessibilityInfoWin32.js +0 -37
  259. package/Libraries/Components/TextInput/TextInput.Types.win32.d.ts +0 -51
  260. package/Libraries/Components/TextInput/TextInput.Types.win32.js +0 -3
  261. package/Libraries/Components/TextInput/TextInput.Types.win32.js.map +0 -1
  262. package/Libraries/Utilities/AcessibilityMapping.js +0 -154
  263. package/Libraries/Utilities/AcessibilityMapping.win32.js +0 -156
  264. package/Libraries/Utilities/NativeDevSplitBundleLoader.js +0 -19
  265. package/Libraries/Utilities/useColorScheme.win32.js +0 -26
  266. package/flow/use-sync-external-store.js +0 -20
  267. package/flow-typed/npm/base64-js_v1.x.x.js +0 -12
  268. package/flow-typed/npm/glob_v7.x.x.js +0 -79
  269. package/flow-typed/npm/pretty-format_v26.x.x.js +0 -49
  270. package/flow-typed/npm/promise_v8.x.x.js +0 -30
  271. package/flow-typed/npm/react-dom_v17.x.x.js +0 -139
  272. package/flow-typed/npm/react-test-renderer_v16.x.x.js +0 -79
  273. package/flow-typed/npm/stacktrace-parser_v0.1.x.js +0 -17
  274. package/flow-typed/npm/yargs_v17.x.x.js +0 -341
  275. package/src/Libraries/Components/AccessibilityInfo/AccessibilityInfo.d.ts +0 -161
  276. package/src/Libraries/Components/TextInput/TextInput.Types.win32.ts +0 -68
  277. /package/Libraries/{Renderer/public → ReactNative/ReactFabricPublicInstance}/ReactFabricPublicInstanceUtils.js +0 -0
@@ -388,10 +388,13 @@ class MessageQueue {
388
388
 
389
389
  __callReactNativeMicrotasks() {
390
390
  Systrace.beginEvent('JSTimers.callReactNativeMicrotasks()');
391
- if (this._reactNativeMicrotasksCallback != null) {
392
- this._reactNativeMicrotasksCallback();
391
+ try {
392
+ if (this._reactNativeMicrotasksCallback != null) {
393
+ this._reactNativeMicrotasksCallback();
394
+ }
395
+ } finally {
396
+ Systrace.endEvent();
393
397
  }
394
- Systrace.endEvent();
395
398
  }
396
399
 
397
400
  __callFunction(module: string, method: string, args: mixed[]): void {
@@ -402,31 +405,35 @@ class MessageQueue {
402
405
  } else {
403
406
  Systrace.beginEvent(`${module}.${method}(...)`);
404
407
  }
405
- if (this.__spy) {
406
- this.__spy({type: TO_JS, module, method, args});
407
- }
408
- const moduleMethods = this.getCallableModule(module);
409
- if (!moduleMethods) {
410
- const callableModuleNames = Object.keys(this._lazyCallableModules);
411
- const n = callableModuleNames.length;
412
- const callableModuleNameList = callableModuleNames.join(', ');
413
-
414
- // TODO(T122225939): Remove after investigation: Why are we getting to this line in bridgeless mode?
415
- const isBridgelessMode = global.RN$Bridgeless === true ? 'true' : 'false';
416
- invariant(
417
- false,
418
- `Failed to call into JavaScript module method ${module}.${method}(). Module has not been registered as callable. Bridgeless Mode: ${isBridgelessMode}. Registered callable JavaScript modules (n = ${n}): ${callableModuleNameList}.
419
- A frequent cause of the error is that the application entry file path is incorrect. This can also happen when the JS bundle is corrupt or there is an early initialization error when loading React Native.`,
420
- );
421
- }
422
- if (!moduleMethods[method]) {
423
- invariant(
424
- false,
425
- `Failed to call into JavaScript module method ${module}.${method}(). Module exists, but the method is undefined.`,
426
- );
408
+ try {
409
+ if (this.__spy) {
410
+ this.__spy({type: TO_JS, module, method, args});
411
+ }
412
+ const moduleMethods = this.getCallableModule(module);
413
+ if (!moduleMethods) {
414
+ const callableModuleNames = Object.keys(this._lazyCallableModules);
415
+ const n = callableModuleNames.length;
416
+ const callableModuleNameList = callableModuleNames.join(', ');
417
+
418
+ // TODO(T122225939): Remove after investigation: Why are we getting to this line in bridgeless mode?
419
+ const isBridgelessMode =
420
+ global.RN$Bridgeless === true ? 'true' : 'false';
421
+ invariant(
422
+ false,
423
+ `Failed to call into JavaScript module method ${module}.${method}(). Module has not been registered as callable. Bridgeless Mode: ${isBridgelessMode}. Registered callable JavaScript modules (n = ${n}): ${callableModuleNameList}.
424
+ A frequent cause of the error is that the application entry file path is incorrect. This can also happen when the JS bundle is corrupt or there is an early initialization error when loading React Native.`,
425
+ );
426
+ }
427
+ if (!moduleMethods[method]) {
428
+ invariant(
429
+ false,
430
+ `Failed to call into JavaScript module method ${module}.${method}(). Module exists, but the method is undefined.`,
431
+ );
432
+ }
433
+ moduleMethods[method].apply(moduleMethods, args);
434
+ } finally {
435
+ Systrace.endEvent();
427
436
  }
428
- moduleMethods[method].apply(moduleMethods, args);
429
- Systrace.endEvent();
430
437
  }
431
438
 
432
439
  __invokeCallback(cbID: number, args: mixed[]): void {
@@ -465,16 +472,18 @@ class MessageQueue {
465
472
  );
466
473
  }
467
474
 
468
- if (!callback) {
469
- return;
470
- }
471
-
472
- this._successCallbacks.delete(callID);
473
- this._failureCallbacks.delete(callID);
474
- callback(...args);
475
+ try {
476
+ if (!callback) {
477
+ return;
478
+ }
475
479
 
476
- if (__DEV__) {
477
- Systrace.endEvent();
480
+ this._successCallbacks.delete(callID);
481
+ this._failureCallbacks.delete(callID);
482
+ callback(...args);
483
+ } finally {
484
+ if (__DEV__) {
485
+ Systrace.endEvent();
486
+ }
478
487
  }
479
488
  }
480
489
  }
@@ -57,7 +57,10 @@ class Blob {
57
57
  * Currently we only support creating Blobs from other Blobs.
58
58
  * Reference: https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob
59
59
  */
60
- constructor(parts: Array<Blob | string> = [], options?: BlobOptions) {
60
+ constructor(
61
+ parts: Array<$ArrayBufferView | ArrayBuffer | Blob | string> = [],
62
+ options?: BlobOptions,
63
+ ) {
61
64
  const BlobManager = require('./BlobManager');
62
65
  this.data = BlobManager.createFromParts(parts, options).data;
63
66
  }
@@ -81,7 +84,7 @@ class Blob {
81
84
  return this._data;
82
85
  }
83
86
 
84
- slice(start?: number, end?: number): Blob {
87
+ slice(start?: number, end?: number, contentType: string = ''): Blob {
85
88
  const BlobManager = require('./BlobManager');
86
89
  let {offset, size} = this.data;
87
90
 
@@ -109,6 +112,7 @@ class Blob {
109
112
  blobId: this.data.blobId,
110
113
  offset,
111
114
  size,
115
+ type: contentType,
112
116
  /* Since `blob.slice()` creates a new view onto the same binary
113
117
  * data as the original blob, we should re-use the same collector
114
118
  * object so that the underlying resource gets deallocated when
@@ -11,6 +11,7 @@
11
11
  import type {BlobCollector, BlobData, BlobOptions} from './BlobTypes';
12
12
 
13
13
  import NativeBlobModule from './NativeBlobModule';
14
+ import {fromByteArray} from 'base64-js';
14
15
  import invariant from 'invariant';
15
16
 
16
17
  const Blob = require('./Blob');
@@ -59,22 +60,20 @@ class BlobManager {
59
60
  * Create blob from existing array of blobs.
60
61
  */
61
62
  static createFromParts(
62
- parts: Array<Blob | string>,
63
+ parts: Array<$ArrayBufferView | ArrayBuffer | Blob | string>,
63
64
  options?: BlobOptions,
64
65
  ): Blob {
65
66
  invariant(NativeBlobModule, 'NativeBlobModule is available.');
66
67
 
67
68
  const blobId = uuidv4();
68
69
  const items = parts.map(part => {
69
- if (
70
- part instanceof ArrayBuffer ||
71
- (global.ArrayBufferView && part instanceof global.ArrayBufferView)
72
- ) {
73
- throw new Error(
74
- "Creating blobs from 'ArrayBuffer' and 'ArrayBufferView' are not supported",
75
- );
76
- }
77
- if (part instanceof Blob) {
70
+ if (part instanceof ArrayBuffer || ArrayBuffer.isView(part)) {
71
+ return {
72
+ // $FlowFixMe[incompatible-cast]
73
+ data: fromByteArray(new Uint8Array((part: ArrayBuffer))),
74
+ type: 'string',
75
+ };
76
+ } else if (part instanceof Blob) {
78
77
  return {
79
78
  data: part.data,
80
79
  type: 'blob',
@@ -8,27 +8,32 @@
8
8
  * @format
9
9
  */
10
10
 
11
- const registry: {[key: string]: number, ...} = {};
11
+ const registry: Map<string, number> = new Map();
12
12
 
13
13
  const register = (id: string) => {
14
- if (registry[id]) {
15
- registry[id]++;
14
+ const used = registry.get(id);
15
+
16
+ if (used != null) {
17
+ registry.set(id, used + 1);
16
18
  } else {
17
- registry[id] = 1;
19
+ registry.set(id, 1);
18
20
  }
19
21
  };
20
22
 
21
23
  const unregister = (id: string) => {
22
- if (registry[id]) {
23
- registry[id]--;
24
- if (registry[id] <= 0) {
25
- delete registry[id];
24
+ const used = registry.get(id);
25
+
26
+ if (used != null) {
27
+ if (used <= 1) {
28
+ registry.delete(id);
29
+ } else {
30
+ registry.set(id, used - 1);
26
31
  }
27
32
  }
28
33
  };
29
34
 
30
35
  const has = (id: string): number | boolean => {
31
- return registry[id] && registry[id] > 0;
36
+ return registry.get(id) || false;
32
37
  };
33
38
 
34
39
  module.exports = {
@@ -23,7 +23,7 @@ class File extends Blob {
23
23
  * Constructor for JS consumers.
24
24
  */
25
25
  constructor(
26
- parts: Array<Blob | string>,
26
+ parts: Array<$ArrayBufferView | ArrayBuffer | Blob | string>,
27
27
  name: string,
28
28
  options?: BlobOptions,
29
29
  ) {
@@ -12,8 +12,7 @@ import type Blob from './Blob';
12
12
 
13
13
  import NativeFileReaderModule from './NativeFileReaderModule';
14
14
  import {toByteArray} from 'base64-js';
15
-
16
- const EventTarget = require('event-target-shim');
15
+ import EventTarget from 'event-target-shim';
17
16
 
18
17
  type ReadyState =
19
18
  | 0 // EMPTY
@@ -134,14 +134,10 @@ export interface AccessibilityInfoStatic {
134
134
  * - `announcement`: The string announced by the screen reader.
135
135
  * - `options`: An object that configures the reading options.
136
136
  * - `queue`: The announcement will be queued behind existing announcements. iOS only.
137
- * - `nativeID`: The nativeID of the element to send the announcement from. win32 only.
138
137
  */
139
138
  announceForAccessibilityWithOptions(
140
139
  announcement: string,
141
- options: {
142
- queue?: boolean | undefined;
143
- nativeID?: string | undefined; // win32
144
- },
140
+ options: {queue?: boolean | undefined},
145
141
  ): void;
146
142
 
147
143
  /**
@@ -17,7 +17,6 @@ import {sendAccessibilityEvent} from '../../ReactNative/RendererProxy';
17
17
  import Platform from '../../Utilities/Platform';
18
18
  import legacySendAccessibilityEvent from './legacySendAccessibilityEvent';
19
19
  import NativeAccessibilityInfo from './NativeAccessibilityInfo';
20
- import NativeAccessibilityInfoWin32 from './NativeAccessibilityInfoWin32';
21
20
  import NativeAccessibilityManagerIOS from './NativeAccessibilityManager';
22
21
 
23
22
  // Events that are only supported on Android.
@@ -167,18 +166,12 @@ const AccessibilityInfo = {
167
166
  */
168
167
  isReduceMotionEnabled(): Promise<boolean> {
169
168
  return new Promise((resolve, reject) => {
170
- if (Platform.OS === 'android') {
169
+ if (Platform.OS === 'android' || Platform.OS === 'win32') {
171
170
  if (NativeAccessibilityInfo != null) {
172
171
  NativeAccessibilityInfo.isReduceMotionEnabled(resolve);
173
172
  } else {
174
173
  reject(null);
175
174
  }
176
- } else if (Platform.OS === 'win32') {
177
- if (NativeAccessibilityInfoWin32 != null) {
178
- NativeAccessibilityInfoWin32.isReduceMotionEnabled(resolve);
179
- } else {
180
- reject(null);
181
- }
182
175
  } else {
183
176
  if (NativeAccessibilityManagerIOS != null) {
184
177
  NativeAccessibilityManagerIOS.getCurrentReduceMotionState(
@@ -255,18 +248,12 @@ const AccessibilityInfo = {
255
248
  */
256
249
  isScreenReaderEnabled(): Promise<boolean> {
257
250
  return new Promise((resolve, reject) => {
258
- if (Platform.OS === 'android') {
251
+ if (Platform.OS === 'android' || Platform.OS === 'win32') {
259
252
  if (NativeAccessibilityInfo != null) {
260
253
  NativeAccessibilityInfo.isTouchExplorationEnabled(resolve);
261
254
  } else {
262
255
  reject(null);
263
256
  }
264
- } else if (Platform.OS === 'win32') {
265
- if (NativeAccessibilityInfoWin32 != null) {
266
- NativeAccessibilityInfoWin32.isTouchExplorationEnabled(resolve);
267
- } else {
268
- reject(null);
269
- }
270
257
  } else {
271
258
  if (NativeAccessibilityManagerIOS != null) {
272
259
  NativeAccessibilityManagerIOS.getCurrentVoiceOverState(
@@ -383,10 +370,8 @@ const AccessibilityInfo = {
383
370
  * See https://reactnative.dev/docs/accessibilityinfo#announceforaccessibility
384
371
  */
385
372
  announceForAccessibility(announcement: string): void {
386
- if (Platform.OS === 'android') {
373
+ if (Platform.OS === 'android' || Platform.OS === 'win32') {
387
374
  NativeAccessibilityInfo?.announceForAccessibility(announcement);
388
- } else if (Platform.OS === 'win32') {
389
- NativeAccessibilityInfoWin32?.announceForAccessibility(announcement);
390
375
  } else {
391
376
  NativeAccessibilityManagerIOS?.announceForAccessibility(announcement);
392
377
  }
@@ -397,33 +382,18 @@ const AccessibilityInfo = {
397
382
  * - `announcement`: The string announced by the screen reader.
398
383
  * - `options`: An object that configures the reading options.
399
384
  * - `queue`: The announcement will be queued behind existing announcements. iOS only.
400
- * - `nativeID`: The nativeID of the element to send the announcement from. win32 only.
401
385
  */
402
386
  announceForAccessibilityWithOptions(
403
387
  announcement: string,
404
- options: {
405
- queue?: boolean,
406
- nativeID?: string, // win32
407
- },
388
+ options: {queue?: boolean},
408
389
  ): void {
409
- if (Platform.OS === 'android') {
390
+ if (Platform.OS === 'android' || Platform.OS === 'win32') {
410
391
  NativeAccessibilityInfo?.announceForAccessibility(announcement);
411
- } else if (Platform.OS === 'win32') {
412
- if (NativeAccessibilityInfoWin32?.announceForAccessibilityWithOptions) {
413
- NativeAccessibilityInfoWin32?.announceForAccessibilityWithOptions(
414
- announcement,
415
- options,
416
- );
417
- } else {
418
- NativeAccessibilityInfoWin32?.announceForAccessibility(announcement);
419
- }
420
392
  } else {
421
393
  if (NativeAccessibilityManagerIOS?.announceForAccessibilityWithOptions) {
422
- const {nativeID: _, ...iosOptions} = options;
423
- // $FlowFixMe[prop-missing]
424
394
  NativeAccessibilityManagerIOS?.announceForAccessibilityWithOptions(
425
395
  announcement,
426
- iosOptions,
396
+ options,
427
397
  );
428
398
  } else {
429
399
  NativeAccessibilityManagerIOS?.announceForAccessibility(announcement);
@@ -437,7 +407,7 @@ const AccessibilityInfo = {
437
407
  * See https://reactnative.dev/docs/accessibilityinfo#getrecommendedtimeoutmillis
438
408
  */
439
409
  getRecommendedTimeoutMillis(originalTimeout: number): Promise<number> {
440
- if (Platform.OS === 'android') {
410
+ if (Platform.OS === 'android' || Platform.OS === 'win32') {
441
411
  return new Promise((resolve, reject) => {
442
412
  if (NativeAccessibilityInfo?.getRecommendedTimeoutMillis) {
443
413
  NativeAccessibilityInfo.getRecommendedTimeoutMillis(
@@ -448,17 +418,6 @@ const AccessibilityInfo = {
448
418
  resolve(originalTimeout);
449
419
  }
450
420
  });
451
- } else if (Platform.OS === 'win32') {
452
- return new Promise((resolve, reject) => {
453
- if (NativeAccessibilityInfoWin32?.getRecommendedTimeoutMillis) {
454
- NativeAccessibilityInfoWin32.getRecommendedTimeoutMillis(
455
- originalTimeout,
456
- resolve,
457
- );
458
- } else {
459
- resolve(originalTimeout);
460
- }
461
- });
462
421
  } else {
463
422
  return Promise.resolve(originalTimeout);
464
423
  }
@@ -5,7 +5,7 @@ export interface IButtonWin32Style extends Omit<RN.TextStyle, ButtonWin32OmitSty
5
5
  }
6
6
  export interface IButtonWin32Props extends RN.ButtonProps {
7
7
  /**
8
- * Style information which controls the visual appearence of the button.
8
+ * Style information which controls the visual appearance of the button.
9
9
  */
10
10
  style?: RN.StyleProp<IButtonWin32Style>;
11
11
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"ButtonWin32.Props.js","sourceRoot":"","sources":["../../../src/Libraries/Components/Button/ButtonWin32.Props.ts"],"names":[],"mappings":"","sourcesContent":["import RN = require('react-native');\n\n// removes from interface T the members of interface K\ntype Omit<T, K> = Pick<T, Exclude<keyof T, keyof K>>;\n\nexport type ButtonWin32OmitStyles = RN.TextStyleIOS & RN.TextStyleAndroid;\n\nexport interface IButtonWin32Style extends Omit<RN.TextStyle, ButtonWin32OmitStyles> {}\n\nexport interface IButtonWin32Props extends RN.ButtonProps {\n /**\n * Style information which controls the visual appearence of the button.\n */\n style?: RN.StyleProp<IButtonWin32Style>;\n\n /**\n * Blur event. Called when focus is lost.\n */\n onBlur?: () => void;\n\n /**\n * Focus event. Called when focus is acquired.\n */\n onFocus?: () => void;\n\n /**\n * Mouse-enter event. Called when mouse is moved on to the control.\n */\n onMouseEnter?: () => void;\n\n /**\n * Mouse-leave event. Called when mouse is moved off of the control.\n */\n onMouseLeave?: () => void;\n\n /**\n * Touch-start event. Called when the user begins touching the control.\n */\n onTouchStart?: (event: RN.GestureResponderEvent) => void;\n\n /**\n * Touch-end event. Called when the user stops touching the control.\n */\n onTouchEnd?: (event: RN.GestureResponderEvent) => void;\n}\n"]}
1
+ {"version":3,"file":"ButtonWin32.Props.js","sourceRoot":"","sources":["../../../src/Libraries/Components/Button/ButtonWin32.Props.ts"],"names":[],"mappings":"","sourcesContent":["import RN = require('react-native');\n\n// removes from interface T the members of interface K\ntype Omit<T, K> = Pick<T, Exclude<keyof T, keyof K>>;\n\nexport type ButtonWin32OmitStyles = RN.TextStyleIOS & RN.TextStyleAndroid;\n\nexport interface IButtonWin32Style extends Omit<RN.TextStyle, ButtonWin32OmitStyles> {}\n\nexport interface IButtonWin32Props extends RN.ButtonProps {\n /**\n * Style information which controls the visual appearance of the button.\n */\n style?: RN.StyleProp<IButtonWin32Style>;\n\n /**\n * Blur event. Called when focus is lost.\n */\n onBlur?: () => void;\n\n /**\n * Focus event. Called when focus is acquired.\n */\n onFocus?: () => void;\n\n /**\n * Mouse-enter event. Called when mouse is moved on to the control.\n */\n onMouseEnter?: () => void;\n\n /**\n * Mouse-leave event. Called when mouse is moved off of the control.\n */\n onMouseLeave?: () => void;\n\n /**\n * Touch-start event. Called when the user begins touching the control.\n */\n onTouchStart?: (event: RN.GestureResponderEvent) => void;\n\n /**\n * Touch-end event. Called when the user stops touching the control.\n */\n onTouchEnd?: (event: RN.GestureResponderEvent) => void;\n}\n"]}
@@ -9,7 +9,7 @@ interface IButtonWin32State {
9
9
  */
10
10
  export declare class ButtonWin32 extends React.Component<IButtonWin32Props, IButtonWin32State> {
11
11
  constructor(props: IButtonWin32Props);
12
- render(): JSX.Element;
12
+ render(): React.JSX.Element;
13
13
  private readonly _makeState;
14
14
  private readonly _setState;
15
15
  private readonly _onFocus;
@@ -64,7 +64,6 @@ class ButtonWin32 extends react_1.default.Component {
64
64
  onBlur: this._onBlur,
65
65
  onMouseEnter: this.props.onMouseEnter,
66
66
  onMouseLeave: this.props.onMouseLeave,
67
- // @ts-ignore
68
67
  onTouchStart: this.props.onTouchStart,
69
68
  onTouchEnd: this._onTouchEnd,
70
69
  testID: this.props.testID,
@@ -76,9 +75,7 @@ class ButtonWin32 extends react_1.default.Component {
76
75
  if (this.props.color) {
77
76
  textProps.style = { color: this.props.color };
78
77
  }
79
- return (
80
- // @ts-ignore
81
- react_1.default.createElement(RN.ViewWin32, { ...viewProps },
78
+ return (react_1.default.createElement(RN.ViewWin32, { ...viewProps },
82
79
  react_1.default.createElement(RN.TextWin32, { ...textProps }, this.props.title)));
83
80
  }
84
81
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ButtonWin32.js","sourceRoot":"","sources":["../../../src/Libraries/Components/Button/ButtonWin32.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAAyB;AACzB,mCAAoC;AAKpC,IAAW,WAGV;AAHD,WAAW,WAAW;IACpB,2DAAW,CAAA;IACX,qDAAQ,CAAA;AACV,CAAC,EAHU,WAAW,KAAX,WAAW,QAGrB;AAMD;;GAEG;AACH,MAAa,WAAY,SAAQ,eAAK,CAAC,SAA+C;IACpF,YAAY,KAAwB;QAClC,KAAK,CAAC,KAAK,CAAC,CAAC;QAqCE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W,CAAC,WAAW,CAAC,CAAC;IACxD,CAAC;IAEM,MAAM;QACX,MAAM,SAAS,GAAoB;YACjC,UAAU,EAAE,IAAI;YAChB,kBAAkB,EAAE,IAAI,CAAC,KAAK,CAAC,kBAAkB,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK;YACrE,iBAAiB,EAAE,QAAQ;YAC3B,kBAAkB,EAAE,IAAI,CAAC,KAAK,CAAC,kBAAkB;YACjD,SAAS,EAAE,IAAI;YACf,OAAO,EAAE,IAAI,CAAC,QAAQ;YACtB,MAAM,EAAE,IAAI,CAAC,OAAO;YACpB,YAAY,EAAE,IAAI,CAAC,KAAK,CAAC,YAAY;YACrC,YAAY,EAAE,IAAI,CAAC,KAAK,CAAC,YAAY;YACrC,aAAa;YACb,YAAY,EAAE,IAAI,CAAC,KAAK,CAAC,YAAY;YACrC,UAAU,EAAE,IAAI,CAAC,WAAW;YAC5B,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM;YACzB,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAmC;SACtD,CAAC;QAEF,MAAM,SAAS,GAAoB;YACjC,SAAS,EAAE,MAAM;SAClB,CAAC;QACF,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE;YACpB,SAAS,CAAC,KAAK,GAAG,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;SAC/C;QAED,OAAO;QACL,aAAa;QACb,8BAAC,EAAE,CAAC,SAAS,OAAK,SAAS;YACzB,8BAAC,EAAE,CAAC,SAAS,OAAK,SAAS,IAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAgB,CACjD,CAChB,CAAC;IACJ,CAAC;CAwCF;AA7ED,kCA6EC","sourcesContent":["import React from 'react'\nimport RN = require('react-native');\nimport type { IViewWin32Props } from '../View/ViewPropTypes';\nimport type { ITextWin32Props } from '../Text/TextWin32.Props';\nimport type { IButtonWin32Props } from './ButtonWin32.Props';\n\nconst enum SelectState {\n NotSelected,\n Selected\n}\n\ninterface IButtonWin32State {\n accessibilityState: RN.AccessibilityState;\n}\n\n/**\n * React-native <Button> control with additional Win32-specific functionality.\n */\nexport class ButtonWin32 extends React.Component<IButtonWin32Props, IButtonWin32State> {\n constructor(props: IButtonWin32Props) {\n super(props);\n this.state = this._makeState(SelectState.NotSelected);\n }\n\n public render() {\n const viewProps: IViewWin32Props = {\n accessible: true,\n accessibilityLabel: this.props.accessibilityLabel || this.props.title,\n accessibilityRole: 'button',\n accessibilityState: this.state.accessibilityState,\n focusable: true,\n onFocus: this._onFocus,\n onBlur: this._onBlur,\n onMouseEnter: this.props.onMouseEnter,\n onMouseLeave: this.props.onMouseLeave,\n // @ts-ignore\n onTouchStart: this.props.onTouchStart,\n onTouchEnd: this._onTouchEnd,\n testID: this.props.testID,\n style: this.props.style as RN.StyleProp<RN.ViewStyle>,\n };\n\n const textProps: ITextWin32Props = {\n textStyle: 'None',\n };\n if (this.props.color) {\n textProps.style = { color: this.props.color };\n }\n\n return (\n // @ts-ignore\n <RN.ViewWin32 {...viewProps}>\n <RN.TextWin32 {...textProps}>{this.props.title}</RN.TextWin32>\n </RN.ViewWin32>\n );\n }\n\n private readonly _makeState = (select: SelectState): IButtonWin32State => {\n return {\n accessibilityState: {\n disabled: this.props.disabled,\n selected: select === SelectState.Selected,\n },\n };\n };\n\n private readonly _setState = (select: SelectState): void => {\n const state = this._makeState(select);\n this.setState(state);\n };\n\n private readonly _onFocus = (): void => {\n this._setState(SelectState.Selected);\n if (this.props.onFocus) {\n this.props.onFocus();\n }\n };\n\n private readonly _onBlur = (): void => {\n this._setState(SelectState.NotSelected);\n if (this.props.onBlur) {\n this.props.onBlur();\n }\n };\n\n private readonly _onTouchEnd = (event: RN.GestureResponderEvent): void => {\n if (!this.props.disabled) {\n if (this.props.onPress) {\n this.props.onPress(event);\n }\n }\n if (this.props.onTouchEnd) {\n this.props.onTouchEnd(event);\n }\n };\n}\n"]}
1
+ {"version":3,"file":"ButtonWin32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AC,SAAS,OAAK,SAAS;YACzB,8BAAC,EAAE,CAAC,SAAS,OAAK,SAAS,IAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAgB,CACjD,CAChB,CAAC;IACJ,CAAC;CAwCF;AA3ED,kCA2EC","sourcesContent":["import React from 'react'\nimport RN = require('react-native');\nimport type { IViewWin32Props } from '../View/ViewPropTypes';\nimport type { ITextWin32Props } from '../Text/TextWin32.Props';\nimport type { IButtonWin32Props } from './ButtonWin32.Props';\n\nconst enum SelectState {\n NotSelected,\n Selected\n}\n\ninterface IButtonWin32State {\n accessibilityState: RN.AccessibilityState;\n}\n\n/**\n * React-native <Button> control with additional Win32-specific functionality.\n */\nexport class ButtonWin32 extends React.Component<IButtonWin32Props, IButtonWin32State> {\n constructor(props: IButtonWin32Props) {\n super(props);\n this.state = this._makeState(SelectState.NotSelected);\n }\n\n public render() {\n const viewProps: IViewWin32Props = {\n accessible: true,\n accessibilityLabel: this.props.accessibilityLabel || this.props.title,\n accessibilityRole: 'button',\n accessibilityState: this.state.accessibilityState,\n focusable: true,\n onFocus: this._onFocus,\n onBlur: this._onBlur,\n onMouseEnter: this.props.onMouseEnter,\n onMouseLeave: this.props.onMouseLeave,\n onTouchStart: this.props.onTouchStart,\n onTouchEnd: this._onTouchEnd,\n testID: this.props.testID,\n style: this.props.style as RN.StyleProp<RN.ViewStyle>,\n };\n\n const textProps: ITextWin32Props = {\n textStyle: 'None',\n };\n if (this.props.color) {\n textProps.style = { color: this.props.color };\n }\n\n return (\n <RN.ViewWin32 {...viewProps}>\n <RN.TextWin32 {...textProps}>{this.props.title}</RN.TextWin32>\n </RN.ViewWin32>\n );\n }\n\n private readonly _makeState = (select: SelectState): IButtonWin32State => {\n return {\n accessibilityState: {\n disabled: this.props.disabled,\n selected: select === SelectState.Selected,\n },\n };\n };\n\n private readonly _setState = (select: SelectState): void => {\n const state = this._makeState(select);\n this.setState(state);\n };\n\n private readonly _onFocus = (): void => {\n this._setState(SelectState.Selected);\n if (this.props.onFocus) {\n this.props.onFocus();\n }\n };\n\n private readonly _onBlur = (): void => {\n this._setState(SelectState.NotSelected);\n if (this.props.onBlur) {\n this.props.onBlur();\n }\n };\n\n private readonly _onTouchEnd = (event: RN.GestureResponderEvent): void => {\n if (!this.props.disabled) {\n if (this.props.onPress) {\n this.props.onPress(event);\n }\n }\n if (this.props.onTouchEnd) {\n this.props.onTouchEnd(event);\n }\n };\n}\n"]}
@@ -14,15 +14,15 @@ export interface ClipboardStatic {
14
14
 
15
15
  /**
16
16
  * Clipboard has been extracted from react-native core and will be removed in a future release.
17
- * It can now be installed and imported from `@react-native-community/clipboard` instead of 'react-native'.
18
- * @see https://github.com/react-native-community/clipboard
17
+ * It can now be installed and imported from `@react-native-clipboard/clipboard` instead of 'react-native'.
18
+ * @see https://github.com/react-native-clipboard/clipboard
19
19
  * @deprecated
20
20
  */
21
21
  export const Clipboard: ClipboardStatic;
22
22
  /**
23
23
  * Clipboard has been extracted from react-native core and will be removed in a future release.
24
- * It can now be installed and imported from `@react-native-community/clipboard` instead of 'react-native'.
25
- * @see https://github.com/react-native-community/clipboard
24
+ * It can now be installed and imported from `@react-native-clipboard/clipboard` instead of 'react-native'.
25
+ * @see https://github.com/react-native-clipboard/clipboard
26
26
  * @deprecated
27
27
  */
28
28
  export type Clipboard = ClipboardStatic;
@@ -181,7 +181,9 @@ class DrawerLayoutAndroid extends React.Component<Props, State> {
181
181
  ...props
182
182
  } = this.props;
183
183
  const drawStatusBar =
184
- Platform.Version >= 21 && this.props.statusBarBackgroundColor != null;
184
+ Platform.OS === 'android' &&
185
+ Platform.Version >= 21 &&
186
+ this.props.statusBarBackgroundColor != null;
185
187
  const drawerViewWrapper = (
186
188
  <View
187
189
  style={[
@@ -7,6 +7,6 @@ export interface IEnterStringProps {
7
7
  }
8
8
  export default class EnterString extends React.Component<IEnterStringProps, {}> {
9
9
  static DefaultProps: IEnterStringProps;
10
- render(): JSX.Element;
10
+ render(): React.JSX.Element;
11
11
  private _onChangedNative;
12
12
  }
@@ -65,6 +65,7 @@ class KeyboardAvoidingView extends React.Component<Props, State> {
65
65
  _subscriptions: Array<EventSubscription> = [];
66
66
  viewRef: {current: React.ElementRef<typeof View> | null, ...};
67
67
  _initialFrameHeight: number = 0;
68
+ _bottom: number = 0;
68
69
 
69
70
  constructor(props: Props) {
70
71
  super(props);
@@ -112,14 +113,15 @@ class KeyboardAvoidingView extends React.Component<Props, State> {
112
113
  };
113
114
 
114
115
  _onLayout = async (event: ViewLayoutEvent) => {
115
- const wasFrameNull = this._frame == null;
116
+ const oldFrame = this._frame;
116
117
  this._frame = event.nativeEvent.layout;
117
118
  if (!this._initialFrameHeight) {
118
119
  // save the initial frame height, before the keyboard is visible
119
120
  this._initialFrameHeight = this._frame.height;
120
121
  }
121
122
 
122
- if (wasFrameNull) {
123
+ // update bottom height for the first time or when the height is changed
124
+ if (!oldFrame || oldFrame.height !== this._frame.height) {
123
125
  await this._updateBottomIfNecessary();
124
126
  }
125
127
 
@@ -128,20 +130,32 @@ class KeyboardAvoidingView extends React.Component<Props, State> {
128
130
  }
129
131
  };
130
132
 
133
+ // Avoid unnecessary renders if the KeyboardAvoidingView is disabled.
134
+ _setBottom = (value: number) => {
135
+ const enabled = this.props.enabled ?? true;
136
+ this._bottom = value;
137
+ if (enabled) {
138
+ this.setState({bottom: value});
139
+ }
140
+ };
141
+
131
142
  _updateBottomIfNecessary = async () => {
132
143
  if (this._keyboardEvent == null) {
133
- this.setState({bottom: 0});
144
+ this._setBottom(0);
134
145
  return;
135
146
  }
136
147
 
137
148
  const {duration, easing, endCoordinates} = this._keyboardEvent;
138
149
  const height = await this._relativeKeyboardHeight(endCoordinates);
139
150
 
140
- if (this.state.bottom === height) {
151
+ if (this._bottom === height) {
141
152
  return;
142
153
  }
143
154
 
144
- if (duration && easing) {
155
+ this._setBottom(height);
156
+
157
+ const enabled = this.props.enabled ?? true;
158
+ if (enabled && duration && easing) {
145
159
  LayoutAnimation.configureNext({
146
160
  // We have to pass the duration equal to minimal accepted duration defined here: RCTLayoutAnimation.m
147
161
  duration: duration > 10 ? duration : 10,
@@ -151,9 +165,15 @@ class KeyboardAvoidingView extends React.Component<Props, State> {
151
165
  },
152
166
  });
153
167
  }
154
- this.setState({bottom: height});
155
168
  };
156
169
 
170
+ componentDidUpdate(_: Props, prevState: State): void {
171
+ const enabled = this.props.enabled ?? true;
172
+ if (enabled && this._bottom !== prevState.bottom) {
173
+ this.setState({bottom: this._bottom});
174
+ }
175
+ }
176
+
157
177
  componentDidMount(): void {
158
178
  if (Platform.OS === 'ios') {
159
179
  this._subscriptions = [
@@ -24,6 +24,7 @@ import type {
24
24
  import {PressabilityDebugView} from '../../Pressability/PressabilityDebug';
25
25
  import usePressability from '../../Pressability/usePressability';
26
26
  import {type RectOrSize} from '../../StyleSheet/Rect';
27
+ import useMergeRefs from '../../Utilities/useMergeRefs';
27
28
  import View from '../View/View';
28
29
  import useAndroidRippleForView, {
29
30
  type RippleConfig,
@@ -235,7 +236,7 @@ function Pressable(props: Props, forwardedRef): React.Node {
235
236
  } = props;
236
237
 
237
238
  const viewRef = useRef<React.ElementRef<typeof View> | null>(null);
238
- useImperativeHandle(forwardedRef, () => viewRef.current);
239
+ const mergedRef = useMergeRefs(forwardedRef, viewRef);
239
240
 
240
241
  const android_rippleConfig = useAndroidRippleForView(android_ripple, viewRef);
241
242
 
@@ -338,7 +339,7 @@ function Pressable(props: Props, forwardedRef): React.Node {
338
339
  <View
339
340
  {...restPropsWithDefaults}
340
341
  {...eventHandlers}
341
- ref={viewRef}
342
+ ref={mergedRef}
342
343
  style={typeof style === 'function' ? style({pressed}) : style}
343
344
  collapsable={false}>
344
345
  {typeof children === 'function' ? children({pressed}) : children}
@@ -28,6 +28,7 @@ import type {
28
28
  import {PressabilityDebugView} from '../../Pressability/PressabilityDebug';
29
29
  import usePressability from '../../Pressability/usePressability';
30
30
  import {type RectOrSize} from '../../StyleSheet/Rect';
31
+ import useMergeRefs from '../../Utilities/useMergeRefs';
31
32
  import useAndroidRippleForView, {
32
33
  type RippleConfig,
33
34
  } from './useAndroidRippleForView';
@@ -235,7 +236,7 @@ type Props = $ReadOnly<{|
235
236
  */
236
237
  unstable_pressDelay?: ?number,
237
238
  /**
238
- * Web to Native Accessibilty props
239
+ * Web to Native Accessibility props
239
240
  * https://github.com/facebook/react-native/issues/34424
240
241
  */
241
242
  'aria-label'?: ?string,
@@ -290,7 +291,7 @@ function Pressable(props: Props, forwardedRef): React.Node {
290
291
  } = props;
291
292
 
292
293
  const viewRef = useRef<React.ElementRef<typeof View> | null>(null);
293
- useImperativeHandle(forwardedRef, () => viewRef.current);
294
+ const mergedRef = useMergeRefs(forwardedRef, viewRef);
294
295
 
295
296
  const android_rippleConfig = useAndroidRippleForView(android_ripple, viewRef);
296
297
 
@@ -407,7 +408,7 @@ function Pressable(props: Props, forwardedRef): React.Node {
407
408
  <View
408
409
  {...restPropsWithDefaults}
409
410
  {...eventHandlers}
410
- ref={viewRef}
411
+ ref={mergedRef}
411
412
  style={typeof style === 'function' ? style({pressed}) : style}>
412
413
  {typeof children === 'function' ? children({pressed}) : children}
413
414
  {__DEV__ ? <PressabilityDebugView color="red" hitSlop={hitSlop} /> : null}
@@ -71,7 +71,7 @@ export default function useAndroidRippleForView(
71
71
 
72
72
  return {
73
73
  viewProps:
74
- foreground === true
74
+ foreground === true && Platform.Version >= 23
75
75
  ? {nativeForegroundAndroid: nativeRippleValue}
76
76
  : {nativeBackgroundAndroid: nativeRippleValue},
77
77
  onPressIn(event: PressEvent): void {