react-native-windows 0.66.3 → 0.67.0-preview.3

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 (262) hide show
  1. package/.flowconfig +2 -1
  2. package/CHANGELOG.json +917 -85
  3. package/CHANGELOG.md +352 -37
  4. package/Chakra/Chakra.vcxitems +0 -1
  5. package/Chakra/Chakra.vcxitems.filters +0 -3
  6. package/Chakra/ChakraHelpers.cpp +0 -267
  7. package/Chakra/ChakraInstanceArgs.h +0 -5
  8. package/Chakra/ChakraPlatform.h +0 -4
  9. package/Chakra/ChakraTracing.cpp +0 -33
  10. package/Chakra/ChakraValue.h +0 -4
  11. package/Chakra/Utf8DebugExtensions.cpp +0 -5
  12. package/Chakra/Utf8DebugExtensions.h +0 -6
  13. package/Libraries/ActionSheetIOS/ActionSheetIOS.js +14 -1
  14. package/Libraries/ActionSheetIOS/NativeActionSheetManager.js +2 -0
  15. package/Libraries/Alert/Alert.windows.js +48 -21
  16. package/Libraries/Alert/NativeDialogManagerWindows.js +49 -0
  17. package/Libraries/Animated/AnimatedEvent.js +23 -4
  18. package/Libraries/Animated/NativeAnimatedHelper.js +2 -2
  19. package/Libraries/Animated/components/AnimatedImage.js +3 -3
  20. package/Libraries/Animated/components/AnimatedScrollView.js +3 -3
  21. package/Libraries/Animated/components/AnimatedText.js +3 -3
  22. package/Libraries/Animated/components/AnimatedView.js +1 -3
  23. package/Libraries/Animated/createAnimatedComponent.js +3 -34
  24. package/Libraries/Components/Button.js +3 -0
  25. package/Libraries/Components/Button.windows.js +70 -38
  26. package/Libraries/Components/DatePicker/DatePickerIOS.ios.js +3 -6
  27. package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js +4 -7
  28. package/Libraries/Components/Flyout/Flyout.js +3 -3
  29. package/Libraries/Components/Flyout/Flyout.js.map +1 -1
  30. package/Libraries/Components/Flyout/FlyoutProps.d.ts +4 -0
  31. package/Libraries/Components/Flyout/FlyoutProps.js.map +1 -1
  32. package/Libraries/Components/Glyph/Glyph.js +2 -2
  33. package/Libraries/Components/Glyph/Glyph.js.map +1 -1
  34. package/Libraries/Components/Keyboard/KeyboardExt.js +4 -3
  35. package/Libraries/Components/Keyboard/KeyboardExt.js.map +1 -1
  36. package/Libraries/Components/Popup/Popup.js +3 -3
  37. package/Libraries/Components/Popup/Popup.js.map +1 -1
  38. package/Libraries/Components/ScrollView/AndroidHorizontalScrollViewNativeComponent.js +1 -0
  39. package/Libraries/Components/ScrollView/ScrollView.js +17 -16
  40. package/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +268 -252
  41. package/Libraries/Components/View/View.js +1 -1
  42. package/Libraries/Components/View/View.windows.js +1 -1
  43. package/Libraries/Components/View/ViewAccessibility.js +1 -1
  44. package/Libraries/Components/View/ViewAccessibility.windows.js +1 -1
  45. package/Libraries/Components/View/ViewWindows.js +1 -1
  46. package/Libraries/Components/View/ViewWindows.js.map +1 -1
  47. package/Libraries/Components/View/ViewWindowsProps.d.ts +42 -2
  48. package/Libraries/Components/View/ViewWindowsProps.js.map +1 -1
  49. package/Libraries/Core/ExceptionsManager.js +45 -80
  50. package/Libraries/Core/ExtendedError.js +0 -1
  51. package/Libraries/Core/ReactNativeVersion.js +2 -2
  52. package/Libraries/Core/setUpBatchedBridge.js +1 -1
  53. package/Libraries/Core/setUpGlobals.js +2 -4
  54. package/Libraries/Core/setUpTimers.js +2 -2
  55. package/Libraries/Image/Image.ios.js +6 -0
  56. package/Libraries/Image/Image.windows.js +6 -0
  57. package/Libraries/Image/ImageBackground.js +10 -8
  58. package/Libraries/Image/ImageProps.js +28 -0
  59. package/Libraries/LogBox/Data/LogBoxData.js +18 -19
  60. package/Libraries/LogBox/UI/LogBoxImages/alert-triangle.png +0 -0
  61. package/Libraries/LogBox/UI/LogBoxImages/chevron-left.png +0 -0
  62. package/Libraries/LogBox/UI/LogBoxImages/chevron-right.png +0 -0
  63. package/Libraries/LogBox/UI/LogBoxImages/close.png +0 -0
  64. package/Libraries/LogBox/UI/LogBoxImages/loader.png +0 -0
  65. package/Libraries/NewAppScreen/components/logo.png +0 -0
  66. package/Libraries/PermissionsAndroid/NativePermissionsAndroid.js +2 -1
  67. package/Libraries/PermissionsAndroid/PermissionsAndroid.js +2 -0
  68. package/Libraries/Pressability/Pressability.js +13 -13
  69. package/Libraries/Pressability/Pressability.windows.js +13 -13
  70. package/Libraries/Pressability/PressabilityPerformanceEventEmitter.js +1 -1
  71. package/Libraries/ReactNative/AppRegistry.js +4 -2
  72. package/Libraries/Renderer/implementations/ReactFabric-dev.fb.js +1569 -875
  73. package/Libraries/Renderer/implementations/ReactFabric-prod.fb.js +529 -319
  74. package/Libraries/Renderer/implementations/ReactFabric-profiling.fb.js +570 -362
  75. package/Libraries/Renderer/implementations/ReactNativeRenderer-dev.fb.js +1592 -891
  76. package/Libraries/Renderer/implementations/ReactNativeRenderer-prod.fb.js +521 -311
  77. package/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.fb.js +562 -354
  78. package/Libraries/Share/Share.js +1 -1
  79. package/Libraries/StyleSheet/normalizeColor.js +2 -2
  80. package/Libraries/Text/Text.windows.js +1 -0
  81. package/Libraries/Text/TextNativeComponent.windows.js +72 -0
  82. package/Libraries/Text/TextProps.js +1 -7
  83. package/Libraries/TurboModule/TurboModuleRegistry.js +1 -1
  84. package/Libraries/Utilities/HMRClient.js +1 -1
  85. package/Microsoft.ReactNative/ABIViewManager.cpp +10 -1
  86. package/Microsoft.ReactNative/ABIViewManager.h +3 -0
  87. package/Microsoft.ReactNative/Base/CoreNativeModules.cpp +0 -6
  88. package/Microsoft.ReactNative/IReactDispatcher.cpp +16 -1
  89. package/Microsoft.ReactNative/IViewManager.idl +25 -0
  90. package/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj +35 -8
  91. package/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj.filters +60 -0
  92. package/Microsoft.ReactNative/Modules/AccessibilityInfoModule.cpp +3 -4
  93. package/Microsoft.ReactNative/Modules/AccessibilityInfoModule.h +3 -3
  94. package/Microsoft.ReactNative/Modules/AlertModule.cpp +57 -14
  95. package/Microsoft.ReactNative/Modules/AlertModule.h +17 -24
  96. package/Microsoft.ReactNative/Modules/Animated/InterpolationAnimatedNode.cpp +4 -2
  97. package/Microsoft.ReactNative/Modules/Animated/PropsAnimatedNode.cpp +3 -1
  98. package/Microsoft.ReactNative/Modules/AppStateModule.cpp +8 -6
  99. package/Microsoft.ReactNative/Modules/AppStateModule.h +6 -9
  100. package/Microsoft.ReactNative/Modules/DeviceInfoModule.cpp +34 -22
  101. package/Microsoft.ReactNative/Modules/DeviceInfoModule.h +8 -4
  102. package/Microsoft.ReactNative/Modules/I18nManagerModule.cpp +6 -4
  103. package/Microsoft.ReactNative/Modules/I18nManagerModule.h +3 -2
  104. package/Microsoft.ReactNative/Modules/ImageViewManagerModule.cpp +47 -95
  105. package/Microsoft.ReactNative/Modules/ImageViewManagerModule.h +28 -17
  106. package/Microsoft.ReactNative/Modules/LinkingManagerModule.cpp +14 -4
  107. package/Microsoft.ReactNative/Modules/NativeUIManager.cpp +1 -1
  108. package/Microsoft.ReactNative/Modules/PaperUIManagerModule.cpp +82 -66
  109. package/Microsoft.ReactNative/ReactHost/ReactInstanceWin.cpp +14 -1
  110. package/Microsoft.ReactNative/ReactInstanceSettings.idl +3 -1
  111. package/Microsoft.ReactNative/ReactPointerEventArgs.cpp +37 -0
  112. package/Microsoft.ReactNative/ReactPointerEventArgs.h +28 -0
  113. package/Microsoft.ReactNative/ReactPointerEventArgs.idl +67 -0
  114. package/Microsoft.ReactNative/Utils/TextTransform.h +1 -1
  115. package/Microsoft.ReactNative/Utils/XamlIslandUtils.cpp +24 -10
  116. package/Microsoft.ReactNative/Utils/XamlIslandUtils.h +4 -2
  117. package/Microsoft.ReactNative/Version.rc +2 -19
  118. package/Microsoft.ReactNative/Views/FlyoutViewManager.cpp +57 -2
  119. package/Microsoft.ReactNative/Views/FrameworkElementTransferProperties.cpp +3 -0
  120. package/Microsoft.ReactNative/Views/FrameworkElementViewManager.cpp +7 -2
  121. package/Microsoft.ReactNative/Views/Image/ImageViewManager.cpp +16 -6
  122. package/Microsoft.ReactNative/Views/Image/ReactImage.cpp +18 -11
  123. package/Microsoft.ReactNative/Views/Image/ReactImage.h +3 -1
  124. package/Microsoft.ReactNative/Views/RawTextViewManager.cpp +4 -53
  125. package/Microsoft.ReactNative/Views/RawTextViewManager.h +0 -3
  126. package/Microsoft.ReactNative/Views/ShadowNodeBase.h +5 -0
  127. package/Microsoft.ReactNative/Views/Text/TextHighlighterVisitor.cpp +52 -0
  128. package/Microsoft.ReactNative/Views/Text/TextHighlighterVisitor.h +37 -0
  129. package/Microsoft.ReactNative/Views/Text/TextHitTestUtils.cpp +343 -0
  130. package/Microsoft.ReactNative/Views/Text/TextHitTestUtils.h +13 -0
  131. package/Microsoft.ReactNative/Views/Text/TextHitTestVisitor.cpp +76 -0
  132. package/Microsoft.ReactNative/Views/Text/TextHitTestVisitor.h +32 -0
  133. package/Microsoft.ReactNative/Views/Text/TextParentVisitor.cpp +12 -0
  134. package/Microsoft.ReactNative/Views/Text/TextParentVisitor.h +19 -0
  135. package/Microsoft.ReactNative/Views/Text/TextPropertyChangedParentVisitor.cpp +80 -0
  136. package/Microsoft.ReactNative/Views/Text/TextPropertyChangedParentVisitor.h +43 -0
  137. package/Microsoft.ReactNative/Views/Text/TextTransformParentVisitor.cpp +21 -0
  138. package/Microsoft.ReactNative/Views/Text/TextTransformParentVisitor.h +23 -0
  139. package/Microsoft.ReactNative/Views/Text/TextTransformVisitor.cpp +70 -0
  140. package/Microsoft.ReactNative/Views/Text/TextTransformVisitor.h +34 -0
  141. package/Microsoft.ReactNative/Views/Text/TextVisitor.cpp +56 -0
  142. package/Microsoft.ReactNative/Views/Text/TextVisitor.h +34 -0
  143. package/Microsoft.ReactNative/Views/Text/TextVisitorScope.h +35 -0
  144. package/Microsoft.ReactNative/Views/Text/TextVisitors.h +47 -0
  145. package/Microsoft.ReactNative/Views/TextViewManager.cpp +112 -103
  146. package/Microsoft.ReactNative/Views/TextViewManager.h +6 -12
  147. package/Microsoft.ReactNative/Views/TouchEventHandler.cpp +171 -129
  148. package/Microsoft.ReactNative/Views/TouchEventHandler.h +19 -15
  149. package/Microsoft.ReactNative/Views/ViewManagerBase.cpp +31 -0
  150. package/Microsoft.ReactNative/Views/ViewManagerBase.h +2 -0
  151. package/Microsoft.ReactNative/Views/ViewViewManager.cpp +0 -5
  152. package/Microsoft.ReactNative/Views/VirtualTextViewManager.cpp +21 -91
  153. package/Microsoft.ReactNative/Views/VirtualTextViewManager.h +5 -8
  154. package/Microsoft.ReactNative/XamlView.h +3 -3
  155. package/Microsoft.ReactNative/packages.config +1 -1
  156. package/Microsoft.ReactNative.Cxx/NativeModules.h +114 -0
  157. package/Microsoft.ReactNative.Cxx/VersionMacros.h +19 -0
  158. package/PropertySheets/External/Microsoft.ReactNative.Common.props +2 -0
  159. package/PropertySheets/External/Microsoft.ReactNative.Uwp.CppApp.props +1 -0
  160. package/PropertySheets/External/Microsoft.ReactNative.Uwp.CppLib.props +1 -0
  161. package/PropertySheets/Generated/PackageVersion.g.props +19 -0
  162. package/PropertySheets/PackageVersionDefinitions.props +28 -0
  163. package/PropertySheets/React.Cpp.props +2 -0
  164. package/PropertySheets/WinUI.props +1 -1
  165. package/Scripts/Microsoft.ReactNative.Managed.nuspec +1 -1
  166. package/Scripts/copyRNLibraries.js +12 -0
  167. package/Scripts/rnw-dependencies.ps1 +25 -24
  168. package/Shared/HermesSamplingProfiler.cpp +3 -21
  169. package/Shared/JSI/ChakraApi.cpp +1 -37
  170. package/Shared/JSI/ChakraApi.h +0 -4
  171. package/Shared/JSI/ChakraJsiRuntime_edgemode.cpp +1 -5
  172. package/Shared/JSI/ChakraRuntime.cpp +0 -12
  173. package/Shared/JSI/ChakraRuntimeFactory.h +0 -2
  174. package/Shared/Modules/PlatformConstantsModule.cpp +1 -15
  175. package/Shared/OInstance.cpp +6 -19
  176. package/Shared/Shared.vcxitems +0 -1
  177. package/Shared/Shared.vcxitems.filters +0 -3
  178. package/Shared/Utils.cpp +58 -0
  179. package/Shared/Utils.h +3 -0
  180. package/codegen/NativeAccessibilityInfoSpec.g.h +9 -9
  181. package/codegen/NativeAccessibilityManagerSpec.g.h +49 -21
  182. package/codegen/NativeActionSheetManagerSpec.g.h +62 -6
  183. package/codegen/NativeAlertManagerSpec.g.h +4 -4
  184. package/codegen/NativeAnimatedModuleSpec.g.h +10 -10
  185. package/codegen/NativeAnimatedTurboModuleSpec.g.h +10 -10
  186. package/codegen/NativeAppStateSpec.g.h +25 -3
  187. package/codegen/NativeAppearanceSpec.g.h +3 -3
  188. package/codegen/NativeAsyncLocalStorageSpec.g.h +66 -18
  189. package/codegen/NativeAsyncSQLiteDBStorageSpec.g.h +66 -18
  190. package/codegen/NativeBlobModuleSpec.g.h +24 -6
  191. package/codegen/NativeBugReportingSpec.g.h +3 -3
  192. package/codegen/NativeDatePickerAndroidSpec.g.h +3 -3
  193. package/codegen/NativeDevLoadingViewSpec.g.h +3 -3
  194. package/codegen/NativeDeviceInfoSpec.g.h +18 -0
  195. package/codegen/NativeDialogManagerAndroidSpec.g.h +28 -4
  196. package/codegen/NativeDialogManagerWindowsSpec.g.h +77 -0
  197. package/codegen/NativeExceptionsManagerSpec.g.h +11 -11
  198. package/codegen/NativeFileReaderModuleSpec.g.h +6 -6
  199. package/codegen/NativeFrameRateLoggerSpec.g.h +11 -3
  200. package/codegen/NativeI18nManagerSpec.g.h +20 -0
  201. package/codegen/NativeImageEditorSpec.g.h +30 -6
  202. package/codegen/NativeImageLoaderAndroidSpec.g.h +6 -6
  203. package/codegen/NativeImageLoaderIOSSpec.g.h +6 -6
  204. package/codegen/NativeImagePickerIOSSpec.g.h +28 -12
  205. package/codegen/NativeImageStoreAndroidSpec.g.h +3 -3
  206. package/codegen/NativeImageStoreIOSSpec.g.h +21 -9
  207. package/codegen/NativeIntentAndroidSpec.g.h +3 -3
  208. package/codegen/NativeJSCHeapCaptureSpec.g.h +3 -3
  209. package/codegen/NativeJSCSamplingProfilerSpec.g.h +3 -3
  210. package/codegen/NativeJSDevSupportSpec.g.h +18 -0
  211. package/codegen/NativeNetworkingAndroidSpec.g.h +6 -6
  212. package/codegen/NativeNetworkingIOSSpec.g.h +26 -6
  213. package/codegen/NativePermissionsAndroidSpec.g.h +3 -3
  214. package/codegen/NativePlatformConstantsAndroidSpec.g.h +48 -0
  215. package/codegen/NativePlatformConstantsIOSSpec.g.h +38 -0
  216. package/codegen/NativePlatformConstantsWinSpec.g.h +32 -0
  217. package/codegen/NativePushNotificationManagerIOSSpec.g.h +35 -25
  218. package/codegen/NativeRedBoxSpec.g.h +3 -3
  219. package/codegen/NativeSampleTurboModuleSpec.g.h +32 -12
  220. package/codegen/NativeSegmentFetcherSpec.g.h +6 -6
  221. package/codegen/NativeSettingsManagerSpec.g.h +22 -6
  222. package/codegen/NativeShareModuleSpec.g.h +11 -3
  223. package/codegen/NativeSourceCodeSpec.g.h +16 -0
  224. package/codegen/NativeStatusBarManagerAndroidSpec.g.h +21 -3
  225. package/codegen/NativeStatusBarManagerIOSSpec.g.h +30 -6
  226. package/codegen/NativeToastAndroidSpec.g.h +24 -0
  227. package/codegen/NativeUIManagerSpec.g.h +63 -63
  228. package/codegen/NativeVibrationSpec.g.h +3 -3
  229. package/codegen/NativeWebSocketModuleSpec.g.h +9 -3
  230. package/index.js +15 -10
  231. package/index.windows.js +15 -10
  232. package/jest/mockModal.js +31 -0
  233. package/jest/setup.js +5 -3
  234. package/just-task.js +2 -1
  235. package/package.json +23 -20
  236. package/rntypes/BatchedBridge.d.ts +23 -0
  237. package/rntypes/Devtools.d.ts +20 -0
  238. package/rntypes/LaunchScreen.d.ts +9 -0
  239. package/rntypes/globals.d.ts +496 -0
  240. package/rntypes/index.d.ts +9966 -0
  241. package/rntypes/legacy-properties.d.ts +266 -0
  242. package/template/cpp-app/proj/MyApp.vcxproj +0 -5
  243. package/template/cpp-app/src/pch.h +1 -0
  244. package/template/cpp-lib/src/pch.h +3 -0
  245. package/template/cs-app/proj/MyApp.csproj +0 -6
  246. package/typings-index.d.ts +2 -1
  247. package/typings-index.js +7 -5
  248. package/typings-index.js.map +1 -1
  249. package/Chakra/ChakraCoreDebugger.h +0 -147
  250. package/Libraries/Components/DatePickerAndroid/DatePickerAndroid.android.js +0 -87
  251. package/Libraries/Components/DatePickerAndroid/DatePickerAndroid.ios.js +0 -30
  252. package/Libraries/Components/DatePickerAndroid/DatePickerAndroid.windows.js +0 -30
  253. package/Libraries/Components/DatePickerAndroid/DatePickerAndroidTypes.js +0 -30
  254. package/Libraries/Components/StaticContainer.react.js +0 -51
  255. package/Libraries/Components/Touchable/ensurePositiveDelayProps.js +0 -25
  256. package/Libraries/Interaction/InteractionMixin.js +0 -54
  257. package/Libraries/ReactNative/queryLayoutByID.js +0 -58
  258. package/Scripts/Microsoft.ChakraCore.ARM64.nuspec +0 -50
  259. package/Scripts/Microsoft.ChakraCore.ARM64.targets +0 -15
  260. package/Shared/JSI/ChakraCoreRuntime.h +0 -59
  261. package/template/cpp-app/keys/MyApp_TemporaryKey.pfx +0 -0
  262. package/template/cs-app/keys/MyApp_TemporaryKey.pfx +0 -0
