react-native-windows 0.69.4 → 0.70.0-preview.1

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 +12 -8
  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 +2 -2
  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
@@ -1,184 +0,0 @@
1
- /**
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.
6
- *
7
- * @format
8
- * @flow strict
9
- * @typecheck
10
- */
11
-
12
- const invariant = require('invariant');
13
-
14
- import EmitterSubscription from './_EmitterSubscription';
15
- import type {EventSubscription} from './EventSubscription';
16
- import EventSubscriptionVendor from './_EventSubscriptionVendor';
17
-
18
- const sparseFilterPredicate = () => true;
19
-
20
- /**
21
- * @class EventEmitter
22
- * @description
23
- * An EventEmitter is responsible for managing a set of listeners and publishing
24
- * events to them when it is told that such events happened. In addition to the
25
- * data for the given event it also sends a event control object which allows
26
- * the listeners/handlers to prevent the default behavior of the given event.
27
- *
28
- * The emitter is designed to be generic enough to support all the different
29
- * contexts in which one might want to emit events. It is a simple multicast
30
- * mechanism on top of which extra functionality can be composed. For example, a
31
- * more advanced emitter may use an EventHolder and EventFactory.
32
- */
33
- class EventEmitter<EventDefinitions: {...}> {
34
- _subscriber: EventSubscriptionVendor<EventDefinitions> =
35
- new EventSubscriptionVendor<EventDefinitions>();
36
-
37
- /**
38
- * @constructor
39
- */
40
- constructor(subscriber: ?EventSubscriptionVendor<EventDefinitions>) {
41
- if (subscriber != null) {
42
- console.warn('EventEmitter(...): Constructor argument is deprecated.');
43
- this._subscriber = subscriber;
44
- }
45
- }
46
-
47
- /**
48
- * Adds a listener to be invoked when events of the specified type are
49
- * emitted. An optional calling context may be provided. The data arguments
50
- * emitted will be passed to the listener function.
51
- *
52
- * @param {string} eventType - Name of the event to listen to
53
- * @param {function} listener - Function to invoke when the specified event is
54
- * emitted
55
- * @param {*} context - Optional context object to use when invoking the
56
- * listener
57
- */
58
- addListener<K: $Keys<EventDefinitions>>(
59
- eventType: K,
60
- // FIXME: listeners should return void instead of mixed to prevent issues
61
- listener: (...$ElementType<EventDefinitions, K>) => mixed,
62
- context: $FlowFixMe,
63
- ): EventSubscription {
64
- return (this._subscriber.addSubscription(
65
- eventType,
66
- new EmitterSubscription(this, this._subscriber, listener, context),
67
- ): $FlowFixMe);
68
- }
69
-
70
- /**
71
- * Removes all of the registered listeners, including those registered as
72
- * listener maps.
73
- *
74
- * @param {?string} eventType - Optional name of the event whose registered
75
- * listeners to remove
76
- */
77
- removeAllListeners<K: $Keys<EventDefinitions>>(eventType: ?K): void {
78
- this._subscriber.removeAllSubscriptions(eventType);
79
- }
80
-
81
- /**
82
- * @deprecated Use `remove` on the EventSubscription from `addListener`.
83
- */
84
- removeSubscription<K: $Keys<EventDefinitions>>(
85
- subscription: EmitterSubscription<EventDefinitions, K>,
86
- ): void {
87
- console.warn(
88
- 'EventEmitter.removeSubscription(...): Method has been deprecated. ' +
89
- 'Please instead use `remove()` on the subscription itself.',
90
- );
91
- this.__removeSubscription(subscription);
92
- }
93
-
94
- /**
95
- * Called by `EmitterSubscription` to bypass the above deprecation warning.
96
- */
97
- __removeSubscription<K: $Keys<EventDefinitions>>(
98
- subscription: EmitterSubscription<EventDefinitions, K>,
99
- ): void {
100
- invariant(
101
- subscription.emitter === this,
102
- 'Subscription does not belong to this emitter.',
103
- );
104
- this._subscriber.removeSubscription(subscription);
105
- }
106
-
107
- /**
108
- * Returns the number of listeners that are currently registered for the given
109
- * event.
110
- *
111
- * @param {string} eventType - Name of the event to query
112
- * @returns {number}
113
- */
114
- listenerCount<K: $Keys<EventDefinitions>>(eventType: K): number {
115
- const subscriptions = this._subscriber.getSubscriptionsForType(eventType);
116
- return subscriptions
117
- ? // We filter out missing entries because the array is sparse.
118
- // "callbackfn is called only for elements of the array which actually
119
- // exist; it is not called for missing elements of the array."
120
- // https://www.ecma-international.org/ecma-262/9.0/index.html#sec-array.prototype.filter
121
- subscriptions.filter(sparseFilterPredicate).length
122
- : 0;
123
- }
124
-
125
- /**
126
- * Emits an event of the given type with the given data. All handlers of that
127
- * particular type will be notified.
128
- *
129
- * @param {string} eventType - Name of the event to emit
130
- * @param {...*} Arbitrary arguments to be passed to each registered listener
131
- *
132
- * @example
133
- * emitter.addListener('someEvent', function(message) {
134
- * console.log(message);
135
- * });
136
- *
137
- * emitter.emit('someEvent', 'abc'); // logs 'abc'
138
- */
139
- emit<K: $Keys<EventDefinitions>>(
140
- eventType: K,
141
- ...args: $ElementType<EventDefinitions, K>
142
- ): void {
143
- const subscriptions = this._subscriber.getSubscriptionsForType(eventType);
144
- if (subscriptions) {
145
- for (let i = 0, l = subscriptions.length; i < l; i++) {
146
- const subscription = subscriptions[i];
147
-
148
- // The subscription may have been removed during this event loop.
149
- if (subscription && subscription.listener) {
150
- subscription.listener.apply(subscription.context, args);
151
- }
152
- }
153
- }
154
- }
155
-
156
- /**
157
- * @deprecated Use `remove` on the EventSubscription from `addListener`.
158
- */
159
- removeListener<K: $Keys<EventDefinitions>>(
160
- eventType: K,
161
- // FIXME: listeners should return void instead of mixed to prevent issues
162
- listener: (...$ElementType<EventDefinitions, K>) => mixed,
163
- ): void {
164
- console.warn(
165
- `EventEmitter.removeListener('${eventType}', ...): Method has been ` +
166
- 'deprecated. Please instead use `remove()` on the subscription ' +
167
- 'returned by `EventEmitter.addListener`.',
168
- );
169
- const subscriptions = this._subscriber.getSubscriptionsForType(eventType);
170
- if (subscriptions) {
171
- for (let i = 0, l = subscriptions.length; i < l; i++) {
172
- const subscription = subscriptions[i];
173
-
174
- // The subscription may have been removed during this event loop.
175
- // its listener matches the listener in method parameters
176
- if (subscription && subscription.listener === listener) {
177
- subscription.remove();
178
- }
179
- }
180
- }
181
- }
182
- }
183
-
184
- module.exports = EventEmitter;
@@ -1,45 +0,0 @@
1
- /**
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.
6
- *
7
- * @format
8
- * @flow strict
9
- */
10
-
11
- 'use strict';
12
-
13
- import type {EventSubscription} from './EventSubscription';
14
- import type EventSubscriptionVendor from './_EventSubscriptionVendor';
15
-
16
- /**
17
- * EventSubscription represents a subscription to a particular event. It can
18
- * remove its own subscription.
19
- */
20
- class _EventSubscription<EventDefinitions: {...}, K: $Keys<EventDefinitions>>
21
- implements EventSubscription
22
- {
23
- eventType: K;
24
- key: number;
25
- subscriber: EventSubscriptionVendor<EventDefinitions>;
26
- listener: ?(...$ElementType<EventDefinitions, K>) => mixed;
27
- context: ?$FlowFixMe;
28
-
29
- /**
30
- * @param {EventSubscriptionVendor} subscriber the subscriber that controls
31
- * this subscription.
32
- */
33
- constructor(subscriber: EventSubscriptionVendor<EventDefinitions>) {
34
- this.subscriber = subscriber;
35
- }
36
-
37
- /**
38
- * Removes this subscription from the subscriber that controls it.
39
- */
40
- remove(): void {
41
- this.subscriber.removeSubscription(this);
42
- }
43
- }
44
-
45
- module.exports = _EventSubscription;
@@ -1,108 +0,0 @@
1
- /**
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.
6
- *
7
- * @format
8
- * @flow strict
9
- */
10
-
11
- 'use strict';
12
-
13
- const invariant = require('invariant');
14
-
15
- import type EventSubscription from './_EventSubscription';
16
-
17
- /**
18
- * EventSubscriptionVendor stores a set of EventSubscriptions that are
19
- * subscribed to a particular event type.
20
- */
21
- class EventSubscriptionVendor<EventDefinitions: {...}> {
22
- _subscriptionsForType: {
23
- [type: $Keys<EventDefinitions>]: Array<
24
- EventSubscription<EventDefinitions, $FlowFixMe>,
25
- >,
26
- ...
27
- };
28
-
29
- constructor() {
30
- this._subscriptionsForType = {};
31
- }
32
-
33
- /**
34
- * Adds a subscription keyed by an event type.
35
- *
36
- * @param {string} eventType
37
- * @param {EventSubscription} subscription
38
- */
39
- addSubscription<K: $Keys<EventDefinitions>>(
40
- eventType: K,
41
- subscription: EventSubscription<EventDefinitions, K>,
42
- ): EventSubscription<EventDefinitions, K> {
43
- invariant(
44
- subscription.subscriber === this,
45
- 'The subscriber of the subscription is incorrectly set.',
46
- );
47
- if (!this._subscriptionsForType[eventType]) {
48
- this._subscriptionsForType[eventType] = [];
49
- }
50
- const key = this._subscriptionsForType[eventType].length;
51
- this._subscriptionsForType[eventType].push(subscription);
52
- subscription.eventType = eventType;
53
- subscription.key = key;
54
- return subscription;
55
- }
56
-
57
- /**
58
- * Removes a bulk set of the subscriptions.
59
- *
60
- * @param {?string} eventType - Optional name of the event type whose
61
- * registered subscriptions to remove, if null remove all subscriptions.
62
- */
63
- removeAllSubscriptions<K: $Keys<EventDefinitions>>(eventType: ?K): void {
64
- if (eventType == null) {
65
- this._subscriptionsForType = {};
66
- } else {
67
- delete this._subscriptionsForType[eventType];
68
- }
69
- }
70
-
71
- /**
72
- * Removes a specific subscription. Instead of calling this function, call
73
- * `subscription.remove()` directly.
74
- *
75
- * @param {object} subscription
76
- */
77
- removeSubscription<K: $Keys<EventDefinitions>>(
78
- subscription: EventSubscription<EventDefinitions, K>,
79
- ): void {
80
- const eventType = subscription.eventType;
81
- const key = subscription.key;
82
-
83
- const subscriptionsForType = this._subscriptionsForType[eventType];
84
- if (subscriptionsForType) {
85
- delete subscriptionsForType[key];
86
- }
87
- }
88
-
89
- /**
90
- * Returns the array of subscriptions that are currently registered for the
91
- * given event type.
92
- *
93
- * Note: This array can be potentially sparse as subscriptions are deleted
94
- * from it when they are removed.
95
- *
96
- * TODO: This returns a nullable array. wat?
97
- *
98
- * @param {string} eventType
99
- * @returns {?array}
100
- */
101
- getSubscriptionsForType<K: $Keys<EventDefinitions>>(
102
- eventType: K,
103
- ): ?Array<EventSubscription<EventDefinitions, K>> {
104
- return this._subscriptionsForType[eventType];
105
- }
106
- }
107
-
108
- module.exports = EventSubscriptionVendor;
@@ -1,87 +0,0 @@
1
- /*
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.
6
- */
7
-
8
- #pragma once
9
-
10
- #include <string>
11
- #include <unordered_map>
12
-
13
- #include <jsi/jsi.h>
14
-
15
- #include <ReactCommon/CallInvoker.h>
16
-
17
- namespace facebook {
18
- namespace react {
19
-
20
- /**
21
- * For now, support the same set of return types as existing impl.
22
- * This can be improved to support richer typed objects.
23
- */
24
- enum TurboModuleMethodValueKind {
25
- VoidKind,
26
- BooleanKind,
27
- NumberKind,
28
- StringKind,
29
- ObjectKind,
30
- ArrayKind,
31
- FunctionKind,
32
- PromiseKind,
33
- };
34
-
35
- /**
36
- * Base HostObject class for every module to be exposed to JS
37
- */
38
- class JSI_EXPORT TurboModule : public facebook::jsi::HostObject {
39
- public:
40
- TurboModule(const std::string &name, std::shared_ptr<CallInvoker> jsInvoker);
41
-
42
- virtual facebook::jsi::Value get(
43
- facebook::jsi::Runtime &runtime,
44
- const facebook::jsi::PropNameID &propName) override {
45
- std::string propNameUtf8 = propName.utf8(runtime);
46
- auto p = methodMap_.find(propNameUtf8);
47
- if (p == methodMap_.end()) {
48
- // Method was not found, let JS decide what to do.
49
- return jsi::Value::undefined();
50
- }
51
- MethodMetadata meta = p->second;
52
- return jsi::Function::createFromHostFunction(
53
- runtime,
54
- propName,
55
- static_cast<unsigned int>(meta.argCount),
56
- [this, meta](
57
- facebook::jsi::Runtime &rt,
58
- const facebook::jsi::Value &,
59
- const facebook::jsi::Value *args,
60
- size_t count) { return meta.invoker(rt, *this, args, count); });
61
- }
62
-
63
- const std::string name_;
64
- std::shared_ptr<CallInvoker> jsInvoker_;
65
-
66
- protected:
67
- struct MethodMetadata {
68
- size_t argCount;
69
- facebook::jsi::Value (*invoker)(
70
- facebook::jsi::Runtime &rt,
71
- TurboModule &turboModule,
72
- const facebook::jsi::Value *args,
73
- size_t count);
74
- };
75
-
76
- std::unordered_map<std::string, MethodMetadata> methodMap_;
77
- };
78
-
79
- /**
80
- * An app/platform-specific provider function to get an instance of a module
81
- * given a name.
82
- */
83
- using TurboModuleProviderFunctionType =
84
- std::function<std::shared_ptr<TurboModule>(const std::string &name)>;
85
-
86
- } // namespace react
87
- } // namespace facebook
@@ -1,99 +0,0 @@
1
- /**
2
- * Copyright (c) Microsoft Corporation.
3
- * Licensed under the MIT License.
4
- * @format
5
- * @ts-check
6
- */
7
-
8
- const glob = require('glob');
9
- const path = require('path');
10
- const {cleanTask, copyTask, series} = require('just-scripts');
11
-
12
- const rnDir = path.dirname(require.resolve('react-native/package.json'));
13
- const rnCopiesDir = path.join(
14
- path.dirname(require.resolve('react-native-windows/package.json')),
15
- 'ReactCopies',
16
- );
17
- const rnTypesDir = path.dirname(
18
- require.resolve('@types/react-native/package.json'),
19
- );
20
-
21
- exports.copyTask = baseDir => {
22
- const reactNative = (...files) => files.map(f => path.join(rnDir, f));
23
- const reactNativeTypes = (...files) =>
24
- files.map(f => path.join(rnTypesDir, f));
25
- const reactCopies = (...files) => files.map(f => path.join(rnCopiesDir, f));
26
- const src = (...files) => files.map(f => path.join(baseDir, 'src', f));
27
- const base = file => path.join(baseDir, file);
28
-
29
- return series(
30
- exports.cleanTask(baseDir),
31
-
32
- // For the TS compiler to be able to reference the files and create
33
- // correct output the imported .d.ts files must be within our src dir
34
- copyTask({
35
- paths: reactNativeTypes('*.d.ts'),
36
- dest: base('src/rntypes'),
37
- }),
38
- copyTask({
39
- paths: reactNative('flow/**'),
40
- dest: base('flow'),
41
- }),
42
- copyTask({
43
- paths: reactNative('flow-typed/**'),
44
- dest: base('flow-typed'),
45
- }),
46
- copyTask({
47
- paths: reactNative('jest/**'),
48
- dest: base('jest'),
49
- }),
50
- copyTask({
51
- paths: reactCopies('IntegrationTests/**'),
52
- dest: base('IntegrationTests'),
53
- }),
54
- copyTask({
55
- paths: reactNative('Libraries/**/*.+(js|jsx|png|gif|jpg|html)'),
56
- dest: base('Libraries'),
57
- }),
58
-
59
- copyTask({
60
- paths: reactNative('index.js', 'interface.js', 'rn-get-polyfills.js'),
61
- dest: base('.'),
62
- }),
63
-
64
- copyTask({paths: src('**/*+(.d.ts|.js|.png)'), dest: base('.')}),
65
- );
66
- };
67
-
68
- exports.cleanTask = baseDir => {
69
- const base = file => path.join(baseDir, file);
70
-
71
- return cleanTask({
72
- paths: [
73
- base('flow'),
74
- base('jest'),
75
-
76
- // IntegrationTests overlaps with the desktop test runner, so we need to
77
- // be careful about what is removed until that is fixed.
78
- ...glob.sync('IntegrationTests/**/*.+(js|command|png)', {
79
- cwd: baseDir,
80
- absolute: true,
81
- }),
82
-
83
- base('Libraries'),
84
- base('index.js'),
85
- base('interface.js'),
86
- base('rn-get-polyfills.js'),
87
- base('src/rntypes'),
88
-
89
- // Remove TS compiled gunk in our root
90
- ...glob.sync(
91
- '+(index|typings-index)*(.windows|.win32)*(.d)+(.js|.ts)*(.map)',
92
- {
93
- cwd: baseDir,
94
- absolute: true,
95
- },
96
- ),
97
- ],
98
- });
99
- };
@@ -1,40 +0,0 @@
1
- /**
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.
6
- *
7
- * @format
8
- * @flow
9
- */
10
-
11
- /* eslint-env node */
12
-
13
- 'use strict';
14
-
15
- // NOTE: Avoiding using a package like 'chalk' here, for simplicity
16
- const YELLOW = process.stderr.isTTY ? '\u001b[33m' : '';
17
- const BOLD = process.stderr.isTTY ? '\u001b[1m' : '';
18
- const RESET = process.stderr.isTTY ? '\u001b[0m' : '';
19
- const UNDERLINE = process.stderr.isTTY ? '\u001b[4m' : '';
20
-
21
- console.warn(
22
- '\n' +
23
- YELLOW +
24
- BOLD +
25
- 'react-native/jest/preprocessor.js' +
26
- RESET +
27
- YELLOW +
28
- ' is deprecated and will be removed.\n' +
29
- 'Use "preset": "react-native" in your Jest config instead.\n' +
30
- 'See ' +
31
- UNDERLINE +
32
- 'https://jestjs.io/docs/tutorial-react-native' +
33
- RESET +
34
- YELLOW +
35
- ' for more setup instructions.' +
36
- RESET +
37
- '\n',
38
- );
39
-
40
- module.exports = require('./preprocessor_DO_NOT_USE');
@@ -1,122 +0,0 @@
1
- /**
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.
6
- *
7
- * @format
8
- * @flow
9
- */
10
-
11
- /* eslint-env node */
12
-
13
- 'use strict';
14
-
15
- const babelRegisterOnly = require('metro-babel-register');
16
- const createCacheKeyFunction =
17
- require('@jest/create-cache-key-function').default;
18
-
19
- const {transformSync: babelTransformSync} = require('@babel/core');
20
- const generate = require('@babel/generator').default;
21
-
22
- const nodeFiles = new RegExp(
23
- [
24
- '/metro(?:-[^/]*)?/', // metro, metro-core, metro-source-map, metro-etc.
25
- ].join('|'),
26
- );
27
- const nodeOptions = babelRegisterOnly.config([nodeFiles]);
28
-
29
- babelRegisterOnly([]);
30
-
31
- const transformer = require('metro-react-native-babel-transformer');
32
- module.exports = {
33
- process(src /*: string */, file /*: string */) /*: {code: string, ...} */ {
34
- if (nodeFiles.test(file)) {
35
- // node specific transforms only
36
- return babelTransformSync(src, {
37
- filename: file,
38
- sourceType: 'script',
39
- ...nodeOptions,
40
- ast: false,
41
- });
42
- }
43
-
44
- const {ast} = transformer.transform({
45
- filename: file,
46
- options: {
47
- ast: true, // needed for open source (?) https://github.com/facebook/react-native/commit/f8d6b97140cffe8d18b2558f94570c8d1b410d5c#r28647044
48
- dev: true,
49
- enableBabelRuntime: false,
50
- experimentalImportSupport: false,
51
- globalPrefix: '',
52
- hot: false,
53
- inlineRequires: true,
54
- minify: false,
55
- platform: '',
56
- projectRoot: '',
57
- publicPath: '/assets',
58
- retainLines: true,
59
- sourceType: 'unambiguous', // b7 required. detects module vs script mode
60
- },
61
- src,
62
- plugins: [
63
- [require('@babel/plugin-transform-block-scoping')],
64
- // the flow strip types plugin must go BEFORE class properties!
65
- // there'll be a test case that fails if you don't.
66
- [require('@babel/plugin-transform-flow-strip-types')],
67
- [
68
- require('@babel/plugin-proposal-class-properties'),
69
- // use `this.foo = bar` instead of `this.defineProperty('foo', ...)`
70
- {loose: true},
71
- ],
72
- [require('@babel/plugin-transform-computed-properties')],
73
- [require('@babel/plugin-transform-destructuring')],
74
- [require('@babel/plugin-transform-function-name')],
75
- [require('@babel/plugin-transform-literals')],
76
- [require('@babel/plugin-transform-parameters')],
77
- [require('@babel/plugin-transform-shorthand-properties')],
78
- [require('@babel/plugin-transform-react-jsx')],
79
- [require('@babel/plugin-transform-regenerator')],
80
- [require('@babel/plugin-transform-sticky-regex')],
81
- [require('@babel/plugin-transform-unicode-regex')],
82
- [
83
- require('@babel/plugin-transform-modules-commonjs'),
84
- {strict: false, allowTopLevelThis: true},
85
- ],
86
- [require('@babel/plugin-transform-classes')],
87
- [require('@babel/plugin-transform-arrow-functions')],
88
- [require('@babel/plugin-transform-spread')],
89
- [require('@babel/plugin-proposal-object-rest-spread')],
90
- [
91
- require('@babel/plugin-transform-template-literals'),
92
- {loose: true}, // dont 'a'.concat('b'), just use 'a'+'b'
93
- ],
94
- [require('@babel/plugin-transform-exponentiation-operator')],
95
- [require('@babel/plugin-transform-for-of'), {loose: true}],
96
- [require('@babel/plugin-transform-react-display-name')],
97
- [require('@babel/plugin-transform-react-jsx-source')],
98
- ],
99
- });
100
-
101
- return generate(
102
- ast,
103
- // $FlowFixMe[prop-missing] Error found when improving flow typing for libs
104
- {
105
- code: true,
106
- comments: false,
107
- compact: false,
108
- filename: file,
109
- retainLines: true,
110
- sourceFileName: file,
111
- sourceMaps: true,
112
- },
113
- src,
114
- );
115
- },
116
-
117
- getCacheKey: (createCacheKeyFunction([
118
- __filename,
119
- require.resolve('metro-react-native-babel-transformer'),
120
- require.resolve('@babel/core/package.json'),
121
- ]) /*: any */),
122
- };