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
@@ -4,9 +4,12 @@
4
4
  #include "pch.h"
5
5
  #include "Threading/BatchingQueueThread.h"
6
6
  #include <cxxreact/Instance.h>
7
+ #include <cxxreact/SystraceSection.h>
7
8
  #include <eventWaitHandle/eventWaitHandle.h>
8
9
  #include <cassert>
9
10
 
11
+ using namespace facebook::react;
12
+
10
13
  namespace Microsoft::ReactNative {
11
14
 
12
15
  BatchingQueueCallInvoker::BatchingQueueCallInvoker(
@@ -36,7 +39,9 @@ void BatchingQueueCallInvoker::EnsureQueue() noexcept {
36
39
  void BatchingQueueCallInvoker::PostBatch() noexcept {
37
40
  if (m_taskQueue) {
38
41
  m_queueThread->runOnQueue([taskQueue{std::move(m_taskQueue)}]() noexcept {
42
+ SystraceSection s1("BatchingQueueCallInvoker::PostBatch");
39
43
  for (auto &task : *taskQueue) {
44
+ SystraceSection s2("BatchingQueueCallInvoker::PostBatch::Task");
40
45
  task();
41
46
  task = nullptr;
42
47
  }
@@ -69,19 +74,25 @@ BatchingQueueThread::BatchingQueueThread(
69
74
  void BatchingQueueThread::decoratedNativeCallInvokerReady(
70
75
  std::weak_ptr<facebook::react::Instance> wkInstance) noexcept {
71
76
  std::scoped_lock lck(m_mutex);
72
- m_callInvoker->invokeAsync([wkInstance, this] {
73
- if (auto instance = wkInstance.lock()) {
74
- std::scoped_lock lckQuitting(m_mutexQuitting);
75
-
76
- // If we are shutting down, then then the mutex is being held in quitSynchronous
77
- // Which is waiting for this task to complete, so we cannot take the mutex if quitSynchronous
78
- // is running. -- and since we are shutting down anyway, we can just skip this work.
79
- if (!m_quitting) {
80
- std::scoped_lock lck(m_mutex);
81
- m_callInvoker = instance->getDecoratedNativeCallInvoker(m_callInvoker);
77
+ if (auto instance = wkInstance.lock()) {
78
+ // When items were queued in the undecoratedNativeCallInvoker it will not have called
79
+ // recordTurboModuleAsyncMethodCall. Calling invokeAsync on the decoratedNativeCallInvoker
80
+ // ensures that the queue is properly flushed, on the next batch complete
81
+ auto decoratedCallInvoker = instance->getDecoratedNativeCallInvoker(m_callInvoker);
82
+ decoratedCallInvoker->invokeAsync([decoratedCallInvoker, wkInstance, this] {
83
+ if (auto instance = wkInstance.lock()) {
84
+ std::scoped_lock lckQuitting(m_mutexQuitting);
85
+
86
+ // If we are shutting down, then then the mutex is being held in quitSynchronous
87
+ // Which is waiting for this task to complete, so we cannot take the mutex if quitSynchronous
88
+ // is running. -- and since we are shutting down anyway, we can just skip this work.
89
+ if (!m_quitting) {
90
+ std::scoped_lock lck(m_mutex);
91
+ m_callInvoker = decoratedCallInvoker;
92
+ }
82
93
  }
83
- }
84
- });
94
+ });
95
+ }
85
96
  }
86
97
 
87
98
  BatchingQueueThread::~BatchingQueueThread() noexcept {}
package/Shared/Utils.cpp CHANGED
@@ -4,10 +4,10 @@
4
4
  #include "Utils.h"
5
5
  #include <regex>
6
6
 
7
+ #include <AppModelHelpers.h>
7
8
  #include <DesktopWindowBridge.h>
8
9
  #include <ShlObj.h>
9
10
  #include <Shlwapi.h>
10
- #include <appmodel.h>
11
11
  #include <winrt/Windows.Storage.h>
12
12
 
13
13
  #include <sstream>
@@ -56,10 +56,7 @@ std::future<std::string> getUnPackagedApplicationDataPath(const wchar_t *childFo
56
56
  } // namespace
57
57
 
58
58
  std::future<std::string> getApplicationDataPath(const wchar_t *childFolder) {
59
- uint32_t length{0};
60
- bool isPackagedApp = GetCurrentPackageFullName(&length, nullptr) != APPMODEL_ERROR_NO_PACKAGE;
61
- std::string appDataPath;
62
- if (false) {
59
+ if (Microsoft::ReactNative::HasPackageIdentity()) {
63
60
  co_return co_await getPackagedApplicationDataPath(childFolder);
64
61
  } else {
65
62
  co_return co_await getUnPackagedApplicationDataPath(childFolder);
@@ -31,6 +31,8 @@ struct AlertManagerSpec_Args {
31
31
  std::optional<std::string> destructiveButtonKey;
32
32
  REACT_FIELD(keyboardType)
33
33
  std::optional<std::string> keyboardType;
34
+ REACT_FIELD(userInterfaceStyle)
35
+ std::optional<std::string> userInterfaceStyle;
34
36
  };
35
37
 
36
38
  struct AlertManagerSpec : winrt::Microsoft::ReactNative::TurboModuleSpec {
@@ -52,6 +52,7 @@ struct AnimatedModuleSpec : winrt::Microsoft::ReactNative::TurboModuleSpec {
52
52
  Method<void(double, std::string, double) noexcept>{20, L"removeAnimatedEventFromView"},
53
53
  Method<void(std::string) noexcept>{21, L"addListener"},
54
54
  Method<void(double) noexcept>{22, L"removeListeners"},
55
+ Method<void(::React::JSValueArray) noexcept>{23, L"queueAndExecuteBatchedOperations"},
55
56
  };
56
57
 
57
58
  template <class TModule>
@@ -173,6 +174,11 @@ struct AnimatedModuleSpec : winrt::Microsoft::ReactNative::TurboModuleSpec {
173
174
  "removeListeners",
174
175
  " REACT_METHOD(removeListeners) void removeListeners(double count) noexcept { /* implementation */ }}\n"
175
176
  " REACT_METHOD(removeListeners) static void removeListeners(double count) noexcept { /* implementation */ }}\n");
177
+ REACT_SHOW_METHOD_SPEC_ERRORS(
178
+ 23,
179
+ "queueAndExecuteBatchedOperations",
180
+ " REACT_METHOD(queueAndExecuteBatchedOperations) void queueAndExecuteBatchedOperations(::React::JSValueArray && operationsAndArgs) noexcept { /* implementation */ }}\n"
181
+ " REACT_METHOD(queueAndExecuteBatchedOperations) static void queueAndExecuteBatchedOperations(::React::JSValueArray && operationsAndArgs) noexcept { /* implementation */ }}\n");
176
182
  }
177
183
  };
178
184
 
@@ -52,6 +52,7 @@ struct AnimatedTurboModuleSpec : winrt::Microsoft::ReactNative::TurboModuleSpec
52
52
  Method<void(double, std::string, double) noexcept>{20, L"removeAnimatedEventFromView"},
53
53
  Method<void(std::string) noexcept>{21, L"addListener"},
54
54
  Method<void(double) noexcept>{22, L"removeListeners"},
55
+ Method<void(::React::JSValueArray) noexcept>{23, L"queueAndExecuteBatchedOperations"},
55
56
  };
56
57
 
57
58
  template <class TModule>
@@ -173,6 +174,11 @@ struct AnimatedTurboModuleSpec : winrt::Microsoft::ReactNative::TurboModuleSpec
173
174
  "removeListeners",
174
175
  " REACT_METHOD(removeListeners) void removeListeners(double count) noexcept { /* implementation */ }}\n"
175
176
  " REACT_METHOD(removeListeners) static void removeListeners(double count) noexcept { /* implementation */ }}\n");
177
+ REACT_SHOW_METHOD_SPEC_ERRORS(
178
+ 23,
179
+ "queueAndExecuteBatchedOperations",
180
+ " REACT_METHOD(queueAndExecuteBatchedOperations) void queueAndExecuteBatchedOperations(::React::JSValueArray && operationsAndArgs) noexcept { /* implementation */ }}\n"
181
+ " REACT_METHOD(queueAndExecuteBatchedOperations) static void queueAndExecuteBatchedOperations(::React::JSValueArray && operationsAndArgs) noexcept { /* implementation */ }}\n");
176
182
  }
177
183
  };
178
184
 
@@ -126,9 +126,9 @@ PullToRefreshViewProps::PullToRefreshViewProps(
126
126
  SafeAreaViewProps::SafeAreaViewProps(
127
127
  const PropsParserContext &context,
128
128
  const SafeAreaViewProps &sourceProps,
129
- const RawProps &rawProps): ViewProps(context, sourceProps, rawProps),
129
+ const RawProps &rawProps): ViewProps(context, sourceProps, rawProps)
130
130
 
131
- emulateUnlessSupported(convertRawProp(context, rawProps, "emulateUnlessSupported", sourceProps.emulateUnlessSupported, {false}))
131
+
132
132
  {}
133
133
  AndroidHorizontalScrollContentViewProps::AndroidHorizontalScrollContentViewProps(
134
134
  const PropsParserContext &context,
@@ -465,7 +465,7 @@ class SafeAreaViewProps final : public ViewProps {
465
465
 
466
466
  #pragma mark - Props
467
467
 
468
- bool emulateUnlessSupported{false};
468
+
469
469
  };
470
470
 
471
471
  class AndroidHorizontalScrollContentViewProps final : public ViewProps {
@@ -0,0 +1,14 @@
1
+ {
2
+ "Registrations": [
3
+ {
4
+ "Component": {
5
+ "Type": "git",
6
+ "Git": {
7
+ "RepositoryUrl": "https://github.com/fmtlib/fmt",
8
+ "CommitHash": "9e8b86fd2d9806672cc73133d21780dd182bfd24"
9
+ }
10
+ },
11
+ "DevelopmentDependency": false
12
+ }
13
+ ]
14
+ }
package/fmt/fmt.vcxproj CHANGED
@@ -96,16 +96,28 @@
96
96
  </Link>
97
97
  </ItemDefinitionGroup>
98
98
  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
99
- <Target Name="DownloadFmt" BeforeTargets="PrepareForBuild">
100
- <Message Importance="High" Text="Downloading fmt..." Condition="!Exists('$(FmtDir)..\.fmtzip\fmt-$(FmtVersion).zip')" />
101
- <DownloadFile Condition="!Exists('$(FmtDir)..\.fmtzip\fmt-$(FmtVersion).zip')" SourceUrl="https://github.com/fmtlib/fmt/archive/refs/tags/$(FmtVersion).zip" DestinationFileName="fmt-$(FmtVersion).zip" DestinationFolder="$(FmtDir)..\.fmtzip" Retries="10" />
99
+ <PropertyGroup>
100
+ <FmtZipDir>$(FmtDir)..\.fmtzip</FmtZipDir>
101
+ <FmtZipFile>$(FmtZipDir)\fmt-$(FmtVersion).zip</FmtZipFile>
102
+ <CGManifestFile>$(MSBuildThisFileDirectory)cgmanifest.json</CGManifestFile>
103
+ </PropertyGroup>
104
+ <Target Name="DownloadFmt" BeforeTargets="PrepareForBuild" Inputs="$(FmtZipFile)" Outputs="$(FmtZipFile)">
105
+ <Message Importance="High" Text="Downloading fmt..." />
106
+ <DownloadFile
107
+ SourceUrl="https://github.com/fmtlib/fmt/archive/refs/tags/$(FmtVersion).zip"
108
+ DestinationFileName="$(FmtZipFile)"
109
+ DestinationFolder="$(FmtZipDir)"
110
+ Retries="10" />
102
111
  </Target>
103
112
  <Target Name="UnzipFmt" BeforeTargets="PrepareForBuild" DependsOnTargets="DownloadFmt">
104
- <Message Importance="High" Text="Unzipping fmt to $([MSBuild]::NormalizePath($(FmtDir)..))." Condition="!Exists('$(FmtDir)src\format.cc')" />
105
- <Unzip Condition="!Exists('$(FmtDir)')" SourceFiles="$(FmtDir)..\.fmtzip\fmt-$(FmtVersion).zip" DestinationFolder="$([MSBuild]::NormalizePath($(FmtDir)..))" OverwriteReadOnlyFiles="true" />
113
+ <Message Condition="!Exists('$(FmtDir)src\format.cc')" Importance="High" Text="Unzipping fmt to $([MSBuild]::NormalizePath($(FmtDir)..))."/>
114
+ <Unzip
115
+ Condition="!Exists('$(FmtDir)src\format.cc')"
116
+ SourceFiles="$(FmtZipFile)"
117
+ DestinationFolder="$([MSBuild]::NormalizePath($(FmtDir)..))"
118
+ OverwriteReadOnlyFiles="true" />
106
119
  </Target>
107
- <Target Name="WriteCGManifest" BeforeTargets="PrepareForBuild" DependsOnTargets="UnzipFmt">
108
- <Message Importance="High" Text="Generating $([MSBuild]::NormalizePath($(FmtDir)..))\cgmanifest.json." Condition="!Exists('$([MSBuild]::NormalizePath($(FmtDir)..))\cgmanifest.json')" />
120
+ <Target Name="WriteCGManifest" BeforeTargets="PrepareForBuild" DependsOnTargets="DownloadFmt" Inputs="$(FmtZipFile)" Outputs="$(CGManifestFile)">
109
121
  <PropertyGroup>
110
122
  <CGManifestText>{
111
123
  "Registrations": [
@@ -122,17 +134,19 @@
122
134
  ]
123
135
  }</CGManifestText>
124
136
  </PropertyGroup>
137
+ <Message Importance="High" Text="Generating $(CGManifestFile)." />
125
138
  <WriteLinesToFile
126
- File="$([MSBuild]::NormalizePath($(FmtDir)..))\cgmanifest.json"
127
- Overwrite="true"
128
- Lines="$(CGManifestText)" />
139
+ File="$(CGManifestFile)"
140
+ Overwrite="true"
141
+ Lines="$(CGManifestText)" />
129
142
  </Target>
130
143
  <ItemGroup>
131
144
  <TemporaryFmtPatchFiles Include="$(MSBuildThisFileDirectory)\TEMP_UntilFmtUpdate\**\*.*" />
132
145
  </ItemGroup>
133
146
  <Target Name="Deploy" />
134
147
  <!-- Allow temporary patches if needed, while we wait for PRs to land in fmt -->
135
- <Target Name="ApplyFmtTemporaryPatch" BeforeTargets="PrepareForBuild" DependsOnTargets="UnzipFmt">
148
+ <Target Name="ApplyFmtTemporaryPatch" BeforeTargets="PrepareForBuild" DependsOnTargets="UnzipFmt" Inputs="@(TemporaryFmtPatchFiles)" Outputs="@(TemporaryFmtPatchFiles->'$(FmtDir)fmt\%(RecursiveDir)%(Filename)%(Extension)')">
149
+ <Message Importance="High" Text="Applying temporary patches to fmt." />
136
150
  <Copy DestinationFiles="@(TemporaryFmtPatchFiles->'$(FmtDir)fmt\%(RecursiveDir)%(Filename)%(Extension)')" SourceFiles="@(TemporaryFmtPatchFiles)" />
137
151
  </Target>
138
152
  </Project>
@@ -20,12 +20,13 @@ module.exports = {
20
20
  // the correct images are loaded for components. Essentially
21
21
  // require('img1.png') becomes `Object { "testUri": 'path/to/img1.png' }` in
22
22
  // the Jest snapshot.
23
- process: (_, filename) =>
24
- `module.exports = {
23
+ process: (_, filename) => ({
24
+ code: `module.exports = {
25
25
  testUri:
26
26
  ${JSON.stringify(
27
27
  path.relative(__dirname, filename).replace(/\\/g, '/'),
28
28
  )}
29
29
  };`,
30
+ }),
30
31
  getCacheKey: createCacheKeyFunction([__filename]),
31
32
  };
package/jest/setup.js CHANGED
@@ -355,6 +355,10 @@ jest
355
355
  '../Libraries/Utilities/verifyComponentAttributeEquivalence',
356
356
  () => function () {},
357
357
  )
358
+ .mock('../Libraries/Vibration/Vibration', () => ({
359
+ vibrate: jest.fn(),
360
+ cancel: jest.fn(),
361
+ }))
358
362
  .mock('../Libraries/Components/View/ViewNativeComponent', () => {
359
363
  const React = require('react');
360
364
  const Component = class extends React.Component {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-windows",
3
- "version": "0.69.4",
3
+ "version": "0.70.0-preview.1",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -23,11 +23,11 @@
23
23
  "dependencies": {
24
24
  "@babel/runtime": "^7.0.0",
25
25
  "@jest/create-cache-key-function": "^27.0.1",
26
- "@react-native-community/cli": "^8.0.0",
27
- "@react-native-community/cli-platform-android": "^8.0.0",
28
- "@react-native-community/cli-platform-ios": "^8.0.0",
29
- "@react-native-windows/cli": "0.69.2",
30
- "@react-native-windows/virtualized-list": "0.69.0",
26
+ "@react-native-community/cli": "^9.0.0-alpha.5",
27
+ "@react-native-community/cli-platform-android": "^9.0.0-alpha.5",
28
+ "@react-native-community/cli-platform-ios": "^9.0.0-alpha.5",
29
+ "@react-native-windows/cli": "0.70.0-preview.1",
30
+ "@react-native-windows/virtualized-list": "0.70.0-preview.1",
31
31
  "@react-native/assets": "1.0.0",
32
32
  "@react-native/normalize-color": "2.0.0",
33
33
  "@react-native/polyfills": "2.0.0",
@@ -35,25 +35,23 @@
35
35
  "anser": "^1.4.9",
36
36
  "base64-js": "^1.1.2",
37
37
  "event-target-shim": "^5.0.1",
38
- "hermes-engine": "~0.11.0",
39
38
  "invariant": "^2.2.4",
40
39
  "jsc-android": "^250230.2.1",
41
40
  "memoize-one": "^5.0.0",
42
- "metro-react-native-babel-transformer": "0.70.3",
43
- "metro-runtime": "0.70.3",
44
- "metro-source-map": "0.70.3",
41
+ "metro-react-native-babel-transformer": "0.71.3",
42
+ "metro-runtime": "0.71.3",
43
+ "metro-source-map": "0.71.3",
45
44
  "mkdirp": "^0.5.1",
46
45
  "nullthrows": "^1.1.1",
47
46
  "pretty-format": "^26.5.2",
48
47
  "promise": "^8.0.3",
49
48
  "react-devtools-core": "4.24.0",
50
- "react-native-codegen": "^0.69.1",
51
- "react-native-gradle-plugin": "^0.0.7",
49
+ "react-native-codegen": "^0.70.3",
50
+ "react-native-gradle-plugin": "^0.70.0",
52
51
  "react-refresh": "^0.4.0",
53
- "react-shallow-renderer": "16.14.1",
52
+ "react-shallow-renderer": "^16.15.0",
54
53
  "regenerator-runtime": "^0.13.2",
55
- "scheduler": "^0.21.0",
56
- "shelljs": "^0.8.5",
54
+ "scheduler": "^0.22.0",
57
55
  "source-map-support": "^0.5.19",
58
56
  "stacktrace-parser": "^0.1.3",
59
57
  "use-sync-external-store": "^1.0.0",
@@ -61,9 +59,10 @@
61
59
  "ws": "^6.1.4"
62
60
  },
63
61
  "devDependencies": {
64
- "@react-native-windows/codegen": "0.69.0",
65
- "@rnw-scripts/eslint-config": "1.1.12",
66
- "@rnw-scripts/jest-out-of-tree-snapshot-resolver": "^1.0.6",
62
+ "@react-native-windows/codegen": "0.70.0-preview.1",
63
+ "@rnw-scripts/eslint-config": "1.1.13",
64
+ "@rnw-scripts/jest-out-of-tree-snapshot-resolver": "^1.0.7",
65
+ "@rnw-scripts/just-task": "2.2.5",
67
66
  "@rnw-scripts/metro-dev-config": "0.0.0",
68
67
  "@rnx-kit/jest-preset": "^0.1.0",
69
68
  "@types/node": "^14.14.22",
@@ -71,30 +70,30 @@
71
70
  "@types/react-native": "^0.66.17",
72
71
  "eslint": "^7.32.0",
73
72
  "eslint-plugin-prettier": "^4.0.0",
74
- "flow-bin": "^0.176.3",
73
+ "flow-bin": "^0.182.0",
75
74
  "jscodeshift": "^0.13.1",
76
75
  "just-scripts": "^1.3.3",
77
76
  "metro-config": "^0.70.1",
78
77
  "prettier": "^2.4.1",
79
- "react": "18.0.0",
80
- "react-native": "^0.69.0",
81
- "react-native-platform-override": "^1.6.11",
78
+ "react": "18.1.0",
79
+ "react-native": "0.70.0-rc.1",
80
+ "react-native-platform-override": "^1.6.13",
82
81
  "react-refresh": "^0.4.0",
83
82
  "react-shallow-renderer": "16.14.1",
84
83
  "typescript": "^4.4.4"
85
84
  },
86
85
  "peerDependencies": {
87
- "react": "18.0.0",
88
- "react-native": "^0.69.0"
86
+ "react": "18.1.0",
87
+ "react-native": "0.70.0-rc.1"
89
88
  },
90
89
  "beachball": {
91
- "defaultNpmTag": "latest",
92
- "gitTags": true,
90
+ "defaultNpmTag": "preview",
93
91
  "disallowedChangeTypes": [
94
92
  "major",
95
93
  "minor",
96
- "prerelease"
97
- ]
94
+ "patch"
95
+ ],
96
+ "gitTags": true
98
97
  },
99
98
  "files": [
100
99
  "/codegen",
@@ -34,7 +34,6 @@
34
34
  // David Sheldrick <https://github.com/ds300>
35
35
  // Natsathorn Yuthakovit <https://github.com/natsathorn>
36
36
  // ConnectDotz <https://github.com/connectdotz>
37
- // Marcel Lasaj <https://github.com/TheWirv>
38
37
  // Alexey Molchan <https://github.com/alexeymolchan>
39
38
  // Alex Brazier <https://github.com/alexbrazier>
40
39
  // Arafat Zahan <https://github.com/kuasha420>
@@ -1,2 +1,49 @@
1
- const {makeMetroConfig} = require('@rnw-scripts/metro-dev-config');
2
- module.exports = makeMetroConfig();
1
+ /**
2
+ * Metro configuration for React Native
3
+ * https://github.com/facebook/react-native
4
+ *
5
+ * @format
6
+ */
7
+ const fs = require('fs');
8
+ const path = require('path');
9
+ const exclusionList = require('metro-config/src/defaults/exclusionList');
10
+
11
+ const rnwPath = fs.realpathSync(
12
+ path.resolve(require.resolve('react-native-windows/package.json'), '..'),
13
+ );
14
+
15
+ // [devMode
16
+ const rnwRootNodeModules = path.resolve(rnwPath, '..', 'node_modules');
17
+ const rnwPackages = path.resolve(rnwPath, '..', 'packages');
18
+ // devMode]
19
+
20
+ module.exports = {
21
+ // [devMode
22
+ watchFolders: [rnwPath, rnwRootNodeModules, rnwPackages],
23
+ // devMode]
24
+ resolver: {
25
+ blockList: exclusionList([
26
+ // This stops "react-native run-windows" from causing the metro server to crash if its already running
27
+ new RegExp(
28
+ `${path.resolve(__dirname, 'windows').replace(/[/\\]/g, '/')}.*`,
29
+ ),
30
+ // This prevents "react-native run-windows" from hitting: EBUSY: resource busy or locked, open msbuild.ProjectImports.zip or other files produced by msbuild
31
+ new RegExp(`${rnwPath}/build/.*`),
32
+ new RegExp(`${rnwPath}/target/.*`),
33
+ /.*\.ProjectImports\.zip/,
34
+ ]),
35
+ // [devMode
36
+ extraNodeModules: {
37
+ 'react-native-windows': rnwPath,
38
+ },
39
+ // devMode]
40
+ },
41
+ transformer: {
42
+ getTransformOptions: async () => ({
43
+ transform: {
44
+ experimentalImportSupport: false,
45
+ inlineRequires: true,
46
+ },
47
+ }),
48
+ },
49
+ };
@@ -1,19 +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
- * @flow strict
8
- * @format
9
- */
10
-
11
- 'use strict';
12
-
13
- // This exists as a separate file only to avoid circular dependencies from
14
- // using this in `_EmitterSubscription`. Combine this back into `EventEmitter`
15
- // after migration and cleanup is done.
16
-
17
- export interface EventSubscription {
18
- remove(): void;
19
- }
@@ -1,62 +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 EventEmitter from './EventEmitter';
14
- import _EventSubscription from './_EventSubscription';
15
- import type EventSubscriptionVendor from './_EventSubscriptionVendor';
16
- import type {EventSubscription} from './EventSubscription';
17
-
18
- /**
19
- * EmitterSubscription represents a subscription with listener and context data.
20
- */
21
- class EmitterSubscription<EventDefinitions: {...}, K: $Keys<EventDefinitions>>
22
- extends _EventSubscription<EventDefinitions, K>
23
- implements EventSubscription
24
- {
25
- emitter: EventEmitter<EventDefinitions>;
26
- listener: ?(...$ElementType<EventDefinitions, K>) => mixed;
27
- context: ?$FlowFixMe;
28
-
29
- /**
30
- * @param {EventEmitter} emitter - The event emitter that registered this
31
- * subscription
32
- * @param {EventSubscriptionVendor} subscriber - The subscriber that controls
33
- * this subscription
34
- * @param {function} listener - Function to invoke when the specified event is
35
- * emitted
36
- * @param {*} context - Optional context object to use when invoking the
37
- * listener
38
- */
39
- constructor(
40
- emitter: EventEmitter<EventDefinitions>,
41
- subscriber: EventSubscriptionVendor<EventDefinitions>,
42
- listener: (...$ElementType<EventDefinitions, K>) => mixed,
43
- context: ?$FlowFixMe,
44
- ) {
45
- super(subscriber);
46
- this.emitter = emitter;
47
- this.listener = listener;
48
- this.context = context;
49
- }
50
-
51
- /**
52
- * Removes this subscription from the emitter that registered it.
53
- * Note: we're overriding the `remove()` method of _EventSubscription here
54
- * but deliberately not calling `super.remove()` as the responsibility
55
- * for removing the subscription lies with the EventEmitter.
56
- */
57
- remove(): void {
58
- this.emitter.__removeSubscription(this);
59
- }
60
- }
61
-
62
- module.exports = EmitterSubscription;