react-native-windows 0.69.6 → 0.70.0

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 (305) 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 +1 -1
  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/IReactPropertyBag.cpp +9 -0
  173. package/Microsoft.ReactNative/IReactPropertyBag.h +3 -0
  174. package/Microsoft.ReactNative/IReactPropertyBag.idl +3 -0
  175. package/Microsoft.ReactNative/JSDispatcherWriter.cpp +60 -22
  176. package/Microsoft.ReactNative/JSDispatcherWriter.h +5 -3
  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 +24 -4
  207. package/Microsoft.ReactNative/ReactHost/ReactInstanceWin.h +1 -1
  208. package/Microsoft.ReactNative/ReactPointerEventArgs.cpp +12 -2
  209. package/Microsoft.ReactNative/TurboModulesProvider.cpp +146 -84
  210. package/Microsoft.ReactNative/TurboModulesProvider.h +5 -0
  211. package/Microsoft.ReactNative/Utils/BatchingEventEmitter.cpp +1 -0
  212. package/Microsoft.ReactNative/Utils/Helpers.cpp +1 -1
  213. package/Microsoft.ReactNative/Utils/Helpers.h +1 -1
  214. package/Microsoft.ReactNative/Utils/PropertyUtils.h +1 -1
  215. package/Microsoft.ReactNative/Utils/TransformableText.h +1 -1
  216. package/Microsoft.ReactNative/Utils/ValueUtils.cpp +0 -1
  217. package/Microsoft.ReactNative/Views/DynamicAutomationPeer.cpp +9 -7
  218. package/Microsoft.ReactNative/Views/DynamicAutomationProperties.cpp +3 -3
  219. package/Microsoft.ReactNative/Views/FlyoutViewManager.cpp +13 -1
  220. package/Microsoft.ReactNative/Views/FrameworkElementTransferProperties.cpp +1 -1
  221. package/Microsoft.ReactNative/Views/FrameworkElementViewManager.cpp +63 -13
  222. package/Microsoft.ReactNative/Views/Image/ImageViewManager.cpp +1 -1
  223. package/Microsoft.ReactNative/Views/Image/ReactImage.cpp +5 -6
  224. package/Microsoft.ReactNative/Views/Image/ReactImage.h +4 -4
  225. package/Microsoft.ReactNative/Views/Text/TextTransformParentVisitor.h +1 -1
  226. package/Microsoft.ReactNative/Views/TextInputViewManager.cpp +21 -2
  227. package/Microsoft.ReactNative/Views/TextViewManager.cpp +6 -3
  228. package/Microsoft.ReactNative/Views/TouchEventHandler.cpp +1 -1
  229. package/Microsoft.ReactNative/Views/ViewManagerBase.cpp +7 -1
  230. package/Microsoft.ReactNative/Views/ViewPanel.cpp +4 -0
  231. package/Microsoft.ReactNative/Views/ViewViewManager.cpp +8 -3
  232. package/Microsoft.ReactNative/Views/cppwinrt/DynamicAutomationPeer.idl +2 -0
  233. package/Microsoft.ReactNative/microsoft.reactnative.def +4 -1
  234. package/Microsoft.ReactNative.Cxx/AppModelHelpers.h +17 -0
  235. package/Microsoft.ReactNative.Cxx/CoreApp.h +60 -0
  236. package/Microsoft.ReactNative.Cxx/JSI/JsiAbiApi.cpp +65 -0
  237. package/Microsoft.ReactNative.Cxx/JSI/JsiAbiApi.h +13 -0
  238. package/Microsoft.ReactNative.Cxx/JSI/JsiValueHelpers.cpp +53 -0
  239. package/Microsoft.ReactNative.Cxx/JSI/JsiValueHelpers.h +32 -0
  240. package/Microsoft.ReactNative.Cxx/JSI/LongLivedJsiValue.h +84 -0
  241. package/Microsoft.ReactNative.Cxx/JSI/NodeApiJsiRuntime.cpp +14 -2
  242. package/Microsoft.ReactNative.Cxx/Microsoft.ReactNative.Cxx.vcxitems +4 -0
  243. package/Microsoft.ReactNative.Cxx/Microsoft.ReactNative.Cxx.vcxitems.filters +10 -0
  244. package/Microsoft.ReactNative.Managed/packages.lock.json +1 -24
  245. package/Mso/dispatchQueue/dispatchQueue.h +12 -4
  246. package/Mso/src/dispatchQueue/looperScheduler.cpp +36 -9
  247. package/Mso/src/dispatchQueue/queueService.cpp +2 -2
  248. package/Mso/src/dispatchQueue/queueService.h +2 -2
  249. package/Mso/src/dispatchQueue/uiScheduler_winrt.cpp +6 -1
  250. package/Mso/src/memoryApi/memoryApi.cpp +3 -0
  251. package/PropertySheets/Generated/PackageVersion.g.props +3 -3
  252. package/PropertySheets/JSEngine.props +1 -1
  253. package/PropertySheets/Release.props +6 -0
  254. package/ReactCommon/ReactCommon.vcxproj +11 -21
  255. package/ReactCommon/ReactCommon.vcxproj.filters +64 -46
  256. package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/JSExecutor.h +145 -0
  257. package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/NativeToJsBridge.cpp +344 -0
  258. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/text/BaseTextProps.cpp +313 -0
  259. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/view/ViewProps.cpp +455 -0
  260. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/core/ConcreteComponentDescriptor.h +216 -0
  261. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/core/PropsMacros.h +91 -0
  262. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/graphics/RectangleEdges.h +100 -0
  263. package/ReactCommon/TEMP_UntilReactCommonUpdate/yoga/yoga/CompactValue.h +3 -1
  264. package/Scripts/Microsoft.ReactNative.nuspec +6 -0
  265. package/Scripts/Microsoft.ReactNative.targets +7 -0
  266. package/Shared/DevSettings.h +4 -0
  267. package/Shared/InstanceManager.cpp +29 -0
  268. package/Shared/InstanceManager.h +14 -0
  269. package/Shared/JSI/ChakraRuntime.cpp +11 -2
  270. package/Shared/JSI/ChakraRuntime.h +2 -0
  271. package/Shared/Modules/BlobModule.cpp +4 -4
  272. package/Shared/Modules/BlobModule.h +1 -1
  273. package/Shared/Modules/FileReaderModule.cpp +3 -2
  274. package/Shared/Modules/IBlobPersistor.h +1 -1
  275. package/Shared/Networking/IHttpResource.h +1 -0
  276. package/Shared/Networking/OriginPolicyHttpFilter.cpp +16 -10
  277. package/Shared/Networking/WinRTHttpResource.cpp +34 -2
  278. package/Shared/OInstance.cpp +29 -6
  279. package/Shared/OInstance.h +4 -13
  280. package/Shared/Threading/BatchingQueueThread.cpp +23 -12
  281. package/Shared/Utils.cpp +2 -5
  282. package/codegen/NativeAlertManagerSpec.g.h +2 -0
  283. package/codegen/NativeAnimatedModuleSpec.g.h +6 -0
  284. package/codegen/NativeAnimatedTurboModuleSpec.g.h +6 -0
  285. package/codegen/react/components/rnwcore/Props.cpp +2 -2
  286. package/codegen/react/components/rnwcore/Props.h +1 -1
  287. package/fmt/cgmanifest.json +14 -0
  288. package/fmt/fmt.vcxproj +25 -11
  289. package/jest/assetFileTransformer.js +3 -2
  290. package/jest/setup.js +4 -0
  291. package/package.json +25 -26
  292. package/rntypes/index.d.ts +0 -1
  293. package/template/cs-app-WinAppSDK/proj/{NuGet.Config → NuGet_Config} +0 -0
  294. package/template/metro.devMode.config.js +49 -2
  295. package/template/shared-app/proj/{NuGet.Config → NuGet_Config} +0 -0
  296. package/template/shared-lib/proj/{NuGet.Config → NuGet_Config} +0 -0
  297. package/Libraries/vendor/emitter/EventSubscription.js +0 -19
  298. package/Libraries/vendor/emitter/_EmitterSubscription.js +0 -62
  299. package/Libraries/vendor/emitter/_EventEmitter.js +0 -184
  300. package/Libraries/vendor/emitter/_EventSubscription.js +0 -45
  301. package/Libraries/vendor/emitter/_EventSubscriptionVendor.js +0 -108
  302. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/nativemodule/core/ReactCommon/TurboModule.h +0 -87
  303. package/Scripts/copyRNLibraries.js +0 -99
  304. package/jest/preprocessor.js +0 -40
  305. package/jest/preprocessor_DO_NOT_USE.js +0 -122
