react-native-windows 0.69.5 → 0.70.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 (298) hide show
  1. package/.flowconfig +5 -1
  2. package/Chakra/ChakraHelpers.cpp +1 -1
  3. package/Chakra/ChakraPlatform.cpp +1 -1
  4. package/Chakra/ChakraValue.cpp +6 -3
  5. package/Chakra/ChakraValue.h +1 -1
  6. package/Directory.Build.props +7 -7
  7. package/Folly/Folly.vcxproj +20 -13
  8. package/Folly/cgmanifest.json +14 -0
  9. package/Libraries/Alert/Alert.js +18 -4
  10. package/Libraries/Alert/Alert.windows.js +4 -0
  11. package/Libraries/Alert/NativeAlertManager.js +1 -0
  12. package/Libraries/Animated/Animated.js +2 -2
  13. package/Libraries/Animated/AnimatedEvent.js +7 -4
  14. package/Libraries/Animated/AnimatedImplementation.js +17 -3
  15. package/Libraries/Animated/AnimatedMock.js +7 -2
  16. package/Libraries/Animated/NativeAnimatedHelper.js +220 -95
  17. package/Libraries/Animated/NativeAnimatedModule.js +3 -0
  18. package/Libraries/Animated/NativeAnimatedTurboModule.js +3 -0
  19. package/Libraries/Animated/animations/SpringAnimation.js +3 -3
  20. package/Libraries/Animated/animations/TimingAnimation.js +3 -3
  21. package/Libraries/Animated/createAnimatedComponent.js +8 -1
  22. package/Libraries/Animated/nodes/AnimatedAddition.js +3 -1
  23. package/Libraries/Animated/nodes/AnimatedColor.js +50 -29
  24. package/Libraries/Animated/nodes/AnimatedDiffClamp.js +3 -1
  25. package/Libraries/Animated/nodes/AnimatedDivision.js +3 -1
  26. package/Libraries/Animated/nodes/AnimatedInterpolation.js +22 -21
  27. package/Libraries/Animated/nodes/AnimatedModulo.js +3 -1
  28. package/Libraries/Animated/nodes/AnimatedMultiplication.js +3 -2
  29. package/Libraries/Animated/nodes/AnimatedProps.js +20 -12
  30. package/Libraries/Animated/nodes/AnimatedStyle.js +19 -16
  31. package/Libraries/Animated/nodes/AnimatedSubtraction.js +3 -1
  32. package/Libraries/Animated/nodes/AnimatedTransform.js +5 -5
  33. package/Libraries/Animated/nodes/AnimatedValue.js +14 -5
  34. package/Libraries/Animated/nodes/AnimatedValueXY.js +28 -1
  35. package/Libraries/Animated/useAnimatedProps.js +1 -0
  36. package/Libraries/AppState/AppState.js +0 -32
  37. package/Libraries/AppTheme/AppTheme.js +14 -8
  38. package/Libraries/AppTheme/AppThemeTypes.d.ts +0 -3
  39. package/Libraries/BatchedBridge/MessageQueue.js +21 -15
  40. package/Libraries/BatchedBridge/NativeModules.js +3 -4
  41. package/Libraries/Blob/FileReader.js +0 -6
  42. package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js +0 -20
  43. package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.windows.js +0 -20
  44. package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js +4 -0
  45. package/Libraries/Components/Keyboard/Keyboard.js +0 -11
  46. package/Libraries/Components/Pressable/Pressable.js +2 -0
  47. package/Libraries/Components/Pressable/Pressable.windows.js +2 -0
  48. package/Libraries/Components/SafeAreaView/RCTSafeAreaViewNativeComponent.js +1 -3
  49. package/Libraries/Components/SafeAreaView/SafeAreaView.js +3 -30
  50. package/Libraries/Components/SafeAreaView/SafeAreaView.windows.js +4 -30
  51. package/Libraries/Components/ScrollView/ScrollView.js +13 -11
  52. package/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +5 -3
  53. package/Libraries/Components/StatusBar/StatusBar.js +10 -7
  54. package/Libraries/Components/TextInput/InputAccessoryView.js +14 -13
  55. package/Libraries/Components/TextInput/TextInput.js +12 -2
  56. package/Libraries/Components/TextInput/TextInput.windows.js +12 -2
  57. package/Libraries/Components/Touchable/PooledClass.js +16 -4
  58. package/Libraries/Components/Touchable/Touchable.js +50 -1
  59. package/Libraries/Components/Touchable/Touchable.windows.js +972 -0
  60. package/Libraries/Components/Touchable/TouchableNativeFeedback.js +6 -2
  61. package/Libraries/Components/View/ReactNativeStyleAttributes.js +0 -7
  62. package/Libraries/Components/View/ViewPropTypes.js +3 -8
  63. package/Libraries/Components/View/ViewPropTypes.windows.js +3 -8
  64. package/Libraries/Core/ExceptionsManager.js +2 -0
  65. package/Libraries/Core/ReactNativeVersion.js +2 -2
  66. package/Libraries/Core/Timers/JSTimers.js +2 -2
  67. package/Libraries/Core/polyfillPromise.js +0 -32
  68. package/Libraries/Core/setUpBatchedBridge.js +5 -1
  69. package/Libraries/Core/setUpPerformance.js +1 -1
  70. package/Libraries/EventEmitter/NativeEventEmitter.js +0 -13
  71. package/Libraries/Image/AssetSourceResolver.js +2 -2
  72. package/Libraries/Image/Image.android.js +5 -3
  73. package/Libraries/Image/Image.ios.js +6 -3
  74. package/Libraries/Image/Image.windows.js +6 -3
  75. package/Libraries/Image/ImageSource.js +7 -5
  76. package/Libraries/Inspector/ElementBox.js +2 -2
  77. package/Libraries/Inspector/NetworkOverlay.js +13 -8
  78. package/Libraries/Interaction/PanResponder.js +16 -14
  79. package/Libraries/Linking/Linking.js +0 -11
  80. package/Libraries/Lists/FlatList.js +3 -2
  81. package/Libraries/Lists/SectionList.js +2 -0
  82. package/Libraries/Lists/ViewabilityHelper.js +7 -3
  83. package/Libraries/Lists/VirtualizeUtils.js +33 -20
  84. package/Libraries/Lists/VirtualizedList.js +93 -47
  85. package/Libraries/Lists/VirtualizedListContext.js +1 -0
  86. package/Libraries/Lists/VirtualizedSectionList.js +14 -9
  87. package/Libraries/Lists/__tests__/VirtualizeUtils-test.js +19 -18
  88. package/Libraries/Lists/__tests__/VirtualizedList-test.js +10 -6
  89. package/Libraries/LogBox/Data/LogBoxData.js +1 -1
  90. package/Libraries/LogBox/Data/parseLogBoxLog.js +1 -1
  91. package/Libraries/LogBox/LogBox.js +3 -1
  92. package/Libraries/LogBox/UI/AnsiHighlight.js +2 -0
  93. package/Libraries/LogBox/UI/LogBoxInspectorCodeFrame.js +3 -0
  94. package/Libraries/LogBox/UI/LogBoxInspectorSourceMapStatus.js +0 -3
  95. package/Libraries/LogBox/UI/LogBoxInspectorStackFrames.js +8 -3
  96. package/Libraries/NativeComponent/BaseViewConfig.android.js +9 -18
  97. package/Libraries/NativeComponent/BaseViewConfig.ios.js +26 -12
  98. package/Libraries/NativeComponent/BaseViewConfig.windows.js +26 -12
  99. package/Libraries/Network/XMLHttpRequest.js +9 -11
  100. package/Libraries/Performance/PureComponentDebug.js +1 -0
  101. package/Libraries/PermissionsAndroid/NativePermissionsAndroid.js +9 -1
  102. package/Libraries/PermissionsAndroid/PermissionsAndroid.js +16 -0
  103. package/Libraries/Pressability/Pressability.js +26 -16
  104. package/Libraries/Pressability/Pressability.windows.js +30 -17
  105. package/Libraries/Promise.js +0 -1
  106. package/Libraries/ReactNative/AppRegistry.js +16 -13
  107. package/Libraries/ReactNative/BridgelessUIManager.js +2 -0
  108. package/Libraries/ReactNative/PaperUIManager.js +9 -9
  109. package/Libraries/ReactNative/PaperUIManager.windows.js +7 -8
  110. package/Libraries/ReactNative/ReactNativeFeatureFlags.js +12 -0
  111. package/Libraries/ReactNative/ReactNativeRuntimeDiagnostics.js +68 -0
  112. package/Libraries/ReactNative/getNativeComponentAttributes.js +6 -7
  113. package/Libraries/ReactNative/renderApplication.js +1 -1
  114. package/Libraries/Renderer/implementations/ReactFabric-dev.js +4443 -3615
  115. package/Libraries/Renderer/implementations/ReactFabric-prod.js +1496 -1170
  116. package/Libraries/Renderer/implementations/ReactFabric-profiling.js +1694 -1356
  117. package/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js +4439 -3588
  118. package/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js +1583 -1249
  119. package/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.js +1719 -1372
  120. package/Libraries/Storage/AsyncStorage.js +7 -1
  121. package/Libraries/StyleSheet/PlatformColorValueTypes.ios.js +8 -0
  122. package/Libraries/StyleSheet/flattenStyle.js +1 -1
  123. package/Libraries/StyleSheet/processTransform.js +2 -0
  124. package/Libraries/StyleSheet/processTransform.windows.js +2 -0
  125. package/Libraries/StyleSheet/splitLayoutProps.js +2 -0
  126. package/Libraries/Text/Text.js +15 -7
  127. package/Libraries/Text/Text.windows.js +14 -7
  128. package/Libraries/Types/CoreEventTypes.js +137 -11
  129. package/Libraries/Types/CoreEventTypes.windows.js +147 -22
  130. package/Libraries/Utilities/Dimensions.js +0 -13
  131. package/Libraries/Utilities/HMRClient.js +3 -3
  132. package/Libraries/Utilities/Platform.ios.js +0 -7
  133. package/Libraries/Utilities/ReactNativeTestTools.js +3 -1
  134. package/Libraries/Utilities/codegenNativeCommands.js +11 -2
  135. package/Libraries/Utilities/deepFreezeAndThrowOnMutationInDev.js +2 -0
  136. package/Libraries/Utilities/stringifySafe.js +3 -1
  137. package/Libraries/Utilities/truncate.js +1 -1
  138. package/Libraries/Utilities/verifyComponentAttributeEquivalence.js +2 -2
  139. package/Libraries/Vibration/Vibration.js +1 -1
  140. package/Libraries/WebSocket/WebSocket.js +1 -0
  141. package/Libraries/vendor/emitter/EventEmitter.js +105 -12
  142. package/Libraries/vendor/emitter/__flowtests__/EventEmitter-flowtest.js +73 -117
  143. package/Microsoft.ReactNative/Base/CoreNativeModules.cpp +24 -12
  144. package/Microsoft.ReactNative/CoreApp.cpp +303 -0
  145. package/Microsoft.ReactNative/CoreAppPage.cpp +21 -0
  146. package/Microsoft.ReactNative/CoreAppPage.h +15 -0
  147. package/Microsoft.ReactNative/CoreAppPage.idl +12 -0
  148. package/Microsoft.ReactNative/CoreAppPage.xaml +14 -0
  149. package/Microsoft.ReactNative/Fabric/ActivityIndicatorComponentView.cpp +1 -2
  150. package/Microsoft.ReactNative/Fabric/ActivityIndicatorComponentView.h +1 -1
  151. package/Microsoft.ReactNative/Fabric/ComponentView.h +1 -1
  152. package/Microsoft.ReactNative/Fabric/ImageComponentView.cpp +1 -1
  153. package/Microsoft.ReactNative/Fabric/ImageComponentView.h +1 -1
  154. package/Microsoft.ReactNative/Fabric/ParagraphComponentView.cpp +1 -1
  155. package/Microsoft.ReactNative/Fabric/ParagraphComponentView.h +1 -1
  156. package/Microsoft.ReactNative/Fabric/ScrollViewComponentView.cpp +1 -1
  157. package/Microsoft.ReactNative/Fabric/ScrollViewComponentView.h +1 -1
  158. package/Microsoft.ReactNative/Fabric/SliderComponentView.cpp +1 -1
  159. package/Microsoft.ReactNative/Fabric/SliderComponentView.h +1 -1
  160. package/Microsoft.ReactNative/Fabric/SwitchComponentView.cpp +1 -1
  161. package/Microsoft.ReactNative/Fabric/SwitchComponentView.h +1 -1
  162. package/Microsoft.ReactNative/Fabric/TextComponentView.cpp +1 -1
  163. package/Microsoft.ReactNative/Fabric/TextComponentView.h +1 -1
  164. package/Microsoft.ReactNative/Fabric/TextInput/WindowsTextInputComponentView.cpp +1 -1
  165. package/Microsoft.ReactNative/Fabric/TextInput/WindowsTextInputComponentView.h +1 -1
  166. package/Microsoft.ReactNative/Fabric/ViewComponentView.cpp +1 -1
  167. package/Microsoft.ReactNative/Fabric/ViewComponentView.h +1 -1
  168. package/Microsoft.ReactNative/GlyphViewManager.cpp +1 -0
  169. package/Microsoft.ReactNative/IReactDispatcher.cpp +18 -0
  170. package/Microsoft.ReactNative/IReactDispatcher.h +18 -3
  171. package/Microsoft.ReactNative/IReactDispatcher.idl +15 -0
  172. package/Microsoft.ReactNative/IReactNotificationService.cpp +197 -70
  173. package/Microsoft.ReactNative/IReactNotificationService.h +11 -30
  174. package/Microsoft.ReactNative/IReactPropertyBag.cpp +9 -0
  175. package/Microsoft.ReactNative/IReactPropertyBag.h +3 -0
  176. package/Microsoft.ReactNative/IReactPropertyBag.idl +3 -0
  177. package/Microsoft.ReactNative/JsiApi.cpp +41 -1
  178. package/Microsoft.ReactNative/JsiApi.h +3 -0
  179. package/Microsoft.ReactNative/JsiApi.idl +19 -1
  180. package/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj +18 -2
  181. package/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj.filters +7 -7
  182. package/Microsoft.ReactNative/Modules/AccessibilityInfoModule.h +1 -1
  183. package/Microsoft.ReactNative/Modules/AlertModule.cpp +15 -12
  184. package/Microsoft.ReactNative/Modules/AlertModule.h +1 -1
  185. package/Microsoft.ReactNative/Modules/AppStateModule.cpp +45 -9
  186. package/Microsoft.ReactNative/Modules/AppStateModule.h +9 -3
  187. package/Microsoft.ReactNative/Modules/AppThemeModuleUwp.h +1 -1
  188. package/Microsoft.ReactNative/Modules/ClipboardModule.h +1 -1
  189. package/Microsoft.ReactNative/Modules/DevSettingsModule.h +1 -1
  190. package/Microsoft.ReactNative/Modules/DeviceInfoModule.h +1 -1
  191. package/Microsoft.ReactNative/Modules/I18nManagerModule.h +1 -1
  192. package/Microsoft.ReactNative/Modules/ImageViewManagerModule.cpp +1 -1
  193. package/Microsoft.ReactNative/Modules/ImageViewManagerModule.h +1 -1
  194. package/Microsoft.ReactNative/Modules/LinkingManagerModule.h +1 -1
  195. package/Microsoft.ReactNative/Modules/LogBoxModule.h +1 -1
  196. package/Microsoft.ReactNative/Modules/NativeUIManager.cpp +66 -39
  197. package/Microsoft.ReactNative/Modules/PaperUIManagerModule.cpp +41 -11
  198. package/Microsoft.ReactNative/Modules/PaperUIManagerModule.h +1 -1
  199. package/Microsoft.ReactNative/QuirkSettings.cpp +22 -0
  200. package/Microsoft.ReactNative/QuirkSettings.h +10 -0
  201. package/Microsoft.ReactNative/QuirkSettings.idl +7 -0
  202. package/Microsoft.ReactNative/ReactApplication.cpp +44 -0
  203. package/Microsoft.ReactNative/ReactApplication.h +40 -5
  204. package/Microsoft.ReactNative/ReactHost/JSCallInvokerScheduler.cpp +5 -2
  205. package/Microsoft.ReactNative/ReactHost/JSCallInvokerScheduler.h +1 -0
  206. package/Microsoft.ReactNative/ReactHost/ReactInstanceWin.cpp +23 -4
  207. package/Microsoft.ReactNative/ReactHost/ReactInstanceWin.h +1 -1
  208. package/Microsoft.ReactNative/ReactPointerEventArgs.cpp +12 -2
  209. package/Microsoft.ReactNative/Utils/BatchingEventEmitter.cpp +1 -0
  210. package/Microsoft.ReactNative/Utils/Helpers.cpp +1 -1
  211. package/Microsoft.ReactNative/Utils/Helpers.h +1 -1
  212. package/Microsoft.ReactNative/Utils/PropertyUtils.h +1 -1
  213. package/Microsoft.ReactNative/Utils/TransformableText.h +1 -1
  214. package/Microsoft.ReactNative/Utils/ValueUtils.cpp +0 -1
  215. package/Microsoft.ReactNative/Views/DynamicAutomationPeer.cpp +9 -7
  216. package/Microsoft.ReactNative/Views/DynamicAutomationProperties.cpp +3 -3
  217. package/Microsoft.ReactNative/Views/FlyoutViewManager.cpp +13 -1
  218. package/Microsoft.ReactNative/Views/FrameworkElementTransferProperties.cpp +1 -1
  219. package/Microsoft.ReactNative/Views/FrameworkElementViewManager.cpp +63 -13
  220. package/Microsoft.ReactNative/Views/Image/ImageViewManager.cpp +1 -1
  221. package/Microsoft.ReactNative/Views/Image/ReactImage.cpp +5 -6
  222. package/Microsoft.ReactNative/Views/Image/ReactImage.h +4 -4
  223. package/Microsoft.ReactNative/Views/Text/TextTransformParentVisitor.h +1 -1
  224. package/Microsoft.ReactNative/Views/TextInputViewManager.cpp +21 -2
  225. package/Microsoft.ReactNative/Views/TextViewManager.cpp +6 -3
  226. package/Microsoft.ReactNative/Views/TouchEventHandler.cpp +1 -1
  227. package/Microsoft.ReactNative/Views/ViewManagerBase.cpp +7 -1
  228. package/Microsoft.ReactNative/Views/ViewPanel.cpp +4 -0
  229. package/Microsoft.ReactNative/Views/ViewViewManager.cpp +8 -3
  230. package/Microsoft.ReactNative/Views/cppwinrt/DynamicAutomationPeer.idl +2 -0
  231. package/Microsoft.ReactNative/microsoft.reactnative.def +4 -1
  232. package/Microsoft.ReactNative.Cxx/AppModelHelpers.h +17 -0
  233. package/Microsoft.ReactNative.Cxx/CoreApp.h +60 -0
  234. package/Microsoft.ReactNative.Cxx/JSI/JsiAbiApi.cpp +65 -0
  235. package/Microsoft.ReactNative.Cxx/JSI/JsiAbiApi.h +13 -0
  236. package/Microsoft.ReactNative.Cxx/JSI/JsiValueHelpers.cpp +53 -0
  237. package/Microsoft.ReactNative.Cxx/JSI/JsiValueHelpers.h +32 -0
  238. package/Microsoft.ReactNative.Cxx/JSI/NodeApiJsiRuntime.cpp +14 -2
  239. package/Microsoft.ReactNative.Cxx/Microsoft.ReactNative.Cxx.vcxitems +3 -0
  240. package/Microsoft.ReactNative.Cxx/Microsoft.ReactNative.Cxx.vcxitems.filters +7 -0
  241. package/Microsoft.ReactNative.Managed/packages.lock.json +1 -24
  242. package/Mso/dispatchQueue/dispatchQueue.h +12 -4
  243. package/Mso/src/dispatchQueue/looperScheduler.cpp +36 -9
  244. package/Mso/src/dispatchQueue/queueService.cpp +2 -2
  245. package/Mso/src/dispatchQueue/queueService.h +2 -2
  246. package/Mso/src/memoryApi/memoryApi.cpp +3 -0
  247. package/PropertySheets/Generated/PackageVersion.g.props +3 -3
  248. package/PropertySheets/JSEngine.props +1 -1
  249. package/PropertySheets/Release.props +6 -0
  250. package/ReactCommon/ReactCommon.vcxproj +11 -21
  251. package/ReactCommon/ReactCommon.vcxproj.filters +64 -46
  252. package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/JSExecutor.h +145 -0
  253. package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/NativeToJsBridge.cpp +344 -0
  254. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/text/BaseTextProps.cpp +313 -0
  255. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/view/ViewProps.cpp +455 -0
  256. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/core/ConcreteComponentDescriptor.h +216 -0
  257. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/core/PropsMacros.h +91 -0
  258. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/graphics/RectangleEdges.h +100 -0
  259. package/ReactCommon/TEMP_UntilReactCommonUpdate/yoga/yoga/CompactValue.h +3 -1
  260. package/Scripts/Microsoft.ReactNative.nuspec +6 -0
  261. package/Scripts/Microsoft.ReactNative.targets +7 -0
  262. package/Shared/DevSettings.h +4 -0
  263. package/Shared/JSI/ChakraRuntime.cpp +11 -2
  264. package/Shared/JSI/ChakraRuntime.h +2 -0
  265. package/Shared/Modules/BlobModule.cpp +4 -4
  266. package/Shared/Modules/BlobModule.h +1 -1
  267. package/Shared/Modules/FileReaderModule.cpp +3 -2
  268. package/Shared/Modules/IBlobPersistor.h +1 -1
  269. package/Shared/Networking/IHttpResource.h +1 -0
  270. package/Shared/Networking/OriginPolicyHttpFilter.cpp +16 -10
  271. package/Shared/Networking/WinRTHttpResource.cpp +34 -2
  272. package/Shared/OInstance.cpp +14 -6
  273. package/Shared/Threading/BatchingQueueThread.cpp +23 -12
  274. package/Shared/Utils.cpp +2 -5
  275. package/codegen/NativeAlertManagerSpec.g.h +2 -0
  276. package/codegen/NativeAnimatedModuleSpec.g.h +6 -0
  277. package/codegen/NativeAnimatedTurboModuleSpec.g.h +6 -0
  278. package/codegen/react/components/rnwcore/Props.cpp +2 -2
  279. package/codegen/react/components/rnwcore/Props.h +1 -1
  280. package/fmt/cgmanifest.json +14 -0
  281. package/fmt/fmt.vcxproj +25 -11
  282. package/jest/assetFileTransformer.js +3 -2
  283. package/jest/setup.js +4 -0
  284. package/package.json +27 -28
  285. package/rntypes/index.d.ts +0 -1
  286. package/template/cs-app-WinAppSDK/proj/{NuGet.Config → NuGet_Config} +0 -0
  287. package/template/metro.devMode.config.js +49 -2
  288. package/template/shared-app/proj/{NuGet.Config → NuGet_Config} +0 -0
  289. package/template/shared-lib/proj/{NuGet.Config → NuGet_Config} +0 -0
  290. package/Libraries/vendor/emitter/EventSubscription.js +0 -19
  291. package/Libraries/vendor/emitter/_EmitterSubscription.js +0 -62
  292. package/Libraries/vendor/emitter/_EventEmitter.js +0 -184
  293. package/Libraries/vendor/emitter/_EventSubscription.js +0 -45
  294. package/Libraries/vendor/emitter/_EventSubscriptionVendor.js +0 -108
  295. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/nativemodule/core/ReactCommon/TurboModule.h +0 -87
  296. package/Scripts/copyRNLibraries.js +0 -99
  297. package/jest/preprocessor.js +0 -40
  298. package/jest/preprocessor_DO_NOT_USE.js +0 -122