@@ -8,17 +8,20 @@
8
8
 
9
9
  #include "ImageViewManager.h"
10
10
 
11
+ #include <UI.Xaml.Automation.h>
11
12
  #include <winrt/Windows.Foundation.h>
12
13
 
13
14
  #include <IReactInstance.h>
14
15
  #include <Utils/PropertyHandlerUtils.h>
15
16
  #include <Utils/PropertyUtils.h>
16
17
  #include <Views/ShadowNodeBase.h>
18
+ #include "DynamicAutomationProperties.h"
17
19
  #include "ReactImage.h"
18
20
 
19
21
  namespace winrt {
20
22
  using namespace Windows::Foundation;
21
23
  using namespace xaml::Controls;
24
+ using namespace xaml::Automation::Peers;
22
25
  } // namespace winrt
23
26
 
24
27
  // Such code is better to move to a seperate parser layer
@@ -79,6 +82,12 @@ class ImageShadowNode : public ShadowNodeBase {
79
82
  ShadowNodeBase::createView(props);
80
83
  auto reactImage{m_view.as<ReactImage>()};
81
84
 
85
+ // Image should default to "accessible: false", but this is not done on the JS level
86
+ // https://reactnative.dev/docs/image#accessible
87
+ xaml::Automation::AutomationProperties::SetAccessibilityView(*reactImage, winrt::AccessibilityView::Raw);
88
+ DynamicAutomationProperties::SetAccessibilityRole(
89
+ *reactImage, winrt::Microsoft::ReactNative::AccessibilityRoles::Image);
90
+
82
91
  m_onLoadEndToken = reactImage->OnLoadEnd([imageViewManager{static_cast<ImageViewManager *>(GetViewManager())},
83
92
  reactImage](const auto &, const bool &succeeded) {
84
93
  ReactImageSource source{reactImage->Source()};
@@ -116,9 +125,7 @@ bool ImageViewManager::UpdateProperty(
116
125
  const std::string &propertyName,
117
126
  const winrt::Microsoft::ReactNative::JSValue &propertyValue) {
118
127
  auto grid{nodeToUpdate->GetView().as<winrt::Grid>()};
119
-
120
- if (grid == nullptr)
121
- return true;
128
+ auto reactImage{grid.as<ReactImage>()};
122
129
 
123
130
  bool finalizeBorderRadius{false};
124
131
  bool ret = true;
@@ -127,21 +134,24 @@ bool ImageViewManager::UpdateProperty(
127
134
  setSource(grid, propertyValue);
128
135
  } else if (propertyName == "resizeMode") {
129
136
  auto resizeMode{json_type_traits<facebook::react::ImageResizeMode>::parseJson(propertyValue)};
130
- auto reactImage{grid.as<ReactImage>()};
131
137
  reactImage->ResizeMode(resizeMode);
132
138
  } else if (
133
139
  propertyName == "blurRadius" &&
134
140
  (propertyValue.Type() == winrt::Microsoft::ReactNative::JSValueType::Double ||
135
141
  propertyValue.Type() == winrt::Microsoft::ReactNative::JSValueType::Int64)) {
136
- auto reactImage{grid.as<ReactImage>()};
137
142
  reactImage->BlurRadius(propertyValue.AsSingle());
138
143
  } else if (propertyName == "tintColor") {
139
144
  const auto isValidColorValue = IsValidColorValue(propertyValue);
140
145
  if (isValidColorValue || propertyValue.IsNull()) {
141
- auto reactImage{grid.as<ReactImage>()};
142
146
  const auto color = isValidColorValue ? ColorFrom(propertyValue) : winrt::Colors::Transparent();
143
147
  reactImage->TintColor(color);
144
148
  }
149
+ // Override default accessibility behavior
150
+ } else if (propertyName == "accessible" && propertyValue.IsNull()) {
151
+ xaml::Automation::AutomationProperties::SetAccessibilityView(*reactImage, winrt::AccessibilityView::Raw);
152
+ } else if (propertyName == "accessibilityRole" && propertyValue.IsNull()) {
153
+ DynamicAutomationProperties::SetAccessibilityRole(
154
+ *reactImage, winrt::Microsoft::ReactNative::AccessibilityRoles::Image);
145
155
  } else if (TryUpdateCornerRadiusOnNode(nodeToUpdate, grid, propertyName, propertyValue)) {
146
156
  finalizeBorderRadius = true;
147
157
  } else if (TryUpdateBorderProperties(nodeToUpdate, grid, propertyName, propertyValue)) {
@@ -13,6 +13,7 @@
13
13
  #include <winrt/Windows.Web.Http.h>
14
14
 
15
15
  #include <Utils/ValueUtils.h>
16
+ #include "DynamicAutomationPeer.h"
16
17
  #include "Unicode.h"
17
18
  #include "XamlView.h"
18
19
  #include "cdebug.h"
@@ -25,6 +26,7 @@ using namespace xaml;
25
26
  using namespace xaml::Media;
26
27
  using namespace xaml::Media::Imaging;
27
28
  using namespace Windows::Web::Http;
29
+ using namespace xaml::Automation::Peers;
28
30
  } // namespace winrt
29
31
 
30
32
  using Microsoft::Common::Unicode::Utf8ToUtf16;
@@ -44,6 +46,8 @@ winrt::Size ReactImage::ArrangeOverride(winrt::Size finalSize) {
44
46
  if (auto brush{Background().try_as<ReactImageBrush>()}) {
45
47
  brush->AvailableSize(finalSize);
46
48
  }
49
+ } else if (auto brush{Background().try_as<winrt::ImageBrush>()}) {
50
+ brush.Stretch(ResizeModeToStretch(finalSize));
47
51
  }
48
52
 
49
53
  return finalSize;
@@ -57,6 +61,10 @@ void ReactImage::OnLoadEnd(winrt::event_token const &token) noexcept {
57
61
  m_onLoadEndEvent.remove(token);
58
62
  }
59
63
 
64
+ winrt::AutomationPeer ReactImage::OnCreateAutomationPeer() {
65
+ return winrt::make<winrt::Microsoft::ReactNative::implementation::DynamicAutomationPeer>(*this);
66
+ }
67
+
60
68
  void ReactImage::ResizeMode(facebook::react::ImageResizeMode value) {
61
69
  if (m_resizeMode != value) {
62
70
  m_resizeMode = value;
@@ -71,7 +79,7 @@ void ReactImage::ResizeMode(facebook::react::ImageResizeMode value) {
71
79
  } else if (auto brush{Background().try_as<ReactImageBrush>()}) {
72
80
  brush->ResizeMode(value);
73
81
  } else if (auto bitmapBrush{Background().as<winrt::ImageBrush>()}) {
74
- bitmapBrush.Stretch(ResizeModeToStretch(m_resizeMode));
82
+ bitmapBrush.Stretch(ResizeModeToStretch());
75
83
  }
76
84
  }
77
85
  }
@@ -112,8 +120,12 @@ void ReactImage::TintColor(winrt::Color value) {
112
120
  }
113
121
  }
114
122
 
115
- winrt::Stretch ReactImage::ResizeModeToStretch(facebook::react::ImageResizeMode value) {
116
- switch (value) {
123
+ winrt::Stretch ReactImage::ResizeModeToStretch() {
124
+ return ResizeModeToStretch({static_cast<float>(ActualWidth()), static_cast<float>(ActualHeight())});
125
+ }
126
+
127
+ winrt::Stretch ReactImage::ResizeModeToStretch(winrt::Size size) {
128
+ switch (m_resizeMode) {
117
129
  case facebook::react::ImageResizeMode::Cover:
118
130
  return winrt::Stretch::UniformToFill;
119
131
  case facebook::react::ImageResizeMode::Stretch:
@@ -121,7 +133,7 @@ winrt::Stretch ReactImage::ResizeModeToStretch(facebook::react::ImageResizeMode
121
133
  case facebook::react::ImageResizeMode::Contain:
122
134
  return winrt::Stretch::Uniform;
123
135
  default: // ResizeMode::Center || ResizeMode::Repeat
124
- if (m_imageSource.height < ActualHeight() && m_imageSource.width < ActualWidth()) {
136
+ if (m_imageSource.height < size.Height && m_imageSource.width < size.Width) {
125
137
  return winrt::Stretch::None;
126
138
  } else {
127
139
  return winrt::Stretch::Uniform;
@@ -300,13 +312,7 @@ winrt::fire_and_forget ReactImage::SetBackground(bool fireLoadEndEvent) {
300
312
  bool createImageBrush{!imageBrush};
301
313
  if (createImageBrush) {
302
314
  imageBrush = winrt::ImageBrush{};
303
-
304
- strong_this->m_imageBrushOpenedRevoker =
305
- imageBrush.ImageOpened(winrt::auto_revoke, [weak_this, imageBrush](const auto &, const auto &) {
306
- if (auto strong_this{weak_this.get()}) {
307
- imageBrush.Stretch(strong_this->ResizeModeToStretch(strong_this->m_resizeMode));
308
- }
309
- });
315
+ imageBrush.Stretch(strong_this->ResizeModeToStretch());
310
316
  }
311
317
 
312
318
  if (source.sourceFormat == ImageSourceFormat::Svg) {
@@ -356,6 +362,7 @@ winrt::fire_and_forget ReactImage::SetBackground(bool fireLoadEndEvent) {
356
362
  if (auto bitmap{imageBrush.ImageSource().try_as<winrt::BitmapImage>()}) {
357
363
  strong_this->m_imageSource.height = bitmap.PixelHeight();
358
364
  strong_this->m_imageSource.width = bitmap.PixelWidth();
365
+ imageBrush.Stretch(strong_this->ResizeModeToStretch());
359
366
  }
360
367
 
361
368
  strong_this->m_onLoadEndEvent(*strong_this, true);
@@ -39,6 +39,7 @@ struct ReactImage : xaml::Controls::GridT<ReactImage> {
39
39
 
40
40
  // Overrides
41
41
  winrt::Windows::Foundation::Size ArrangeOverride(winrt::Windows::Foundation::Size finalSize);
42
+ xaml::Automation::Peers::AutomationPeer OnCreateAutomationPeer();
42
43
 
43
44
  // Events
44
45
  winrt::event_token OnLoadEnd(winrt::Windows::Foundation::EventHandler<bool> const &handler);
@@ -66,7 +67,8 @@ struct ReactImage : xaml::Controls::GridT<ReactImage> {
66
67
  void TintColor(winrt::Windows::UI::Color value);
67
68
 
68
69
  private:
69
- xaml::Media::Stretch ResizeModeToStretch(facebook::react::ImageResizeMode value);
70
+ xaml::Media::Stretch ResizeModeToStretch();
71
+ xaml::Media::Stretch ResizeModeToStretch(winrt::Windows::Foundation::Size size);
70
72
  winrt::Windows::Foundation::IAsyncOperation<winrt::Windows::Storage::Streams::InMemoryRandomAccessStream>
71
73
  GetImageMemoryStreamAsync(ReactImageSource source);
72
74
  winrt::fire_and_forget SetBackground(bool fireLoadEndEvent);
@@ -4,19 +4,12 @@
4
4
  #include "pch.h"
5
5
 
6
6
  #include "RawTextViewManager.h"
7
- #include "TextViewManager.h"
8
- #include "VirtualTextViewManager.h"
9
7
 
10
8
  #include <Views/ShadowNodeBase.h>
9
+ #include <Views/Text/TextVisitors.h>
11
10
 
12
- #include <INativeUIManager.h>
13
- #include <Utils/ShadowNodeTypeUtils.h>
14
- #include <Utils/ValueUtils.h>
15
-
16
- #include <Modules/NativeUIManager.h>
17
- #include <Modules/PaperUIManagerModule.h>
18
- #include <UI.Xaml.Controls.h>
19
11
  #include <UI.Xaml.Documents.h>
12
+ #include <Utils/ValueUtils.h>
20
13
  #include <winrt/Windows.Foundation.h>
21
14
 
22
15
  namespace winrt {
@@ -52,56 +45,14 @@ bool RawTextViewManager::UpdateProperty(
52
45
  if (propertyName == "text") {
53
46
  run.Text(asHstring(propertyValue));
54
47
  static_cast<RawTextShadowNode *>(nodeToUpdate)->originalText = winrt::hstring{};
55
- NotifyAncestorsTextChanged(nodeToUpdate);
48
+ ApplyTextTransformToChild(nodeToUpdate);
49
+ NotifyAncestorsTextPropertyChanged(nodeToUpdate, PropertyChangeType::Text);
56
50
  } else {
57
51
  return Super::UpdateProperty(nodeToUpdate, propertyName, propertyValue);
58
52
  }
59
53
  return true;
60
54
  }
61
55
 
62
- void RawTextViewManager::NotifyAncestorsTextChanged(ShadowNodeBase *nodeToUpdate) {
63
- if (auto uiManager = GetNativeUIManager(GetReactContext()).lock()) {
64
- auto host = uiManager->getHost();
65
- ShadowNodeBase *parent = static_cast<ShadowNodeBase *>(host->FindShadowNodeForTag(nodeToUpdate->GetParent()));
66
- TextTransform textTransform = TextTransform::Undefined;
67
- auto isNested = false;
68
- while (parent) {
69
- auto viewManager = parent->GetViewManager();
70
- const auto nodeType = viewManager->GetName();
71
- if (IsTextShadowNode(parent)) {
72
- const auto textViewManager = static_cast<TextViewManager *>(viewManager);
73
- if (textTransform == TextTransform::Undefined) {
74
- textTransform = textViewManager->GetTextTransformValue(parent);
75
- }
76
-
77
- VirtualTextShadowNode::ApplyTextTransform(
78
- *nodeToUpdate, textTransform, /* forceUpdate = */ false, /* isRoot = */ false);
79
-
80
- if (!isNested && parent->m_children.size() == 1) {
81
- auto view = parent->GetView();
82
- auto textBlock = view.try_as<winrt::TextBlock>();
83
- if (textBlock != nullptr) {
84
- const auto run = nodeToUpdate->GetView().try_as<winrt::Run>();
85
- if (run != nullptr) {
86
- textBlock.Text(run.Text());
87
- }
88
- }
89
- }
90
-
91
- (static_cast<TextViewManager *>(viewManager))->OnDescendantTextPropertyChanged(parent);
92
-
93
- // We have reached the parent TextBlock, so there're no more parent <Text> elements in this tree.
94
- break;
95
- } else if (IsVirtualTextShadowNode(parent) && textTransform == TextTransform::Undefined) {
96
- textTransform = static_cast<VirtualTextShadowNode *>(parent)->textTransform;
97
- }
98
-
99
- parent = static_cast<ShadowNodeBase *>(host->FindShadowNodeForTag(parent->GetParent()));
100
- isNested = true;
101
- }
102
- }
103
- }
104
-
105
56
  void RawTextViewManager::SetLayoutProps(
106
57
  ShadowNodeBase & /*nodeToUpdate*/,
107
58
  const XamlView & /*viewToUpdate*/,
@@ -41,9 +41,6 @@ class RawTextViewManager : public ViewManagerBase {
41
41
  const winrt::Microsoft::ReactNative::JSValue &propertyValue) override;
42
42
 
43
43
  XamlView CreateViewCore(int64_t tag, const winrt::Microsoft::ReactNative::JSValueObject &) override;
44
-
45
- private:
46
- void NotifyAncestorsTextChanged(ShadowNodeBase *nodeToUpdate);
47
44
  };
48
45
 
49
46
  } // namespace Microsoft::ReactNative
@@ -16,6 +16,8 @@ namespace Microsoft::ReactNative {
16
16
 
17
17
  class ViewManagerBase;
18
18
 
19
+ enum class PointerEventsKind : uint8_t { Auto = 0, BoxNone, BoxOnly, None };
20
+
19
21
  enum class ShadowEdges : uint8_t {
20
22
  Left = 0,
21
23
  Top,
@@ -128,6 +130,9 @@ struct REACTWINDOWS_EXPORT ShadowNodeBase : public ShadowNode {
128
130
  bool m_onMouseEnterRegistered = false;
129
131
  bool m_onMouseLeaveRegistered = false;
130
132
 
133
+ // Pointer events
134
+ PointerEventsKind m_pointerEvents = PointerEventsKind::Auto;
135
+
131
136
  // Support Keyboard
132
137
  public:
133
138
  void UpdateHandledKeyboardEvents(
@@ -0,0 +1,52 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT License.
3
+
4
+ #include "TextHighlighterVisitor.h"
5
+ #include <Utils/ValueUtils.h>
6
+ #include <Views/RawTextViewManager.h>
7
+ #include <Views/TextViewManager.h>
8
+ #include <Views/VirtualTextViewManager.h>
9
+ #include "TextVisitorScope.h"
10
+
11
+ namespace winrt {
12
+ using namespace xaml::Documents;
13
+ } // namespace winrt
14
+
15
+ namespace Microsoft::ReactNative {
16
+
17
+ void TextHighlighterVisitor::VisitRawText(ShadowNodeBase *node) {
18
+ const auto textNode = static_cast<RawTextShadowNode *>(node);
19
+ m_startIndex += textNode->GetView().as<winrt::Run>().Text().size();
20
+ }
21
+
22
+ void TextHighlighterVisitor::VisitVirtualText(ShadowNodeBase *node) {
23
+ const auto textNode = static_cast<VirtualTextShadowNode *>(node);
24
+ const auto foregroundColor = textNode->foregroundColor;
25
+ const auto backgroundColor = textNode->backgroundColor;
26
+ const auto needsHighlighter = RequiresTextHighlighter(foregroundColor, backgroundColor);
27
+ TextVisitorScope<Color> foregroundScope{m_foregroundColors, foregroundColor};
28
+ TextVisitorScope<Color> backgroundScope{m_backgroundColors, backgroundColor};
29
+
30
+ const auto startIndex = m_startIndex;
31
+ const auto initialHighlighterCount = highlighters.size();
32
+ Super::VisitVirtualText(node);
33
+
34
+ if (needsHighlighter) {
35
+ winrt::TextHighlighter highlighter;
36
+ highlighter.Background(SolidBrushFromColor(m_backgroundColors.top().value()));
37
+ const auto inheritedForegroundColor = m_foregroundColors.top();
38
+ if (inheritedForegroundColor.has_value()) {
39
+ highlighter.Foreground(SolidBrushFromColor(inheritedForegroundColor.value()));
40
+ }
41
+ highlighter.Ranges().Append({startIndex, m_startIndex - startIndex});
42
+ highlighters.push_back(highlighter);
43
+ } else if (highlighters.size() == initialHighlighterCount) {
44
+ textNode->hasDescendantTextHighlighter = false;
45
+ }
46
+ }
47
+
48
+ bool TextHighlighterVisitor::RequiresTextHighlighter(Color foregroundColor, Color backgroundColor) {
49
+ return backgroundColor || m_backgroundColors.top() && foregroundColor;
50
+ }
51
+
52
+ } // namespace Microsoft::ReactNative
@@ -0,0 +1,37 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT License.
3
+
4
+ #pragma once
5
+
6
+ #include <Utils/TextTransform.h>
7
+ #include <stack>
8
+ #include "TextVisitor.h"
9
+
10
+ namespace Microsoft::ReactNative {
11
+
12
+ class TextHighlighterVisitor : public TextVisitor {
13
+ using Super = TextVisitor;
14
+ using Color = std::optional<winrt::Windows::UI::Color>;
15
+
16
+ public:
17
+ TextHighlighterVisitor(Color foregroundColor, Color backgroundColor) : Super() {
18
+ m_foregroundColors.push(foregroundColor);
19
+ m_backgroundColors.push(backgroundColor);
20
+ }
21
+
22
+ std::vector<xaml::Documents::TextHighlighter> highlighters{};
23
+
24
+ protected:
25
+ void VisitRawText(ShadowNodeBase *node) override;
26
+
27
+ void VisitVirtualText(ShadowNodeBase *node) override;
28
+
29
+ private:
30
+ int m_startIndex{0};
31
+ std::stack<Color> m_foregroundColors;
32
+ std::stack<Color> m_backgroundColors;
33
+
34
+ bool RequiresTextHighlighter(Color foregroundColor, Color backgroundColor);
35
+ };
36
+
37
+ } // namespace Microsoft::ReactNative