@@ -1,5 +1,6 @@
1
1
  // Copyright (c) Microsoft Corporation.
2
2
  // Licensed under the MIT License.
3
+ //
3
4
  // IMPORTANT: Before updating this file
4
5
  // please read react-native-windows repo:
5
6
  // vnext/Microsoft.ReactNative.Cxx/README.md
@@ -21,6 +22,7 @@ using namespace winrt;
21
22
  using namespace Windows::Foundation;
22
23
 
23
24
  namespace winrt::Microsoft::ReactNative {
25
+
24
26
  /*-------------------------------------------------------------------------------
25
27
  TurboModuleBuilder
26
28
  -------------------------------------------------------------------------------*/
@@ -56,10 +58,17 @@ struct TurboModuleBuilder : winrt::implements<TurboModuleBuilder, IReactModuleBu
56
58
  }
57
59
 
58
60
  public:
59
- std::unordered_map<std::string, TurboModuleMethodInfo> m_methods;
60
- std::unordered_map<std::string, SyncMethodDelegate> m_syncMethods;
61
- std::vector<ConstantProviderDelegate> m_constantProviders;
62
- bool m_constantsEvaluated{false};
61
+ const std::unordered_map<std::string, TurboModuleMethodInfo> &Methods() const noexcept {
62
+ return m_methods;
63
+ }
64
+
65
+ const std::unordered_map<std::string, SyncMethodDelegate> &SyncMethods() const noexcept {
66
+ return m_syncMethods;
67
+ }
68
+
69
+ const std::vector<ConstantProviderDelegate> &ConstantProviders() const noexcept {
70
+ return m_constantProviders;
71
+ }
63
72
 