@@ -8,14 +8,23 @@
8
8
  * @flow
9
9
  */
10
10
 
11
- import {dispatchCommand} from '../../Libraries/Renderer/shims/ReactNative';
11
+ let dispatchCommand;
12
+ if (global.RN$Bridgeless) {
13
+ // Note: this function has the same implementation in the legacy and new renderer.
14
+ // However, evaluating the old renderer comes with some side effects.
15
+ dispatchCommand =
16
+ require('../../Libraries/Renderer/shims/ReactFabric').dispatchCommand;
17
+ } else {
18
+ dispatchCommand =
19
+ require('../../Libraries/Renderer/shims/ReactNative').dispatchCommand;
20
+ }
12
21
 
13
22
  type Options<T = string> = $ReadOnly<{|
14
23
  supportedCommands: $ReadOnlyArray<T>,
15
24
  |}>;
16
25
 
17
26
  function codegenNativeCommands<T: interface {}>(options: Options<$Keys<T>>): T {
18
- const commandObj = {};
27
+ const commandObj: {[$Keys<T>]: (...$ReadOnlyArray<mixed>) => void} = {};
19
28
 
20
29
  options.supportedCommands.forEach(command => {
21
30
  commandObj[command] = (ref, ...args) => {
@@ -70,6 +70,8 @@ function deepFreezeAndThrowOnMutationInDev<T: {...} | Array<mixed>>(
70
70
  return object;
71
71
  }
72
72
 
73
+ /* $FlowFixMe[missing-local-annot] The type annotation(s) required by Flow's
74
+ * LTI update could not be added via codemod */
73
75
  function throwOnImmutableMutation(key: empty, value) {
74
76
  throw Error(
75
77
  'You attempted to set the key `' +
@@ -27,6 +27,8 @@ export function createStringifySafeWithLimits(limits: {|
27
27
  maxObjectKeysLimit = Number.POSITIVE_INFINITY,
28
28
  } = limits;
29
29
  const stack = [];
30
+ /* $FlowFixMe[missing-this-annot] The 'this' type annotation(s) required by
31
+ * Flow's LTI update could not be added via codemod */
30
32
  function replacer(key: string, value: mixed): mixed {
31
33
  while (stack.length && this !== stack[0]) {
32
34
  stack.shift();
@@ -65,7 +67,7 @@ export function createStringifySafeWithLimits(limits: {|
65
67
  retval = `{ ... object with ${keys.length} keys ... }`;
66
68
  } else if (keys.length > maxObjectKeysLimit) {
67
69
  // Return a sample of the keys.
68
- retval = {};
70
+ retval = ({}: {[string]: mixed});
69
71
  for (let k of keys.slice(0, maxObjectKeysLimit)) {
70
72
  retval[k] = value[k];
71
73
  }
@@ -29,7 +29,7 @@ const truncate = function (
29
29
  maxChars: number,
30
30
  options?: truncateOptions,
31
31
  ): ?string {
32
- options = Object.assign({}, defaultOptions, options);
32
+ options = {...defaultOptions, ...options};
33
33
  if (
34
34
  str &&
35
35
  str.length &&
@@ -63,7 +63,7 @@ export default function verifyComponentAttributeEquivalence(
63
63
  // Return the different key-value pairs of the right object, by iterating through the keys in the left object
64
64
  // Note it won't return a difference where a key is missing in the left but exists the right.
65
65
  function lefthandObjectDiff(leftObj: Object, rightObj: Object): Object {
66
- const differentKeys = {};
66
+ const differentKeys: {[string]: any | {...}} = {};
67
67
 
68
68
  function compare(leftItem: any, rightItem: any, key: string) {
69
69
  if (typeof leftItem !== typeof rightItem && leftItem != null) {
@@ -110,7 +110,7 @@ export function getConfigWithoutViewProps(
110
110
 
111
111
  return Object.keys(viewConfig[propName])
112
112
  .filter(prop => !PlatformBaseViewConfig[propName][prop])
113
- .reduce((obj, prop) => {
113
+ .reduce<{[string]: any}>((obj, prop) => {
114
114
  obj[prop] = viewConfig[propName][prop];
115
115
  return obj;
116
116
  }, {});
@@ -40,7 +40,7 @@ function vibrateByPattern(pattern: Array<number>, repeat: boolean = false) {
40
40
  }
41
41
 
42
42
  function vibrateScheduler(
43
- id,
43
+ id: number,
44
44
  pattern: Array<number>,
45
45
  repeat: boolean,
46
46
  nextIndex: number,
@@ -104,6 +104,7 @@ class WebSocket extends (EventTarget(...WEBSOCKET_EVENTS): any) {
104
104
  const {headers = {}, ...unrecognized} = options || {};
105
105
 
106
106
  // Preserve deprecated backwards compatibility for the 'origin' option
107
+ // $FlowFixMe[prop-missing]
107
108
  if (unrecognized && typeof unrecognized.origin === 'string') {
108
109
  console.warn(
109
110
  'Specifying `origin` as a WebSocket connection option is deprecated. Include it under `headers` instead.',
@@ -8,20 +8,63 @@
8
8
  * @format
9
9
  */
10
10
 
11
- 'use strict';
11
+ export interface EventSubscription {
12
+ remove(): void;
13
+ }
14
+
15
+ export interface IEventEmitter<TEventToArgsMap: {...}> {
16
+ addListener<TEvent: $Keys<TEventToArgsMap>>(
17
+ eventType: TEvent,
18
+ listener: (...args: $ElementType<TEventToArgsMap, TEvent>) => mixed,
19
+ context?: mixed,
20
+ ): EventSubscription;
12
21
 
13
- const EventEmitter = require('./_EventEmitter');
22
+ emit<TEvent: $Keys<TEventToArgsMap>>(
23
+ eventType: TEvent,
24
+ ...args: $ElementType<TEventToArgsMap, TEvent>
25
+ ): void;
14
26
 
15
- import type {EventSubscription} from './EventSubscription';
27
+ removeAllListeners<TEvent: $Keys<TEventToArgsMap>>(eventType?: ?TEvent): void;
28
+
29
+ listenerCount<TEvent: $Keys<TEventToArgsMap>>(eventType: TEvent): number;
30
+ }
16
31
 
17
- export default EventEmitter;
32
+ interface Registration<TArgs> {
33
+ +context: mixed;
34
+ +listener: (...args: TArgs) => mixed;
35
+ +remove: () => void;
36
+ }
18
37
 
19
- export type {EventSubscription};
38
+ type Registry<TEventToArgsMap: {...}> = $ObjMap<
39
+ TEventToArgsMap,
40
+ <TArgs>(TArgs) => Set<Registration<TArgs>>,
41
+ >;
20
42
 
21
43
  /**
22
- * Essential interface for an EventEmitter.
44
+ * EventEmitter manages listeners and publishes events to them.
45
+ *
46
+ * EventEmitter accepts a single type parameter that defines the valid events
47
+ * and associated listener argument(s).
48
+ *
49
+ * @example
50
+ *
51
+ * const emitter = new EventEmitter<{
52
+ * success: [number, string],
53
+ * error: [Error],
54
+ * }>();
55
+ *
56
+ * emitter.on('success', (statusCode, responseText) => {...});
57
+ * emitter.emit('success', 200, '...');
58
+ *
59
+ * emitter.on('error', error => {...});
60
+ * emitter.emit('error', new Error('Resource not found'));
61
+ *
23
62
  */
24
- export interface IEventEmitter<TEventToArgsMap: {...}> {
63
+ export default class EventEmitter<TEventToArgsMap: {...}>
64
+ implements IEventEmitter<TEventToArgsMap>
65
+ {
66
+ _registry: Registry<TEventToArgsMap> = {};
67
+
25
68
  /**
26
69
  * Registers a listener that is called when the supplied event is emitted.
27
70
  * Returns a subscription that has a `remove` method to undo registration.
@@ -29,25 +72,75 @@ export interface IEventEmitter<TEventToArgsMap: {...}> {
29
72
  addListener<TEvent: $Keys<TEventToArgsMap>>(
30
73
  eventType: TEvent,
31
74
  listener: (...args: $ElementType<TEventToArgsMap, TEvent>) => mixed,
32
- context?: mixed,
33
- ): EventSubscription;
75
+ context: mixed,
76
+ ): EventSubscription {
77
+ const registrations = allocate(this._registry, eventType);
78
+ const registration: Registration<$ElementType<TEventToArgsMap, TEvent>> = {
79
+ context,
80
+ listener,
81
+ remove(): void {
82
+ registrations.delete(registration);
83
+ },
84
+ };
85
+ registrations.add(registration);
86
+ return registration;
87
+ }
34
88
 
35
89
  /**
36
90
  * Emits the supplied event. Additional arguments supplied to `emit` will be
37
91
  * passed through to each of the registered listeners.
92
+ *
93
+ * If a listener modifies the listeners registered for the same event, those
94
+ * changes will not be reflected in the current invocation of `emit`.
38
95
  */
39
96
  emit<TEvent: $Keys<TEventToArgsMap>>(
40
97
  eventType: TEvent,
41
98
  ...args: $ElementType<TEventToArgsMap, TEvent>
42
- ): void;
99
+ ): void {
100
+ const registrations: ?Set<
101
+ Registration<$ElementType<TEventToArgsMap, TEvent>>,
102
+ > = this._registry[eventType];
103
+ if (registrations != null) {
104
+ for (const registration of [...registrations]) {
105
+ registration.listener.apply(registration.context, args);
106
+ }
107
+ }
108
+ }
43
109
 
44
110
  /**
45
111
  * Removes all registered listeners.
46
112
  */
47
- removeAllListeners<TEvent: $Keys<TEventToArgsMap>>(eventType?: ?TEvent): void;
113
+ removeAllListeners<TEvent: $Keys<TEventToArgsMap>>(
114
+ eventType?: ?TEvent,
115
+ ): void {
116
+ if (eventType == null) {
117
+ this._registry = {};
118
+ } else {
119
+ delete this._registry[eventType];
120
+ }
121
+ }
48
122
 
49
123
  /**
50
124
  * Returns the number of registered listeners for the supplied event.
51
125
  */
52
- listenerCount<TEvent: $Keys<TEventToArgsMap>>(eventType: TEvent): number;
126
+ listenerCount<TEvent: $Keys<TEventToArgsMap>>(eventType: TEvent): number {
127
+ const registrations: ?Set<Registration<mixed>> = this._registry[eventType];
128
+ return registrations == null ? 0 : registrations.size;
129
+ }
130
+ }
131
+
132
+ function allocate<
133
+ TEventToArgsMap: {...},
134
+ TEvent: $Keys<TEventToArgsMap>,
135
+ TEventArgs: $ElementType<TEventToArgsMap, TEvent>,
136
+ >(
137
+ registry: Registry<TEventToArgsMap>,
138
+ eventType: TEvent,
139
+ ): Set<Registration<TEventArgs>> {
140
+ let registrations: ?Set<Registration<TEventArgs>> = registry[eventType];
141
+ if (registrations == null) {
142
+ registrations = new Set();
143
+ registry[eventType] = registrations;
144
+ }
145
+ return registrations;
53
146
  }
@@ -1,5 +1,8 @@
1
1
  /**
2
- * (c) Meta Platforms, Inc. and affiliates. Confidential and proprietary.
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
3
6
  *
4
7
  * @flow strict
5
8
  * @format
@@ -7,119 +10,72 @@
7
10
 
8
11
  import EventEmitter from '../EventEmitter';
9
12
 
10
- type MyEvents = {
11
- noArgsEvent: [],
12
- stringEvent: [string],
13
- numberEvent: [number],
14
- anotherNumberEvent: [number],
15
- objectAndBooleanEvent: [{prop: string}, boolean],
16
- };
17
-
18
- export function testBaseEventEmitterInstance() {
19
- const emitter = new EventEmitter<MyEvents>();
20
-
21
- emitter.addListener('noArgsEvent', expectedUndefined => {
22
- (expectedUndefined: void);
23
- });
24
-
25
- emitter.addListener('stringEvent', expectedString => {
26
- (expectedString: string);
27
- });
28
-
29
- emitter.addListener('numberEvent', expectedNumber => {
30
- (expectedNumber: number);
31
- });
32
-
33
- emitter.addListener('anotherNumberEvent', expectedNumber => {
34
- (expectedNumber: number);
35
- });
36
-
37
- emitter.addListener(
38
- 'objectAndBooleanEvent',
39
- (expectedObject, expectedBoolean, unexpectedArg) => {
40
- (expectedObject: {prop: string});
41
- (expectedBoolean: boolean);
42
- (unexpectedArg: void);
43
- },
44
- );
45
-
46
- // $FlowExpectedError[prop-missing]
47
- emitter.addListener('unexpectedEvent', () => {});
48
-
49
- // $FlowExpectedError[incompatible-call]
50
- emitter.addListener('noArgsEvent', (value: number) => {});
51
-
52
- // $FlowExpectedError[incompatible-call]
53
- emitter.addListener('numberEvent', (value: string) => {});
54
-
55
- emitter.emit('noArgsEvent');
56
- emitter.emit('stringEvent', 'value');
57
- emitter.emit('numberEvent', 4);
58
- emitter.emit('anotherNumberEvent', 4);
59
- emitter.emit('objectAndBooleanEvent', {prop: 'value'}, true);
60
- }
61
-
62
- export function testSubclass() {
63
- // $FlowExpectedError[incompatible-type-arg]
64
- class EmitterWithUndefinedDefinition extends EventEmitter<void> {}
65
-
66
- // $FlowExpectedError[incompatible-type-arg]
67
- class EmitterWithNumberDefinition extends EventEmitter<number> {}
68
-
69
- class EmitterWithInvalidDefinitions extends EventEmitter<{
70
- foo: number,
71
- }> {}
72
-
73
- const emitter = new EmitterWithInvalidDefinitions();
74
- // $FlowExpectedError[not-an-array]
75
- // $FlowExpectedError[incompatible-call]
76
- emitter.emit('foo');
77
-
78
- class EmitterWithValidDefinitions extends EventEmitter<MyEvents> {}
79
- }
80
-
81
- export function testSubclassInstance() {
82
- class MyEmitter extends EventEmitter<MyEvents> {}
83
-
84
- const emitter = new MyEmitter();
85
-
86
- emitter.addListener('noArgsEvent', expectedUndefined => {
87
- (expectedUndefined: void);
88
- });
89
-
90
- emitter.addListener('stringEvent', expectedString => {
91
- (expectedString: string);
92
- });
93
-
94
- emitter.addListener('numberEvent', expectedNumber => {
95
- (expectedNumber: number);
96
- });
97
-
98
- emitter.addListener('anotherNumberEvent', expectedNumber => {
99
- (expectedNumber: number);
100
- });
101
-
102
- emitter.addListener(
103
- 'objectAndBooleanEvent',
104
- (expectedObject, expectedBoolean, unexpectedArg) => {
105
- (expectedObject: {prop: string});
106
- (expectedBoolean: boolean);
107
- (unexpectedArg: void);
108
- },
109
- );
110
-
111
- // $FlowExpectedError[prop-missing]
112
- emitter.addListener('unexpectedEvent', () => {});
113
-
114
- // $FlowExpectedError[incompatible-call]
115
- emitter.addListener('noArgsEvent', (value: number) => {});
116
-
117
- // $FlowExpectedError[incompatible-call]
118
- emitter.addListener('numberEvent', (value: string) => {});
119
-
120
- emitter.emit('noArgsEvent');
121
- emitter.emit('stringEvent', 'value');
122
- emitter.emit('numberEvent', 4);
123
- emitter.emit('anotherNumberEvent', 4);
124
- emitter.emit('objectAndBooleanEvent', {prop: 'value'}, true);
125
- }
13
+ const emitter = new EventEmitter<{
14
+ void: [],
15
+ string: [string],
16
+ strings: [string, string],
17
+ error: [Error],
18
+ }>();
19
+
20
+ const subscription = emitter.addListener('void', unknown => {
21
+ (unknown: void);
22
+ });
23
+ subscription.remove();
24
+
25
+ emitter.addListener('string', foo => {
26
+ (foo: string);
27
+ });
28
+ emitter.addListener('strings', (foo, bar) => {
29
+ (foo: string);
30
+ (bar: string);
31
+ });
32
+ emitter.addListener('error', error => {
33
+ (error: Error);
34
+ });
35
+
36
+ emitter.emit('void');
37
+ emitter.emit('string', 'foo');
38
+ emitter.emit('strings', 'foo', 'bar');
39
+ emitter.emit('error', new Error());
40
+
41
+ emitter.removeAllListeners('void');
42
+ emitter.removeAllListeners('string');
43
+ emitter.removeAllListeners('strings');
44
+ emitter.removeAllListeners('error');
45
+ emitter.removeAllListeners();
46
+
47
+ emitter.listenerCount('void');
48
+ emitter.listenerCount('string');
49
+ emitter.listenerCount('strings');
50
+ emitter.listenerCount('error');
51
+
52
+ // $FlowExpectedError[prop-missing]
53
+ emitter.addListener('does-not-exist', () => {
54
+ // ...
55
+ });
56
+
57
+ // $FlowExpectedError[prop-missing]
58
+ subscription.context;
59
+ // $FlowExpectedError[prop-missing]
60
+ subscription.listener;
61
+ // $FlowExpectedError[prop-missing]
62
+ subscription.once;
63
+
64
+ // $FlowExpectedError[invalid-tuple-arity]
65
+ emitter.emit('void', undefined);
66
+ // $FlowExpectedError[incompatible-call]
67
+ emitter.emit('string', 123);
68
+ // $FlowExpectedError[invalid-tuple-arity]
69
+ emitter.emit('strings', 'foo');
70
+ // $FlowExpectedError[invalid-tuple-arity]
71
+ emitter.emit('strings', 'foo', 'bar', 'baz');
72
+ // $FlowExpectedError[invalid-tuple-arity]
73
+ emitter.emit('error');
74
+ // $FlowExpectedError[prop-missing]
75
+ emitter.emit('does-not-exist');
76
+
77
+ // $FlowExpectedError[prop-missing]
78
+ emitter.removeAllListeners('does-not-exist');
79
+
80
+ // $FlowExpectedError[prop-missing]
81
+ emitter.listenerCount('does-not-exist');
@@ -5,6 +5,7 @@
5
5
  #include "CoreNativeModules.h"
6
6
 
7
7
  // Modules
8
+ #include <AppModelHelpers.h>
8
9
  #include <AsyncStorageModule.h>
9
10
  #include <Modules/Animated/NativeAnimatedModule.h>
10
11
  #include <Modules/AppearanceModule.h>
@@ -19,20 +20,17 @@
19
20
 
20
21
  namespace Microsoft::ReactNative {
21
22
 
23
+ using winrt::Microsoft::ReactNative::ReactPropertyBag;
24
+
22
25
  namespace {
23
26
 
24
- bool HasPackageIdentity() noexcept {
25
- static const bool hasPackageIdentity = []() noexcept {
26
- auto packageStatics = winrt::get_activation_factory<winrt::Windows::ApplicationModel::IPackageStatics>(
27
- winrt::name_of<winrt::Windows::ApplicationModel::Package>());
28
- auto abiPackageStatics = static_cast<winrt::impl::abi_t<winrt::Windows::ApplicationModel::IPackageStatics> *>(
29
- winrt::get_abi(packageStatics));
30
- winrt::com_ptr<winrt::impl::abi_t<winrt::Windows::ApplicationModel::IPackage>> dummy;
31
- return abiPackageStatics->get_Current(winrt::put_abi(dummy)) !=
32
- winrt::impl::hresult_from_win32(APPMODEL_ERROR_NO_PACKAGE);
33
- }();
34
-
35
- return hasPackageIdentity;
27
+ using winrt::Microsoft::ReactNative::ReactPropertyId;
28
+
29
+ ReactPropertyId<bool> HttpUseMonolithicModuleProperty() noexcept {
30
+ static ReactPropertyId<bool> propId{
31
+ L"ReactNative.Http"
32
+ L"UseMonolithicModule"};
33
+ return propId;
36
34
  }
37
35
 
38
36
  } // namespace
@@ -50,11 +48,25 @@ std::vector<facebook::react::NativeModuleDescription> GetCoreModules(
50
48
  [props = context->Properties()]() { return Microsoft::React::CreateHttpModule(props); },
51
49
  jsMessageQueue);
52
50
 
51
+ if (!ReactPropertyBag(context->Properties()).Get(HttpUseMonolithicModuleProperty())) {
52
+ modules.emplace_back(
53
+ Microsoft::React::GetBlobModuleName(),
54
+ [props = context->Properties()]() { return Microsoft::React::CreateBlobModule(props); },
55
+ batchingUIMessageQueue);
56
+
57
+ modules.emplace_back(
58
+ Microsoft::React::GetFileReaderModuleName(),
59
+ [props = context->Properties()]() { return Microsoft::React::CreateFileReaderModule(props); },
60
+ batchingUIMessageQueue);
61
+ }
62
+
53
63
  modules.emplace_back(
54
64
  "Timing",
55
65
  [batchingUIMessageQueue]() { return facebook::react::CreateTimingModule(batchingUIMessageQueue); },
56
66
  batchingUIMessageQueue);
57
67
 
68
+ // Note: `context` is moved to remove the reference from the current scope.
69
+ // This should either be the last usage of `context`, or the std::move call should happen later in this method.
58
70
  modules.emplace_back(
59
71
  NativeAnimatedModule::name,
60
72
  [context = std::move(context)]() mutable { return std::make_unique<NativeAnimatedModule>(std::move(context)); },