64
73
  private:
65
74
  void EnsureMemberNotSet(const std::string &key, bool checkingMethod) noexcept {
@@ -72,6 +81,10 @@ struct TurboModuleBuilder : winrt::implements<TurboModuleBuilder, IReactModuleBu
72
81
 
73
82
  private:
74
83
  IReactContext m_reactContext;
84
+ std::unordered_map<std::string, TurboModuleMethodInfo> m_methods;
85
+ std::unordered_map<std::string, SyncMethodDelegate> m_syncMethods;
86
+ std::vector<ConstantProviderDelegate> m_constantProviders;
87
+ bool m_constantsEvaluated{false};
75
88
  };
76
89
 
77
90
  /*-------------------------------------------------------------------------------
@@ -84,11 +97,13 @@ class TurboModuleImpl : public facebook::react::TurboModule {
84
97
  const IReactContext &reactContext,
85
98
  const std::string &name,
86
99
  const std::shared_ptr<facebook::react::CallInvoker> &jsInvoker,
100
+ std::weak_ptr<facebook::react::LongLivedObjectCollection> longLivedObjectCollection,
87
101
  const ReactModuleProvider &reactModuleProvider)
88
102
  : facebook::react::TurboModule(name, jsInvoker),
89
103
  m_reactContext(reactContext),
90
- m_moduleBuilder(winrt::make<TurboModuleBuilder>(reactContext)),
91
- m_providedModule(reactModuleProvider(m_moduleBuilder)) {
104
+ m_longLivedObjectCollection(std::move(longLivedObjectCollection)),
105
+ m_moduleBuilder(winrt::make_self<TurboModuleBuilder>(reactContext)),
106
+ m_providedModule(reactModuleProvider(m_moduleBuilder.as<IReactModuleBuilder>())) {
92
107
  if (auto hostObject = m_providedModule.try_as<IJsiHostObject>()) {
93
108
  m_hostObjectWrapper = std::make_shared<implementation::HostObjectWrapper>(hostObject);
94
109
  }
@@ -99,12 +114,23 @@ class TurboModuleImpl : public facebook::react::TurboModule {
99
114
  return m_hostObjectWrapper->getPropertyNames(rt);
100
115
  }
101
116
 
102
- auto turboModuleBuilder = m_moduleBuilder.as<TurboModuleBuilder>();
103
117
  std::vector<facebook::jsi::PropNameID> propertyNames;
104
- propertyNames.reserve(turboModuleBuilder->m_methods.size());
105
- for (auto &methodInfo : turboModuleBuilder->m_methods) {
118
+ propertyNames.reserve(
119
+ m_moduleBuilder->Methods().size() + m_moduleBuilder->SyncMethods().size() +
120
+ (m_moduleBuilder->ConstantProviders().empty() ? 0 : 1));
121
+
122
+ for (auto &methodInfo : m_moduleBuilder->Methods()) {
106
123
  propertyNames.push_back(facebook::jsi::PropNameID::forAscii(rt, methodInfo.first));
107
124
  }
125
+
126
+ for (auto &syncMethodInfo : m_moduleBuilder->SyncMethods()) {
127
+ propertyNames.push_back(facebook::jsi::PropNameID::forAscii(rt, syncMethodInfo.first));
128
+ }
129
+
130
+ if (!m_moduleBuilder->ConstantProviders().empty()) {
131
+ propertyNames.push_back(facebook::jsi::PropNameID::forAscii(rt, "getConstants"));
132
+ }
133
+
108
134
  return propertyNames;
109
135
  };
110
136
 
@@ -114,24 +140,23 @@ class TurboModuleImpl : public facebook::react::TurboModule {
114
140
  }
115
141
 
116
142
  // it is not safe to assume that "runtime" never changes, so members are not cached here
117
- auto moduleBuilder = m_moduleBuilder.as<TurboModuleBuilder>();
118
143
  std::string key = propName.utf8(runtime);
119
144
 
120
- if (key == "getConstants" && !moduleBuilder->m_constantProviders.empty()) {
145
+ if (key == "getConstants" && !m_moduleBuilder->ConstantProviders().empty()) {
121
146
  // try to find getConstants if there is any constant
122
147
  return facebook::jsi::Function::createFromHostFunction(
123
148
  runtime,
124
149
  propName,
125
150
  0,
126
- [moduleBuilder](
151
+ [moduleBuilder = m_moduleBuilder](
127
152
  facebook::jsi::Runtime &rt,
128
- const facebook::jsi::Value &thisVal,
129
- const facebook::jsi::Value *args,
130
- size_t count) {
153
+ const facebook::jsi::Value & /*thisVal*/,
154
+ const facebook::jsi::Value * /*args*/,
155
+ size_t /*count*/) {
131
156
  // collect all constants to an object
132
157
  auto writer = winrt::make<JsiWriter>(rt);
133
158
  writer.WriteObjectBegin();
134
- for (auto constantProvider : moduleBuilder->m_constantProviders) {
159
+ for (auto const &constantProvider : moduleBuilder->ConstantProviders()) {
135
160
  constantProvider(writer);
136
161
  }
137
162
  writer.WriteObjectEnd();
@@ -141,21 +166,21 @@ class TurboModuleImpl : public facebook::react::TurboModule {
141
166
 
142
167
  {
143
168
  // try to find a Method
144
- auto it = moduleBuilder->m_methods.find(key);
145
- if (it != moduleBuilder->m_methods.end()) {
146
- TurboModuleMethodInfo methodInfo = it->second;
169
+ auto it = m_moduleBuilder->Methods().find(key);
170
+ if (it != m_moduleBuilder->Methods().end()) {
171
+ TurboModuleMethodInfo const &methodInfo = it->second;
147
172
  switch (methodInfo.ReturnType) {
148
173
  case MethodReturnType::Void:
149
174
  return facebook::jsi::Function::createFromHostFunction(
150
175
  runtime,
151
176
  propName,
152
177
  0,
153
- [methodInfo](
178
+ [method = methodInfo.Method](
154
179
  facebook::jsi::Runtime &rt,
155
180
  const facebook::jsi::Value & /*thisVal*/,
156
181
  const facebook::jsi::Value *args,
157
182
  size_t argCount) {
158
- methodInfo.Method(winrt::make<JsiReader>(rt, args, argCount), nullptr, nullptr, nullptr);
183
+ method(winrt::make<JsiReader>(rt, args, argCount), nullptr, nullptr, nullptr);
159
184
  return facebook::jsi::Value::undefined();
160
185
  });
161
186
  case MethodReturnType::Callback:
@@ -163,17 +188,22 @@ class TurboModuleImpl : public facebook::react::TurboModule {
163
188
  runtime,
164
189
  propName,
165
190
  0,
166
- [jsDispatcher = m_reactContext.JSDispatcher(), methodInfo](
191
+ [jsDispatcher = m_reactContext.JSDispatcher(),
192
+ method = methodInfo.Method,
193
+ longLivedObjectCollection = m_longLivedObjectCollection](
167
194
  facebook::jsi::Runtime &rt,
168
195
  const facebook::jsi::Value & /*thisVal*/,
169
196
  const facebook::jsi::Value *args,
170
197
  size_t argCount) {
171
198
  VerifyElseCrash(argCount > 0);
172
- methodInfo.Method(
173
- winrt::make<JsiReader>(rt, args, argCount - 1),
174
- winrt::make<JSDispatcherWriter>(jsDispatcher, rt),
175
- MakeCallback(rt, {rt, args[argCount - 1]}),
176
- nullptr);
199
+ if (auto strongLongLivedObjectCollection = longLivedObjectCollection.lock()) {
200
+ auto jsiRuntimeHolder = LongLivedJsiRuntime::CreateWeak(strongLongLivedObjectCollection, rt);
201
+ method(
202
+ winrt::make<JsiReader>(rt, args, argCount - 1),
203
+ winrt::make<JSDispatcherWriter>(jsDispatcher, jsiRuntimeHolder),
204
+ MakeCallback(rt, strongLongLivedObjectCollection, args[argCount - 1]),
205
+ nullptr);
206
+ }
177
207
  return facebook::jsi::Value::undefined();
178
208
  });
179
209
  case MethodReturnType::TwoCallbacks:
@@ -181,17 +211,22 @@ class TurboModuleImpl : public facebook::react::TurboModule {
181
211
  runtime,
182
212
  propName,
183
213
  0,
184
- [jsDispatcher = m_reactContext.JSDispatcher(), methodInfo](
214
+ [jsDispatcher = m_reactContext.JSDispatcher(),
215
+ method = methodInfo.Method,
216
+ longLivedObjectCollection = m_longLivedObjectCollection](
185
217
  facebook::jsi::Runtime &rt,
186
218
  const facebook::jsi::Value & /*thisVal*/,
187
219
  const facebook::jsi::Value *args,
188
220
  size_t argCount) {
189
221
  VerifyElseCrash(argCount > 1);
190
- methodInfo.Method(
191
- winrt::make<JsiReader>(rt, args, argCount - 2),
192
- winrt::make<JSDispatcherWriter>(jsDispatcher, rt),
193
- MakeCallback(rt, {rt, args[argCount - 2]}),
194
- MakeCallback(rt, {rt, args[argCount - 1]}));
222
+ if (auto strongLongLivedObjectCollection = longLivedObjectCollection.lock()) {
223
+ auto jsiRuntimeHolder = LongLivedJsiRuntime::CreateWeak(strongLongLivedObjectCollection, rt);
224
+ method(
225
+ winrt::make<JsiReader>(rt, args, argCount - 2),
226
+ winrt::make<JSDispatcherWriter>(jsDispatcher, jsiRuntimeHolder),
227
+ MakeCallback(rt, strongLongLivedObjectCollection, args[argCount - 2]),
228
+ MakeCallback(rt, strongLongLivedObjectCollection, args[argCount - 1]));
229
+ }
195
230
  return facebook::jsi::Value::undefined();
196
231
  });
197
232
  case MethodReturnType::Promise:
@@ -199,52 +234,66 @@ class TurboModuleImpl : public facebook::react::TurboModule {
199
234
  runtime,
200
235
  propName,
201
236
  0,
202
- [jsDispatcher = m_reactContext.JSDispatcher(), methodInfo](
237
+ [jsDispatcher = m_reactContext.JSDispatcher(),
238
+ method = methodInfo.Method,
239
+ longLivedObjectCollection = m_longLivedObjectCollection](
203
240
  facebook::jsi::Runtime &rt,
204
241
  const facebook::jsi::Value & /*thisVal*/,
205
242
  const facebook::jsi::Value *args,
206
243
  size_t count) {
207
- auto argReader = winrt::make<JsiReader>(rt, args, count);
208
- auto argWriter = winrt::make<JSDispatcherWriter>(jsDispatcher, rt);
209
- return facebook::react::createPromiseAsJSIValue(
210
- rt,
211
- [methodInfo, argReader, argWriter](
212
- facebook::jsi::Runtime &runtime, std::shared_ptr<facebook::react::Promise> promise) {
213
- methodInfo.Method(
214
- argReader,
215
- argWriter,
216
- [promise](const IJSValueWriter &writer) {
217
- writer.as<JSDispatcherWriter>()->WithResultArgs([promise](
218
- facebook::jsi::Runtime &runtime,
219
- facebook::jsi::Value const *args,
220
- size_t argCount) {
221
- VerifyElseCrash(argCount == 1);
222
- promise->resolve(args[0]);
244
+ if (auto strongLongLivedObjectCollection = longLivedObjectCollection.lock()) {
245
+ auto jsiRuntimeHolder = LongLivedJsiRuntime::CreateWeak(strongLongLivedObjectCollection, rt);
246
+ auto argReader = winrt::make<JsiReader>(rt, args, count);
247
+ auto argWriter = winrt::make<JSDispatcherWriter>(jsDispatcher, jsiRuntimeHolder);
248
+ return facebook::react::createPromiseAsJSIValue(
249
+ rt,
250
+ [method, argReader, argWriter, strongLongLivedObjectCollection](
251
+ facebook::jsi::Runtime &runtime, std::shared_ptr<facebook::react::Promise> promise) {
252
+ method(
253
+ argReader,
254
+ argWriter,
255
+ [weakResolve = LongLivedJsiFunction::CreateWeak(
256
+ strongLongLivedObjectCollection, runtime, std::move(promise->resolve_))](
257
+ const IJSValueWriter &writer) {
258
+ writer.as<JSDispatcherWriter>()->WithResultArgs([weakResolve](
259
+ facebook::jsi::Runtime &runtime,
260
+ facebook::jsi::Value const *args,
261
+ size_t argCount) {
262
+ VerifyElseCrash(argCount == 1);
263
+ if (auto resolveHolder = weakResolve.lock()) {
264
+ resolveHolder->Value().call(runtime, args[0]);
265
+ }
266
+ });
267
+ },
268
+ [weakReject = LongLivedJsiFunction::CreateWeak(
269
+ strongLongLivedObjectCollection, runtime, std::move(promise->reject_))](
270
+ const IJSValueWriter &writer) {
271
+ writer.as<JSDispatcherWriter>()->WithResultArgs([weakReject](
272
+ facebook::jsi::Runtime &runtime,
273
+ facebook::jsi::Value const *args,
274
+ size_t argCount) {
275
+ VerifyElseCrash(argCount == 1);
276
+ if (auto rejectHolder = weakReject.lock()) {
277
+ // To match the Android and iOS TurboModule behavior we create the Error object for
278
+ // the Promise rejection the same way as in updateErrorWithErrorData method.
279
+ // See react-native/Libraries/BatchedBridge/NativeModules.js for details.
280
+ auto error = runtime.global()
281
+ .getPropertyAsFunction(runtime, "Error")
282
+ .callAsConstructor(runtime, {});
283
+ auto &errorData = args[0];
284
+ if (errorData.isObject()) {
285
+ runtime.global()
286
+ .getPropertyAsObject(runtime, "Object")
287
+ .getPropertyAsFunction(runtime, "assign")
288
+ .call(runtime, error, errorData.getObject(runtime));
289
+ }
290
+ rejectHolder->Value().call(runtime, args[0]);
291
+ }
292
+ });
223
293
  });
224
- },
225
- [promise](const IJSValueWriter &writer) {
226
- writer.as<JSDispatcherWriter>()->WithResultArgs([promise](
227
- facebook::jsi::Runtime &runtime,
228
- facebook::jsi::Value const *args,
229
- size_t argCount) {
230
- VerifyElseCrash(argCount == 1);
231
- // To match the Android and iOS TurboModule behavior we create the Error object for
232
- // the Promise rejection the same way as in updateErrorWithErrorData method.
233
- // See react-native/Libraries/BatchedBridge/NativeModules.js for details.
234
- auto error = runtime.global()
235
- .getPropertyAsFunction(runtime, "Error")
236
- .callAsConstructor(runtime, {});
237
- auto &errorData = args[0];
238
- if (errorData.isObject()) {
239
- runtime.global()
240
- .getPropertyAsObject(runtime, "Object")
241
- .getPropertyAsFunction(runtime, "assign")
242
- .call(runtime, error, errorData.getObject(runtime));
243
- }
244
- promise->reject_.call(runtime, error);
245
- });
246
- });
247
- });
294
+ });
295
+ }
296
+ return facebook::jsi::Value::undefined();
248
297
  });
249
298
  default:
250
299
  VerifyElseCrash(false);
@@ -254,8 +303,8 @@ class TurboModuleImpl : public facebook::react::TurboModule {
254
303
 
255
304
  {
256
305
  // try to find a SyncMethod
257
- auto it = moduleBuilder->m_syncMethods.find(key);
258
- if (it != moduleBuilder->m_syncMethods.end()) {
306
+ auto it = m_moduleBuilder->SyncMethods().find(key);
307
+ if (it != m_moduleBuilder->SyncMethods().end()) {
259
308
  return facebook::jsi::Function::createFromHostFunction(
260
309
  runtime,
261
310
  propName,
@@ -287,27 +336,34 @@ class TurboModuleImpl : public facebook::react::TurboModule {
287
336
  }
288
337
 
289
338
  private:
290
- static MethodResultCallback MakeCallback(facebook::jsi::Runtime &runtime, facebook::jsi::Value callback) noexcept {
291
- auto sharedCallback =
292
- std::make_shared<facebook::jsi::Function>(std::move(callback).asObject(runtime).asFunction(runtime));
293
- return [sharedCallback = std::move(sharedCallback)](const IJSValueWriter &writer) noexcept {
339
+ static MethodResultCallback MakeCallback(
340
+ facebook::jsi::Runtime &rt,
341
+ const std::shared_ptr<facebook::react::LongLivedObjectCollection> &longLivedObjectCollection,
342
+ const facebook::jsi::Value &callback) noexcept {
343
+ auto weakCallback =
344
+ LongLivedJsiFunction::CreateWeak(longLivedObjectCollection, rt, callback.getObject(rt).getFunction(rt));
345
+ return [weakCallback = std::move(weakCallback)](const IJSValueWriter &writer) noexcept {
294
346
  writer.as<JSDispatcherWriter>()->WithResultArgs(
295
- [sharedCallback](facebook::jsi::Runtime &rt, facebook::jsi::Value const *args, size_t count) {
296
- sharedCallback->call(rt, args, count);
347
+ [weakCallback](facebook::jsi::Runtime &rt, facebook::jsi::Value const *args, size_t count) {
348
+ if (auto callback = weakCallback.lock()) {
349
+ callback->Value().call(rt, args, count);
350
+ }
297
351
  });
298
352
  };
299
353
  }
300
354
 
301
355
  private:
302
356
  IReactContext m_reactContext;
303
- IReactModuleBuilder m_moduleBuilder;
357
+ winrt::com_ptr<TurboModuleBuilder> m_moduleBuilder;
304
358
  IInspectable m_providedModule;
305
359
  std::shared_ptr<implementation::HostObjectWrapper> m_hostObjectWrapper;
360
+ std::weak_ptr<facebook::react::LongLivedObjectCollection> m_longLivedObjectCollection;
306
361
  };
307
362
 
308
363
  /*-------------------------------------------------------------------------------
309
364
  TurboModulesProvider
310
365
  -------------------------------------------------------------------------------*/
366
+
311
367
  std::shared_ptr<facebook::react::TurboModule> TurboModulesProvider::getModule(
312
368
  const std::string &moduleName,
313
369
  const std::shared_ptr<facebook::react::CallInvoker> &callInvoker) noexcept {
@@ -317,7 +373,8 @@ std::shared_ptr<facebook::react::TurboModule> TurboModulesProvider::getModule(
317
373
  return nullptr;
318
374
  }
319
375
 
320
- auto tm = std::make_shared<TurboModuleImpl>(m_reactContext, moduleName, callInvoker, it->second);
376
+ auto tm = std::make_shared<TurboModuleImpl>(
377
+ m_reactContext, moduleName, callInvoker, m_longLivedObjectCollection, /*reactModuleProvider*/ it->second);
321
378
  return tm;
322
379
  }
323
380
 
@@ -348,4 +405,9 @@ void TurboModulesProvider::AddModuleProvider(
348
405
  }
349
406
  }
350
407
 
408
+ std::shared_ptr<facebook::react::LongLivedObjectCollection> const &
409
+ TurboModulesProvider::LongLivedObjectCollection() noexcept {
410
+ return m_longLivedObjectCollection;
411
+ }
412
+
351
413
  } // namespace winrt::Microsoft::ReactNative
@@ -6,6 +6,7 @@
6
6
 
7
7
  #pragma once
8
8
 
9
+ #include <ReactCommon/LongLivedObject.h>
9
10
  #include <TurboModuleRegistry.h>
10
11
  #include "Base/FollyIncludes.h"
11
12
  #include "winrt/Microsoft.ReactNative.h"
@@ -25,8 +26,12 @@ class TurboModulesProvider final : public facebook::react::TurboModuleRegistry {
25
26
  winrt::hstring const &moduleName,
26
27
  ReactModuleProvider const &moduleProvider,
27
28
  bool overwriteExisting) noexcept;
29
+ std::shared_ptr<facebook::react::LongLivedObjectCollection> const &LongLivedObjectCollection() noexcept;
28
30
 
29
31
  private:
32
+ // To keep a list of deferred asynchronous callbacks and promises.
33
+ std::shared_ptr<facebook::react::LongLivedObjectCollection> m_longLivedObjectCollection{
34
+ std::make_shared<facebook::react::LongLivedObjectCollection>()};
30
35
  std::unordered_map<std::string, ReactModuleProvider> m_moduleProviders;
31
36
  IReactContext m_reactContext;
32
37
  };
@@ -3,6 +3,7 @@
3
3
 
4
4
  #include "pch.h"
5
5
  #include "BatchingEventEmitter.h"
6
+ #include <UI.Xaml.Media.h>
6
7
  #include "DynamicWriter.h"
7
8
  #include "JSValueWriter.h"
8
9
 
@@ -31,7 +31,7 @@ namespace Microsoft::ReactNative {
31
31
  // Instead of deduce view id directly from FrameworkElement.Tag, this do
32
32
  // additional check by uimanager.
33
33
  ReactId getViewId(const Mso::React::IReactContext &context, xaml::FrameworkElement const &fe) {
34
- ReactId reactId;
34
+ ReactId reactId{};
35
35
  if (auto uiManager = Microsoft::ReactNative::GetNativeUIManager(context).lock()) {
36
36
  if (auto peer = uiManager->reactPeerOrContainerFrom(fe)) {
37
37
  reactId.isValid = true;
@@ -18,7 +18,7 @@ struct ReactId {
18
18
  };
19
19
 
20
20
  template <typename T>
21
- inline typename T asEnum(winrt::Microsoft::ReactNative::JSValue const &obj) {
21
+ inline T asEnum(winrt::Microsoft::ReactNative::JSValue const &obj) {
22
22
  return static_cast<T>(obj.AsInt64());
23
23
  }
24
24
 
@@ -149,10 +149,10 @@ bool TryUpdateForeground(
149
149
  }
150
150
  } else if (propertyValue.IsNull()) {
151
151
  element.ClearValue(T::ForegroundProperty());
152
- UpdateControlForegroundResourceBrushes(element, nullptr);
153
152
  if (uielement) {
154
153
  uielement.HighContrastAdjustment(xaml::ElementHighContrastAdjustment::Application);
155
154
  }
155
+ UpdateControlForegroundResourceBrushes(element, nullptr);
156
156
  }
157
157
 
158
158
  return true;
@@ -24,7 +24,7 @@ struct TransformableText final {
24
24
  dwMapFlags |= LCMAP_TITLECASE;
25
25
  break;
26
26
  default:
27
- nyi();
27
+ assert(false);
28
28
  return originalText;
29
29
  }
30
30
 
@@ -133,7 +133,6 @@ struct BrushCache {
133
133
 
134
134
  assert(false && "Resource is not a Color or Brush");
135
135
  return xaml::Media::SolidColorBrush(winrt::Colors::Transparent());
136
- ;
137
136
  }
138
137
 
139
138
  xaml::Media::Brush RegisterBrush(winrt::hstring resourceName, const xaml::Media::Brush &brush) {
@@ -312,13 +312,15 @@ winrt::hstring DynamicAutomationPeer::GetContentName() const {
312
312
 
313
313
  try {
314
314
  if (auto const &viewControl = Owner().try_as<winrt::Microsoft::ReactNative::ViewControl>()) {
315
- auto viewPanel = viewControl.GetPanel();
316
-
317
- for (auto const &child : viewPanel.Children()) {
318
- if (auto const &textBlock = child.try_as<winrt::TextBlock>()) {
319
- name = name.empty() ? textBlock.Text() : (L" " + name + textBlock.Text());
320
- } else if (auto const &stringableName = child.try_as<winrt::IStringable>()) {
321
- name = (name.empty() ? L"" : L" ") + name + stringableName.ToString();
315
+ // It's possible that the ViewPanel is null, perhaps when this is invoked around the same time
316
+ // that a View is being unmounted, causing a fast fail for EXCEPTION_ACCESS_VIOLATION_READ.
317
+ if (auto viewPanel = viewControl.GetPanel()) {
318
+ for (auto const &child : viewPanel.Children()) {
319
+ if (auto const &textBlock = child.try_as<winrt::TextBlock>()) {
320
+ name = name.empty() ? textBlock.Text() : (L" " + name + textBlock.Text());
321
+ } else if (auto const &stringableName = child.try_as<winrt::IStringable>()) {
322
+ name = (name.empty() ? L"" : L" ") + name + stringableName.ToString();
323
+ }
322
324
  }
323
325
  }
324
326
  }
@@ -179,7 +179,7 @@ xaml::DependencyProperty DynamicAutomationProperties::AccessibilityValueMinPrope
179
179
  L"AccessibilityValueMin",
180
180
  winrt::xaml_typename<double>(),
181
181
  dynamicAutomationTypeName,
182
- winrt::PropertyMetadata(winrt::box_value(0)));
182
+ winrt::PropertyMetadata(winrt::box_value(0.0)));
183
183
 
184
184
  return s_AccessibilityValueMinProperty;
185
185
  }
@@ -197,7 +197,7 @@ xaml::DependencyProperty DynamicAutomationProperties::AccessibilityValueMaxPrope
197
197
  L"AccessibilityValueMax",
198
198
  winrt::xaml_typename<double>(),
199
199
  dynamicAutomationTypeName,
200
- winrt::PropertyMetadata(winrt::box_value(0)));
200
+ winrt::PropertyMetadata(winrt::box_value(0.0)));
201
201
 
202
202
  return s_AccessibilityValueMaxProperty;
203
203
  }
@@ -215,7 +215,7 @@ xaml::DependencyProperty DynamicAutomationProperties::AccessibilityValueNowPrope
215
215
  L"AccessibilityValueNow",
216
216
  winrt::xaml_typename<double>(),
217
217
  dynamicAutomationTypeName,
218
- winrt::PropertyMetadata(winrt::box_value(0)));
218
+ winrt::PropertyMetadata(winrt::box_value(0.0)));
219
219
 
220
220
  return s_AccessibilityValueNowProperty;
221
221
  }
@@ -122,6 +122,7 @@ class FlyoutShadowNode : public ShadowNodeBase {
122
122
  winrt::Popup GetFlyoutParentPopup() const;
123
123
  winrt::FlyoutPresenter GetFlyoutPresenter() const;
124
124
  void OnShowFlyout();
125
+ void LogErrorAndClose(const string &error);
125
126
  xaml::FrameworkElement m_targetElement = nullptr;
126
127
  winrt::Flyout m_flyout = nullptr;
127
128
  bool m_isLightDismissEnabled = true;
@@ -404,7 +405,13 @@ winrt::Flyout FlyoutShadowNode::GetFlyout() {
404
405
  void FlyoutShadowNode::OnShowFlyout() {
405
406
  AdjustDefaultFlyoutStyle(50000, 50000);
406
407
  if (m_isFlyoutShowOptionsSupported) {
407
- m_flyout.ShowAt(m_targetElement, m_showOptions);
408
+ if (!m_targetElement && m_targetTag > 0) {
409
+ LogErrorAndClose("The target view unmounted before flyout could be shown.");
410
+ } else if (m_targetElement && m_flyout.XamlRoot() != m_targetElement.XamlRoot()) {
411
+ LogErrorAndClose("The target view window lost focus before flyout could be shown.");
412
+ } else {
413
+ m_flyout.ShowAt(m_targetElement, m_showOptions);
414
+ }
408
415
  } else {
409
416
  winrt::FlyoutBase::ShowAttachedFlyout(m_targetElement);
410
417
  }
@@ -414,6 +421,11 @@ void FlyoutShadowNode::OnShowFlyout() {
414
421
  }
415
422
  }
416
423
 
424
+ void FlyoutShadowNode::LogErrorAndClose(const std::string &error) {
425
+ GetViewManager()->GetReactContext().CallJSFunction("RCTLog", "logToConsole", folly::dynamic::array("error", error));
426
+ OnFlyoutClosed(GetViewManager()->GetReactContext(), m_tag, false);
427
+ }
428
+
417
429
  void FlyoutShadowNode::SetTargetFrameworkElement() {
418
430
  if (m_targetTag > 0) {
419
431
  if (auto uiManager = GetNativeUIManager(GetViewManager()->GetReactContext()).lock()) {
@@ -17,7 +17,7 @@ void TransferProperty(
17
17
  xaml::DependencyProperty oldViewDP,
18
18
  xaml::DependencyProperty newViewDP) {
19
19
  auto oldValue = oldView.ReadLocalValue(oldViewDP);
20
- if (oldValue != nullptr) {
20
+ if (oldValue != xaml::DependencyProperty::UnsetValue()) {
21
21
  oldView.ClearValue(oldViewDP);
22
22
  newView.SetValue(newViewDP, oldValue);
23
23
  }