react-native-windows 0.66.1 → 0.67.0-preview.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (255) hide show
  1. package/.flowconfig +2 -1
  2. package/CHANGELOG.json +879 -47
  3. package/CHANGELOG.md +342 -27
  4. package/Libraries/ActionSheetIOS/ActionSheetIOS.js +14 -1
  5. package/Libraries/ActionSheetIOS/NativeActionSheetManager.js +2 -0
  6. package/Libraries/Alert/Alert.windows.js +48 -21
  7. package/Libraries/Alert/NativeDialogManagerWindows.js +49 -0
  8. package/Libraries/Animated/AnimatedEvent.js +23 -4
  9. package/Libraries/Animated/NativeAnimatedHelper.js +2 -2
  10. package/Libraries/Animated/components/AnimatedImage.js +3 -3
  11. package/Libraries/Animated/components/AnimatedScrollView.js +3 -3
  12. package/Libraries/Animated/components/AnimatedText.js +3 -3
  13. package/Libraries/Animated/components/AnimatedView.js +1 -3
  14. package/Libraries/Animated/createAnimatedComponent.js +3 -34
  15. package/Libraries/AppTheme/AppTheme.d.ts +3 -2
  16. package/Libraries/AppTheme/AppTheme.js +20 -2
  17. package/Libraries/AppTheme/AppTheme.js.map +1 -1
  18. package/Libraries/Components/Button.js +3 -0
  19. package/Libraries/Components/Button.windows.js +70 -38
  20. package/Libraries/Components/DatePicker/DatePickerIOS.ios.js +3 -6
  21. package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js +4 -7
  22. package/Libraries/Components/Flyout/Flyout.js +3 -3
  23. package/Libraries/Components/Flyout/Flyout.js.map +1 -1
  24. package/Libraries/Components/Flyout/FlyoutProps.d.ts +4 -0
  25. package/Libraries/Components/Flyout/FlyoutProps.js.map +1 -1
  26. package/Libraries/Components/Glyph/Glyph.js +2 -2
  27. package/Libraries/Components/Glyph/Glyph.js.map +1 -1
  28. package/Libraries/Components/Keyboard/KeyboardExt.js +4 -3
  29. package/Libraries/Components/Keyboard/KeyboardExt.js.map +1 -1
  30. package/Libraries/Components/Popup/Popup.js +3 -3
  31. package/Libraries/Components/Popup/Popup.js.map +1 -1
  32. package/Libraries/Components/ScrollView/AndroidHorizontalScrollViewNativeComponent.js +1 -0
  33. package/Libraries/Components/ScrollView/ScrollView.js +17 -16
  34. package/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +268 -252
  35. package/Libraries/Components/View/View.js +1 -1
  36. package/Libraries/Components/View/View.windows.js +1 -1
  37. package/Libraries/Components/View/ViewAccessibility.js +1 -1
  38. package/Libraries/Components/View/ViewAccessibility.windows.js +1 -1
  39. package/Libraries/Components/View/ViewWindows.js +1 -1
  40. package/Libraries/Components/View/ViewWindows.js.map +1 -1
  41. package/Libraries/Components/View/ViewWindowsProps.d.ts +42 -2
  42. package/Libraries/Components/View/ViewWindowsProps.js.map +1 -1
  43. package/Libraries/Core/ExceptionsManager.js +45 -80
  44. package/Libraries/Core/ExtendedError.js +0 -1
  45. package/Libraries/Core/ReactNativeVersion.js +2 -2
  46. package/Libraries/Core/setUpBatchedBridge.js +1 -1
  47. package/Libraries/Core/setUpGlobals.js +2 -4
  48. package/Libraries/Core/setUpTimers.js +2 -2
  49. package/Libraries/Image/Image.ios.js +6 -0
  50. package/Libraries/Image/Image.windows.js +6 -0
  51. package/Libraries/Image/ImageBackground.js +10 -8
  52. package/Libraries/Image/ImageProps.js +28 -0
  53. package/Libraries/LogBox/Data/LogBoxData.js +18 -19
  54. package/Libraries/LogBox/UI/LogBoxImages/alert-triangle.png +0 -0
  55. package/Libraries/LogBox/UI/LogBoxImages/chevron-left.png +0 -0
  56. package/Libraries/LogBox/UI/LogBoxImages/chevron-right.png +0 -0
  57. package/Libraries/LogBox/UI/LogBoxImages/close.png +0 -0
  58. package/Libraries/LogBox/UI/LogBoxImages/loader.png +0 -0
  59. package/Libraries/NewAppScreen/components/logo.png +0 -0
  60. package/Libraries/PermissionsAndroid/NativePermissionsAndroid.js +2 -1
  61. package/Libraries/PermissionsAndroid/PermissionsAndroid.js +2 -0
  62. package/Libraries/Pressability/Pressability.js +13 -13
  63. package/Libraries/Pressability/Pressability.windows.js +13 -13
  64. package/Libraries/Pressability/PressabilityPerformanceEventEmitter.js +1 -1
  65. package/Libraries/ReactNative/AppRegistry.js +4 -2
  66. package/Libraries/Renderer/implementations/ReactFabric-dev.fb.js +1569 -875
  67. package/Libraries/Renderer/implementations/ReactFabric-prod.fb.js +529 -319
  68. package/Libraries/Renderer/implementations/ReactFabric-profiling.fb.js +570 -362
  69. package/Libraries/Renderer/implementations/ReactNativeRenderer-dev.fb.js +1592 -891
  70. package/Libraries/Renderer/implementations/ReactNativeRenderer-prod.fb.js +521 -311
  71. package/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.fb.js +562 -354
  72. package/Libraries/Share/Share.js +1 -1
  73. package/Libraries/StyleSheet/normalizeColor.js +2 -2
  74. package/Libraries/Text/Text.windows.js +1 -0
  75. package/Libraries/Text/TextNativeComponent.windows.js +72 -0
  76. package/Libraries/Text/TextProps.js +1 -7
  77. package/Libraries/TurboModule/TurboModuleRegistry.js +1 -1
  78. package/Libraries/Utilities/HMRClient.js +1 -1
  79. package/Microsoft.ReactNative/ABIViewManager.cpp +10 -1
  80. package/Microsoft.ReactNative/ABIViewManager.h +3 -0
  81. package/Microsoft.ReactNative/Base/CoreNativeModules.cpp +0 -6
  82. package/Microsoft.ReactNative/IReactDispatcher.cpp +16 -1
  83. package/Microsoft.ReactNative/IViewManager.idl +25 -0
  84. package/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj +37 -8
  85. package/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj.filters +60 -0
  86. package/Microsoft.ReactNative/Modules/AccessibilityInfoModule.cpp +3 -4
  87. package/Microsoft.ReactNative/Modules/AccessibilityInfoModule.h +3 -3
  88. package/Microsoft.ReactNative/Modules/AlertModule.cpp +57 -14
  89. package/Microsoft.ReactNative/Modules/AlertModule.h +17 -24
  90. package/Microsoft.ReactNative/Modules/Animated/InterpolationAnimatedNode.cpp +4 -2
  91. package/Microsoft.ReactNative/Modules/Animated/PropsAnimatedNode.cpp +3 -1
  92. package/Microsoft.ReactNative/Modules/AppStateModule.cpp +8 -6
  93. package/Microsoft.ReactNative/Modules/AppStateModule.h +6 -9
  94. package/Microsoft.ReactNative/Modules/DeviceInfoModule.cpp +34 -22
  95. package/Microsoft.ReactNative/Modules/DeviceInfoModule.h +8 -4
  96. package/Microsoft.ReactNative/Modules/I18nManagerModule.cpp +6 -4
  97. package/Microsoft.ReactNative/Modules/I18nManagerModule.h +3 -2
  98. package/Microsoft.ReactNative/Modules/ImageViewManagerModule.cpp +47 -95
  99. package/Microsoft.ReactNative/Modules/ImageViewManagerModule.h +28 -17
  100. package/Microsoft.ReactNative/Modules/LinkingManagerModule.cpp +14 -4
  101. package/Microsoft.ReactNative/Modules/NativeUIManager.cpp +4 -6
  102. package/Microsoft.ReactNative/Modules/PaperUIManagerModule.cpp +82 -66
  103. package/Microsoft.ReactNative/ReactHost/ReactInstanceWin.cpp +14 -5
  104. package/Microsoft.ReactNative/ReactInstanceSettings.idl +3 -1
  105. package/Microsoft.ReactNative/ReactPointerEventArgs.cpp +37 -0
  106. package/Microsoft.ReactNative/ReactPointerEventArgs.h +28 -0
  107. package/Microsoft.ReactNative/ReactPointerEventArgs.idl +67 -0
  108. package/Microsoft.ReactNative/ReactRootView.cpp +28 -3
  109. package/Microsoft.ReactNative/ReactRootView.h +6 -0
  110. package/Microsoft.ReactNative/Utils/TextTransform.h +1 -1
  111. package/Microsoft.ReactNative/Utils/XamlIslandUtils.cpp +24 -10
  112. package/Microsoft.ReactNative/Utils/XamlIslandUtils.h +4 -2
  113. package/Microsoft.ReactNative/Version.rc +2 -19
  114. package/Microsoft.ReactNative/Views/DevMenu.cpp +0 -1
  115. package/Microsoft.ReactNative/Views/FlyoutViewManager.cpp +57 -2
  116. package/Microsoft.ReactNative/Views/FrameworkElementTransferProperties.cpp +3 -0
  117. package/Microsoft.ReactNative/Views/FrameworkElementViewManager.cpp +7 -2
  118. package/Microsoft.ReactNative/Views/Image/ImageViewManager.cpp +16 -6
  119. package/Microsoft.ReactNative/Views/Image/ReactImage.cpp +18 -11
  120. package/Microsoft.ReactNative/Views/Image/ReactImage.h +3 -1
  121. package/Microsoft.ReactNative/Views/RawTextViewManager.cpp +4 -53
  122. package/Microsoft.ReactNative/Views/RawTextViewManager.h +0 -3
  123. package/Microsoft.ReactNative/Views/RootViewManager.cpp +8 -9
  124. package/Microsoft.ReactNative/Views/ShadowNodeBase.h +5 -0
  125. package/Microsoft.ReactNative/Views/Text/TextHighlighterVisitor.cpp +52 -0
  126. package/Microsoft.ReactNative/Views/Text/TextHighlighterVisitor.h +37 -0
  127. package/Microsoft.ReactNative/Views/Text/TextHitTestUtils.cpp +343 -0
  128. package/Microsoft.ReactNative/Views/Text/TextHitTestUtils.h +13 -0
  129. package/Microsoft.ReactNative/Views/Text/TextHitTestVisitor.cpp +76 -0
  130. package/Microsoft.ReactNative/Views/Text/TextHitTestVisitor.h +32 -0
  131. package/Microsoft.ReactNative/Views/Text/TextParentVisitor.cpp +12 -0
  132. package/Microsoft.ReactNative/Views/Text/TextParentVisitor.h +19 -0
  133. package/Microsoft.ReactNative/Views/Text/TextPropertyChangedParentVisitor.cpp +80 -0
  134. package/Microsoft.ReactNative/Views/Text/TextPropertyChangedParentVisitor.h +43 -0
  135. package/Microsoft.ReactNative/Views/Text/TextTransformParentVisitor.cpp +21 -0
  136. package/Microsoft.ReactNative/Views/Text/TextTransformParentVisitor.h +23 -0
  137. package/Microsoft.ReactNative/Views/Text/TextTransformVisitor.cpp +70 -0
  138. package/Microsoft.ReactNative/Views/Text/TextTransformVisitor.h +34 -0
  139. package/Microsoft.ReactNative/Views/Text/TextVisitor.cpp +56 -0
  140. package/Microsoft.ReactNative/Views/Text/TextVisitor.h +34 -0
  141. package/Microsoft.ReactNative/Views/Text/TextVisitorScope.h +35 -0
  142. package/Microsoft.ReactNative/Views/Text/TextVisitors.h +47 -0
  143. package/Microsoft.ReactNative/Views/TextViewManager.cpp +112 -103
  144. package/Microsoft.ReactNative/Views/TextViewManager.h +6 -12
  145. package/Microsoft.ReactNative/Views/TouchEventHandler.cpp +171 -129
  146. package/Microsoft.ReactNative/Views/TouchEventHandler.h +19 -15
  147. package/Microsoft.ReactNative/Views/ViewManagerBase.cpp +31 -0
  148. package/Microsoft.ReactNative/Views/ViewManagerBase.h +2 -0
  149. package/Microsoft.ReactNative/Views/ViewViewManager.cpp +0 -5
  150. package/Microsoft.ReactNative/Views/VirtualTextViewManager.cpp +21 -91
  151. package/Microsoft.ReactNative/Views/VirtualTextViewManager.h +5 -8
  152. package/Microsoft.ReactNative/XamlView.h +3 -3
  153. package/Microsoft.ReactNative/packages.config +1 -1
  154. package/Microsoft.ReactNative.Cxx/NativeModules.h +114 -0
  155. package/Microsoft.ReactNative.Cxx/VersionMacros.h +19 -0
  156. package/PropertySheets/External/Microsoft.ReactNative.Common.props +2 -0
  157. package/PropertySheets/External/Microsoft.ReactNative.Uwp.CppApp.props +1 -0
  158. package/PropertySheets/External/Microsoft.ReactNative.Uwp.CppLib.props +1 -0
  159. package/PropertySheets/Generated/PackageVersion.g.props +19 -0
  160. package/PropertySheets/JSEngine.props +0 -3
  161. package/PropertySheets/PackageVersionDefinitions.props +28 -0
  162. package/PropertySheets/React.Cpp.props +0 -1
  163. package/PropertySheets/WinUI.props +1 -1
  164. package/Scripts/Microsoft.ReactNative.Managed.nuspec +1 -1
  165. package/Scripts/Microsoft.ReactNative.targets +1 -1
  166. package/Scripts/copyRNLibraries.js +12 -0
  167. package/Scripts/rnw-dependencies.ps1 +25 -24
  168. package/Shared/HermesSamplingProfiler.cpp +5 -25
  169. package/Shared/HermesShim.cpp +34 -8
  170. package/Shared/Modules/PlatformConstantsModule.cpp +1 -15
  171. package/Shared/OInstance.cpp +6 -10
  172. package/Shared/Shared.vcxitems +4 -12
  173. package/Shared/Utils.cpp +58 -0
  174. package/Shared/Utils.h +3 -0
  175. package/codegen/NativeAccessibilityInfoSpec.g.h +9 -9
  176. package/codegen/NativeAccessibilityManagerSpec.g.h +49 -21
  177. package/codegen/NativeActionSheetManagerSpec.g.h +62 -6
  178. package/codegen/NativeAlertManagerSpec.g.h +4 -4
  179. package/codegen/NativeAnimatedModuleSpec.g.h +10 -10
  180. package/codegen/NativeAnimatedTurboModuleSpec.g.h +10 -10
  181. package/codegen/NativeAppStateSpec.g.h +25 -3
  182. package/codegen/NativeAppearanceSpec.g.h +3 -3
  183. package/codegen/NativeAsyncLocalStorageSpec.g.h +66 -18
  184. package/codegen/NativeAsyncSQLiteDBStorageSpec.g.h +66 -18
  185. package/codegen/NativeBlobModuleSpec.g.h +24 -6
  186. package/codegen/NativeBugReportingSpec.g.h +3 -3
  187. package/codegen/NativeDatePickerAndroidSpec.g.h +3 -3
  188. package/codegen/NativeDevLoadingViewSpec.g.h +3 -3
  189. package/codegen/NativeDeviceInfoSpec.g.h +18 -0
  190. package/codegen/NativeDialogManagerAndroidSpec.g.h +28 -4
  191. package/codegen/NativeDialogManagerWindowsSpec.g.h +77 -0
  192. package/codegen/NativeExceptionsManagerSpec.g.h +11 -11
  193. package/codegen/NativeFileReaderModuleSpec.g.h +6 -6
  194. package/codegen/NativeFrameRateLoggerSpec.g.h +11 -3
  195. package/codegen/NativeI18nManagerSpec.g.h +20 -0
  196. package/codegen/NativeImageEditorSpec.g.h +30 -6
  197. package/codegen/NativeImageLoaderAndroidSpec.g.h +6 -6
  198. package/codegen/NativeImageLoaderIOSSpec.g.h +6 -6
  199. package/codegen/NativeImagePickerIOSSpec.g.h +28 -12
  200. package/codegen/NativeImageStoreAndroidSpec.g.h +3 -3
  201. package/codegen/NativeImageStoreIOSSpec.g.h +21 -9
  202. package/codegen/NativeIntentAndroidSpec.g.h +3 -3
  203. package/codegen/NativeJSCHeapCaptureSpec.g.h +3 -3
  204. package/codegen/NativeJSCSamplingProfilerSpec.g.h +3 -3
  205. package/codegen/NativeJSDevSupportSpec.g.h +18 -0
  206. package/codegen/NativeNetworkingAndroidSpec.g.h +6 -6
  207. package/codegen/NativeNetworkingIOSSpec.g.h +26 -6
  208. package/codegen/NativePermissionsAndroidSpec.g.h +3 -3
  209. package/codegen/NativePlatformConstantsAndroidSpec.g.h +48 -0
  210. package/codegen/NativePlatformConstantsIOSSpec.g.h +38 -0
  211. package/codegen/NativePlatformConstantsWinSpec.g.h +32 -0
  212. package/codegen/NativePushNotificationManagerIOSSpec.g.h +35 -25
  213. package/codegen/NativeRedBoxSpec.g.h +3 -3
  214. package/codegen/NativeSampleTurboModuleSpec.g.h +32 -12
  215. package/codegen/NativeSegmentFetcherSpec.g.h +6 -6
  216. package/codegen/NativeSettingsManagerSpec.g.h +22 -6
  217. package/codegen/NativeShareModuleSpec.g.h +11 -3
  218. package/codegen/NativeSourceCodeSpec.g.h +16 -0
  219. package/codegen/NativeStatusBarManagerAndroidSpec.g.h +21 -3
  220. package/codegen/NativeStatusBarManagerIOSSpec.g.h +30 -6
  221. package/codegen/NativeToastAndroidSpec.g.h +24 -0
  222. package/codegen/NativeUIManagerSpec.g.h +63 -63
  223. package/codegen/NativeVibrationSpec.g.h +3 -3
  224. package/codegen/NativeWebSocketModuleSpec.g.h +9 -3
  225. package/index.js +15 -10
  226. package/index.windows.js +15 -10
  227. package/jest/mockModal.js +31 -0
  228. package/jest/setup.js +5 -3
  229. package/just-task.js +2 -1
  230. package/package.json +23 -20
  231. package/rntypes/BatchedBridge.d.ts +23 -0
  232. package/rntypes/Devtools.d.ts +20 -0
  233. package/rntypes/LaunchScreen.d.ts +9 -0
  234. package/rntypes/globals.d.ts +496 -0
  235. package/rntypes/index.d.ts +9966 -0
  236. package/rntypes/legacy-properties.d.ts +266 -0
  237. package/template/cpp-app/proj/MyApp.vcxproj +0 -5
  238. package/template/cpp-app/src/pch.h +1 -0
  239. package/template/cpp-lib/src/pch.h +3 -0
  240. package/template/cs-app/proj/MyApp.csproj +0 -6
  241. package/template/metro.config.js +8 -1
  242. package/template/metro.devMode.config.js +3 -1
  243. package/typings-index.d.ts +2 -1
  244. package/typings-index.js +7 -5
  245. package/typings-index.js.map +1 -1
  246. package/Libraries/Components/DatePickerAndroid/DatePickerAndroid.android.js +0 -87
  247. package/Libraries/Components/DatePickerAndroid/DatePickerAndroid.ios.js +0 -30
  248. package/Libraries/Components/DatePickerAndroid/DatePickerAndroid.windows.js +0 -30
  249. package/Libraries/Components/DatePickerAndroid/DatePickerAndroidTypes.js +0 -30
  250. package/Libraries/Components/StaticContainer.react.js +0 -51
  251. package/Libraries/Components/Touchable/ensurePositiveDelayProps.js +0 -25
  252. package/Libraries/Interaction/InteractionMixin.js +0 -54
  253. package/Libraries/ReactNative/queryLayoutByID.js +0 -58
  254. package/template/cpp-app/keys/MyApp_TemporaryKey.pfx +0 -0
  255. package/template/cs-app/keys/MyApp_TemporaryKey.pfx +0 -0
@@ -0,0 +1,70 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT License.
3
+
4
+ #include "TextTransformVisitor.h"
5
+ #include <UI.Xaml.Documents.h>
6
+ #include <Utils/TransformableText.h>
7
+ #include <Views/RawTextViewManager.h>
8
+ #include <Views/TextViewManager.h>
9
+ #include <Views/VirtualTextViewManager.h>
10
+ #include "TextVisitorScope.h"
11
+
12
+ namespace winrt {
13
+ using namespace xaml::Documents;
14
+ } // namespace winrt
15
+
16
+ namespace Microsoft::ReactNative {
17
+
18
+ void TextTransformVisitor::VisitRawText(ShadowNodeBase *node) {
19
+ const auto rawTextNode = static_cast<RawTextShadowNode *>(node);
20
+ auto originalText = rawTextNode->originalText;
21
+ auto run = node->GetView().as<winrt::Run>();
22
+ // Set originalText on the raw text node if it hasn't been set yet
23
+ if (originalText.size() == 0) {
24
+ // Lazily setting original text to avoid keeping two copies of all raw text strings
25
+ originalText = run.Text();
26
+ rawTextNode->originalText = originalText;
27
+ }
28
+
29
+ run.Text(TransformableText::TransformText(originalText, m_textTransforms.top()));
30
+
31
+ if (std::wcscmp(originalText.c_str(), run.Text().c_str()) == 0) {
32
+ // If the transformed text is the same as the original, we no longer need a second copy
33
+ rawTextNode->originalText = winrt::hstring{};
34
+ }
35
+ }
36
+
37
+ void TextTransformVisitor::VisitText(ShadowNodeBase *node) {
38
+ const auto transform = TextViewManager::GetTextTransformValue(node);
39
+ if (ShouldApplyTransform(transform)) {
40
+ TextVisitorScope<TextTransform> scope{m_textTransforms, transform};
41
+ Super::VisitText(node);
42
+ }
43
+ }
44
+
45
+ void TextTransformVisitor::VisitVirtualText(ShadowNodeBase *node) {
46
+ const auto textNode = static_cast<VirtualTextShadowNode *>(node);
47
+ const auto transform = textNode->textTransform;
48
+ if (ShouldApplyTransform(transform)) {
49
+ TextVisitorScope<TextTransform> scope{m_textTransforms, transform};
50
+ Super::VisitVirtualText(node);
51
+ }
52
+ }
53
+
54
+ bool TextTransformVisitor::ShouldApplyTransform(TextTransform transform) {
55
+ // If the visitor is applied in the context of a textTransfrom prop value
56
+ // change, the m_forceUpdate flag is set to true.
57
+ if (m_forceUpdate) {
58
+ // When the textTransform prop changes, only recurse if at the root node
59
+ // or if the current node is has an undefined textTransform.
60
+ return m_textTransforms.size() == 1 || transform == TextTransform::Undefined;
61
+ } else {
62
+ // When a node is added to the tree, only recurse if the added node is has
63
+ // an undefined textTransform and the parent is not "none" or undefined.
64
+ const auto parentTransform = m_textTransforms.top();
65
+ return parentTransform != TextTransform::Undefined && parentTransform != TextTransform::None &&
66
+ transform == TextTransform::Undefined;
67
+ }
68
+ }
69
+
70
+ } // namespace Microsoft::ReactNative
@@ -0,0 +1,34 @@
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 TextTransformVisitor : public TextVisitor {
13
+ using Super = TextVisitor;
14
+
15
+ public:
16
+ TextTransformVisitor(TextTransform parentTransform, bool forceUpdate) : Super(), m_forceUpdate{forceUpdate} {
17
+ m_textTransforms.push(parentTransform);
18
+ }
19
+
20
+ protected:
21
+ void VisitRawText(ShadowNodeBase *node) override;
22
+
23
+ void VisitText(ShadowNodeBase *node) override;
24
+
25
+ void VisitVirtualText(ShadowNodeBase *node) override;
26
+
27
+ private:
28
+ std::stack<TextTransform> m_textTransforms;
29
+ bool m_forceUpdate;
30
+
31
+ bool ShouldApplyTransform(TextTransform transform);
32
+ };
33
+
34
+ } // namespace Microsoft::ReactNative
@@ -0,0 +1,56 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT License.
3
+
4
+ #include "TextVisitor.h"
5
+ #include <Utils/ShadowNodeTypeUtils.h>
6
+
7
+ namespace Microsoft::ReactNative {
8
+
9
+ void TextVisitor::Visit(ShadowNode *node) {
10
+ if (!node || !EnsureNativeUIManager(node))
11
+ return;
12
+
13
+ const auto baseNode = static_cast<ShadowNodeBase *>(node);
14
+ if (IsTextShadowNode(baseNode)) {
15
+ VisitText(baseNode);
16
+ } else if (IsVirtualTextShadowNode(baseNode)) {
17
+ VisitVirtualText(baseNode);
18
+ } else if (IsRawTextShadowNode(baseNode)) {
19
+ VisitRawText(baseNode);
20
+ } else {
21
+ VisitCore(baseNode);
22
+ }
23
+ }
24
+
25
+ void TextVisitor::VisitCore(ShadowNodeBase *node) {
26
+ for (auto childTag : node->m_children) {
27
+ Visit(GetShadowNode(childTag));
28
+ }
29
+ }
30
+
31
+ void TextVisitor::VisitRawText(ShadowNodeBase *node) {
32
+ VisitCore(node);
33
+ }
34
+
35
+ void TextVisitor::VisitText(ShadowNodeBase *node) {
36
+ VisitCore(node);
37
+ }
38
+
39
+ void TextVisitor::VisitVirtualText(ShadowNodeBase *node) {
40
+ VisitCore(node);
41
+ }
42
+
43
+ ShadowNode *TextVisitor::GetShadowNode(int64_t tag) {
44
+ return m_uiManager->getHost()->FindShadowNodeForTag(tag);
45
+ }
46
+
47
+ std::shared_ptr<NativeUIManager> TextVisitor::EnsureNativeUIManager(ShadowNode *node) {
48
+ if (!m_uiManager) {
49
+ const auto baseNode = static_cast<ShadowNodeBase *>(node);
50
+ m_uiManager = GetNativeUIManager(baseNode->GetViewManager()->GetReactContext()).lock();
51
+ }
52
+
53
+ return m_uiManager;
54
+ }
55
+
56
+ } // namespace Microsoft::ReactNative
@@ -0,0 +1,34 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT License.
3
+
4
+ #pragma once
5
+
6
+ #include <Modules/NativeUIManager.h>
7
+ #include <Modules/PaperUIManagerModule.h>
8
+ #include <UI.Xaml.Documents.h>
9
+ #include <Views/ShadowNodeBase.h>
10
+
11
+ namespace Microsoft::ReactNative {
12
+
13
+ class TextVisitor {
14
+ public:
15
+ void Visit(ShadowNode *node);
16
+
17
+ protected:
18
+ virtual void VisitCore(ShadowNodeBase *node);
19
+
20
+ virtual void VisitRawText(ShadowNodeBase *node);
21
+
22
+ virtual void VisitText(ShadowNodeBase *node);
23
+
24
+ virtual void VisitVirtualText(ShadowNodeBase *node);
25
+
26
+ ShadowNode *GetShadowNode(int64_t tag);
27
+
28
+ private:
29
+ std::shared_ptr<NativeUIManager> m_uiManager;
30
+
31
+ std::shared_ptr<NativeUIManager> EnsureNativeUIManager(ShadowNode *node);
32
+ };
33
+
34
+ }; // namespace Microsoft::ReactNative
@@ -0,0 +1,35 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT License.
3
+
4
+ #pragma once
5
+
6
+ #include <stack>
7
+
8
+ namespace Microsoft::ReactNative {
9
+
10
+ template <class T>
11
+ struct TextVisitorScope {
12
+ TextVisitorScope(std::stack<T> &stack, T scopedValue) : m_stack{stack} {
13
+ // There's an assumption here that the scoped value should not be pushed if
14
+ // it has a default value. Check this assumption for future usages.
15
+ if (scopedValue != T{}) {
16
+ m_stack.push(scopedValue);
17
+ m_pushed = true;
18
+ }
19
+ }
20
+
21
+ ~TextVisitorScope() {
22
+ if (m_pushed) {
23
+ m_stack.pop();
24
+ }
25
+ }
26
+
27
+ TextVisitorScope(TextVisitorScope const &) = delete;
28
+ TextVisitorScope &operator=(TextVisitorScope other) = delete;
29
+
30
+ private:
31
+ std::stack<T> &m_stack;
32
+ bool m_pushed{false};
33
+ };
34
+
35
+ } // namespace Microsoft::ReactNative
@@ -0,0 +1,47 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT License.
3
+
4
+ #pragma once
5
+
6
+ #include "TextHighlighterVisitor.h"
7
+ #include "TextHitTestVisitor.h"
8
+ #include "TextPropertyChangedParentVisitor.h"
9
+ #include "TextTransformParentVisitor.h"
10
+ #include "TextTransformVisitor.h"
11
+
12
+ namespace Microsoft::ReactNative {
13
+ using Color = std::optional<winrt::Windows::UI::Color>;
14
+
15
+ static inline std::vector<xaml::Documents::TextHighlighter>
16
+ GetNestedTextHighlighters(ShadowNode *node, Color foregroundColor, Color backgroundColor) {
17
+ TextHighlighterVisitor visitor{foregroundColor, backgroundColor};
18
+ visitor.Visit(node);
19
+ return visitor.highlighters;
20
+ }
21
+
22
+ static inline void ApplyTextTransformToChild(ShadowNode *node) {
23
+ TextTransformParentVisitor parentVisitor;
24
+ parentVisitor.Visit(node);
25
+ TextTransformVisitor visitor{parentVisitor.textTransform, false};
26
+ visitor.Visit(node);
27
+ }
28
+
29
+ static inline void
30
+ HitTest(ShadowNode *node, winrt::Microsoft::ReactNative::ReactPointerEventArgs const &args, winrt::Point const &point) {
31
+ TextHitTestVisitor visitor{args, point};
32
+ visitor.Visit(node);
33
+ }
34
+
35
+ static inline void UpdateTextTransformForChildren(ShadowNode *node) {
36
+ TextTransformParentVisitor parentVisitor;
37
+ parentVisitor.Visit(node);
38
+ TextTransformVisitor visitor{parentVisitor.textTransform, true};
39
+ visitor.Visit(node);
40
+ }
41
+
42
+ static inline void NotifyAncestorsTextPropertyChanged(ShadowNode *node, PropertyChangeType type) {
43
+ TextPropertyChangedParentVisitor visitor{type};
44
+ visitor.Visit(node);
45
+ }
46
+
47
+ } // namespace Microsoft::ReactNative
@@ -4,23 +4,28 @@
4
4
  #include "pch.h"
5
5
 
6
6
  #include "TextViewManager.h"
7
+ #include "TouchEventHandler.h"
7
8
  #include "Utils/ShadowNodeTypeUtils.h"
8
9
  #include "Utils/XamlIslandUtils.h"
9
10
 
10
- #include <Modules/NativeUIManager.h>
11
- #include <Modules/PaperUIManagerModule.h>
12
- #include <Views/RawTextViewManager.h>
13
11
  #include <Views/ShadowNodeBase.h>
12
+ #include <Views/Text/TextVisitors.h>
14
13
  #include <Views/VirtualTextViewManager.h>
15
14
 
15
+ #include <UI.Input.h>
16
16
  #include <UI.Xaml.Automation.Peers.h>
17
17
  #include <UI.Xaml.Automation.h>
18
18
  #include <UI.Xaml.Controls.h>
19
19
  #include <UI.Xaml.Documents.h>
20
+ #include <UI.Xaml.Input.h>
20
21
  #include <Utils/PropertyUtils.h>
21
22
  #include <Utils/TransformableText.h>
22
23
  #include <Utils/ValueUtils.h>
23
24
 
25
+ #ifdef USE_WINUI3
26
+ #include <winrt/Microsoft.UI.Input.Experimental.h>
27
+ #endif
28
+
24
29
  namespace winrt {
25
30
  using namespace xaml::Documents;
26
31
  using namespace xaml::Automation;
@@ -36,10 +41,12 @@ class TextShadowNode final : public ShadowNodeBase {
36
41
  private:
37
42
  ShadowNode *m_firstChildNode;
38
43
 
44
+ bool m_hasDescendantTextHighlighter{false};
45
+ bool m_hasDescendantPressable{false};
39
46
  std::optional<winrt::Windows::UI::Color> m_backgroundColor{};
40
47
  std::optional<winrt::Windows::UI::Color> m_foregroundColor{};
41
-
42
- int32_t m_prevCursorEnd = 0;
48
+ std::unique_ptr<TouchEventHandler> m_touchEventHandler = nullptr;
49
+ winrt::event_revoker<xaml::Controls::ITextBlock> m_selectionChangedRevoker;
43
50
 
44
51
  public:
45
52
  TextShadowNode() {
@@ -51,12 +58,12 @@ class TextShadowNode final : public ShadowNodeBase {
51
58
 
52
59
  void AddView(ShadowNode &child, int64_t index) override {
53
60
  auto &childNode = static_cast<ShadowNodeBase &>(child);
54
- VirtualTextShadowNode::ApplyTextTransform(
55
- childNode, textTransform, /* forceUpdate = */ false, /* isRoot = */ false);
61
+ ApplyTextTransformToChild(&child);
56
62
 
57
63
  if (IsVirtualTextShadowNode(&childNode)) {
58
64
  auto &textChildNode = static_cast<VirtualTextShadowNode &>(childNode);
59
- m_hasDescendantBackgroundColor |= textChildNode.m_hasDescendantBackgroundColor;
65
+ m_hasDescendantTextHighlighter |= textChildNode.hasDescendantTextHighlighter;
66
+ m_hasDescendantPressable |= textChildNode.hasDescendantPressable;
60
67
  }
61
68
 
62
69
  auto addInline = true;
@@ -66,7 +73,6 @@ class TextShadowNode final : public ShadowNodeBase {
66
73
  m_firstChildNode = &child;
67
74
  auto textBlock = this->GetView().as<xaml::Controls::TextBlock>();
68
75
  textBlock.Text(run.Text());
69
- m_prevCursorEnd += textBlock.Text().size();
70
76
  addInline = false;
71
77
  }
72
78
  } else if (index == 1 && m_firstChildNode != nullptr) {
@@ -84,16 +90,24 @@ class TextShadowNode final : public ShadowNodeBase {
84
90
  }
85
91
 
86
92
  void removeAllChildren() override {
87
- m_firstChildNode = nullptr;
88
- Super::removeAllChildren();
93
+ if (m_firstChildNode) {
94
+ auto textBlock = this->GetView().as<xaml::Controls::TextBlock>();
95
+ textBlock.ClearValue(xaml::Controls::TextBlock::TextProperty());
96
+ m_firstChildNode = nullptr;
97
+ } else {
98
+ Super::removeAllChildren();
99
+ }
89
100
  RecalculateTextHighlighters();
90
101
  }
91
102
 
92
103
  void RemoveChildAt(int64_t indexToRemove) override {
93
- if (indexToRemove == 0) {
104
+ if (indexToRemove == 0 && m_firstChildNode) {
105
+ auto textBlock = this->GetView().as<xaml::Controls::TextBlock>();
106
+ textBlock.ClearValue(xaml::Controls::TextBlock::TextProperty());
94
107
  m_firstChildNode = nullptr;
108
+ } else {
109
+ Super::RemoveChildAt(indexToRemove);
95
110
  }
96
- Super::RemoveChildAt(indexToRemove);
97
111
  RecalculateTextHighlighters();
98
112
  }
99
113
 
@@ -101,92 +115,70 @@ class TextShadowNode final : public ShadowNodeBase {
101
115
  const auto textBlock = this->GetView().as<xaml::Controls::TextBlock>();
102
116
  textBlock.TextHighlighters().Clear();
103
117
 
104
- auto nestedIndex = 0;
105
- if (m_hasDescendantBackgroundColor) {
106
- const auto highlighterCount = textBlock.TextHighlighters().Size();
107
- if (const auto uiManager = GetNativeUIManager(GetViewManager()->GetReactContext()).lock()) {
108
- for (auto childTag : m_children) {
109
- if (const auto childNode = uiManager->getHost()->FindShadowNodeForTag(childTag)) {
110
- nestedIndex = AddNestedTextHighlighter(
111
- m_backgroundColor, m_foregroundColor, static_cast<ShadowNodeBase *>(childNode), nestedIndex);
112
- }
118
+ // Since TextShadowNode is not public, we lift some of the recursive
119
+ // algorithm into the shadow node implementation to detect when no
120
+ // descendants have background colors and we can skip recursion.
121
+ if (m_hasDescendantTextHighlighter) {
122
+ const auto highlighters = GetNestedTextHighlighters(this, m_foregroundColor, m_backgroundColor);
123
+ if (highlighters.size() == 0) {
124
+ m_hasDescendantTextHighlighter = false;
125
+ } else {
126
+ // We must add the highlighters in reverse order, as highlighters
127
+ // "deeper" in the text tree should render at the top.
128
+ auto iter = highlighters.rbegin();
129
+ while (iter != highlighters.rend()) {
130
+ textBlock.TextHighlighters().Append(*iter);
131
+ ++iter;
113
132
  }
114
133
  }
115
-
116
- if (textBlock.TextHighlighters().Size() == 0) {
117
- m_hasDescendantBackgroundColor = false;
118
- }
119
- } else {
120
- nestedIndex = textBlock.Text().size();
121
134
  }
122
135
 
123
136
  if (m_backgroundColor) {
124
137
  winrt::TextHighlighter highlighter{};
125
- highlighter.Ranges().Append({0, nestedIndex});
138
+ highlighter.Ranges().Append({0, static_cast<int32_t>(textBlock.Text().size())});
126
139
  highlighter.Background(SolidBrushFromColor(m_backgroundColor.value()));
127
140
  if (m_foregroundColor) {
128
141
  highlighter.Foreground(SolidBrushFromColor(m_foregroundColor.value()));
129
142
  }
130
- GetView().as<xaml::Controls::TextBlock>().TextHighlighters().InsertAt(0, highlighter);
143
+ textBlock.TextHighlighters().InsertAt(0, highlighter);
131
144
  }
132
145
  }
133
146
 
134
- int AddNestedTextHighlighter(
135
- const std::optional<winrt::Windows::UI::Color> &backgroundColor,
136
- const std::optional<winrt::Windows::UI::Color> &foregroundColor,
137
- ShadowNodeBase *node,
138
- int startIndex) {
139
- if (const auto run = node->GetView().try_as<winrt::Run>()) {
140
- return startIndex + run.Text().size();
141
- } else if (const auto span = node->GetView().try_as<winrt::Span>()) {
142
- const auto textBlock = GetView().as<xaml::Controls::TextBlock>();
143
- winrt::TextHighlighter highlighter{nullptr};
144
- auto parentBackgroundColor = backgroundColor;
145
- auto parentForegroundColor = foregroundColor;
146
- if (IsVirtualTextShadowNode(node)) {
147
- const auto virtualTextNode = static_cast<VirtualTextShadowNode *>(node);
148
- const auto requiresHighlighter =
149
- virtualTextNode->m_backgroundColor || (backgroundColor && virtualTextNode->m_foregroundColor);
150
- if (requiresHighlighter) {
151
- highlighter = {};
152
- parentBackgroundColor =
153
- virtualTextNode->m_backgroundColor ? virtualTextNode->m_backgroundColor : parentBackgroundColor;
154
- parentForegroundColor =
155
- virtualTextNode->m_foregroundColor ? virtualTextNode->m_foregroundColor : parentForegroundColor;
156
- highlighter.Background(SolidBrushFromColor(parentBackgroundColor.value()));
157
- if (parentForegroundColor) {
158
- highlighter.Foreground(SolidBrushFromColor(parentForegroundColor.value()));
159
- }
160
- }
147
+ void ToggleTouchEvents(XamlView xamlView, bool selectable) {
148
+ if (selectable) {
149
+ if (m_touchEventHandler == nullptr) {
150
+ m_touchEventHandler = std::make_unique<TouchEventHandler>(GetViewManager()->GetReactContext(), false);
161
151
  }
162
152
 
163
- const auto initialHighlighterCount = textBlock.TextHighlighters().Size();
164
- auto nestedIndex = startIndex;
165
- if (const auto uiManager = GetNativeUIManager(node->GetViewManager()->GetReactContext()).lock()) {
166
- for (auto childTag : node->m_children) {
167
- if (const auto childNode = uiManager->getHost()->FindShadowNodeForTag(childTag)) {
168
- nestedIndex = AddNestedTextHighlighter(
169
- parentBackgroundColor, parentForegroundColor, static_cast<ShadowNodeBase *>(childNode), nestedIndex);
170
- }
171
- }
172
- }
153
+ m_selectionChangedRevoker = xamlView.as<xaml::Controls::TextBlock>().SelectionChanged(
154
+ winrt::auto_revoke, [selectionChanged = this->selectionChanged](const auto &sender, auto &&) {
155
+ const auto textBlock = sender.as<xaml::Controls::TextBlock>();
156
+ *selectionChanged =
157
+ *selectionChanged || textBlock.SelectionStart().Offset() != textBlock.SelectionEnd().Offset();
158
+ });
173
159
 
174
- if (highlighter) {
175
- highlighter.Ranges().Append({startIndex, nestedIndex - startIndex});
176
- textBlock.TextHighlighters().InsertAt(0, highlighter);
177
- } else if (IsVirtualTextShadowNode(node) && textBlock.TextHighlighters().Size() == initialHighlighterCount) {
178
- const auto virtualTextNode = static_cast<VirtualTextShadowNode *>(node);
179
- virtualTextNode->m_hasDescendantBackgroundColor = false;
160
+ m_touchEventHandler->AddTouchHandlers(xamlView, GetRootView(), true);
161
+ } else {
162
+ if (m_touchEventHandler != nullptr) {
163
+ m_touchEventHandler->RemoveTouchHandlers();
164
+ m_selectionChangedRevoker.revoke();
180
165
  }
181
-
182
- return nestedIndex;
183
166
  }
167
+ }
184
168
 
185
- return 0;
169
+ XamlView GetRootView() {
170
+ if (auto uiManager = GetNativeUIManager(GetViewManager()->GetReactContext()).lock()) {
171
+ auto shadowNode = uiManager->getHost()->FindShadowNodeForTag(m_rootTag);
172
+ if (!shadowNode)
173
+ return nullptr;
174
+
175
+ return static_cast<::Microsoft::ReactNative::ShadowNodeBase *>(shadowNode)->GetView();
176
+ }
177
+ return nullptr;
186
178
  }
187
179
 
188
180
  TextTransform textTransform{TextTransform::Undefined};
189
- bool m_hasDescendantBackgroundColor{false};
181
+ std::shared_ptr<bool> selectionChanged = std::make_shared<bool>(false);
190
182
  };
191
183
 
192
184
  TextViewManager::TextViewManager(const Mso::React::IReactContext &context) : Super(context) {}
@@ -223,8 +215,7 @@ bool TextViewManager::UpdateProperty(
223
215
  } else if (propertyName == "textTransform") {
224
216
  auto textNode = static_cast<TextShadowNode *>(nodeToUpdate);
225
217
  textNode->textTransform = TransformableText::GetTextTransform(propertyValue);
226
- VirtualTextShadowNode::ApplyTextTransform(
227
- *textNode, textNode->textTransform, /* forceUpdate = */ true, /* isRoot = */ true);
218
+ UpdateTextTransformForChildren(nodeToUpdate);
228
219
  } else if (TryUpdatePadding(nodeToUpdate, textBlock, propertyName, propertyValue)) {
229
220
  } else if (TryUpdateTextAlignment(textBlock, propertyName, propertyValue)) {
230
221
  } else if (TryUpdateTextTrimming(textBlock, propertyName, propertyValue)) {
@@ -261,14 +252,17 @@ bool TextViewManager::UpdateProperty(
261
252
  textBlock.ClearValue(xaml::Controls::TextBlock::LineStackingStrategyProperty());
262
253
  }
263
254
  } else if (propertyName == "selectable") {
255
+ const auto node = static_cast<TextShadowNode *>(nodeToUpdate);
264
256
  if (propertyValue.Type() == winrt::Microsoft::ReactNative::JSValueType::Boolean) {
265
257
  const auto selectable = propertyValue.AsBoolean();
266
258
  textBlock.IsTextSelectionEnabled(selectable);
259
+ node->ToggleTouchEvents(textBlock, selectable);
267
260
  if (selectable) {
268
261
  EnsureUniqueTextFlyoutForXamlIsland(textBlock);
269
262
  }
270
263
  } else if (propertyValue.IsNull()) {
271
264
  textBlock.ClearValue(xaml::Controls::TextBlock::IsTextSelectionEnabledProperty());
265
+ node->ToggleTouchEvents(textBlock, false);
272
266
  ClearUniqueTextFlyoutForXamlIsland(textBlock);
273
267
  }
274
268
  } else if (propertyName == "allowFontScaling") {
@@ -342,38 +336,53 @@ YGMeasureFunc TextViewManager::GetYogaCustomMeasureFunc() const {
342
336
  return DefaultYogaSelfMeasureFunc;
343
337
  }
344
338
 
345
- void TextViewManager::OnDescendantTextPropertyChanged(ShadowNodeBase *node, PropertyChangeType propertyChangeType) {
346
- if (IsTextShadowNode(node)) {
347
- const auto textNode = static_cast<TextShadowNode *>(node);
348
-
349
- if ((propertyChangeType & PropertyChangeType::Text) == PropertyChangeType::Text) {
350
- const auto element = node->GetView().as<xaml::Controls::TextBlock>();
351
-
352
- // If name is set, it's controlled by accessibilityLabel, and it's already
353
- // handled in FrameworkElementViewManager. Here it only handles when name is
354
- // not set.
355
- if (xaml::Automation::AutomationProperties::GetLiveSetting(element) != winrt::AutomationLiveSetting::Off &&
356
- xaml::Automation::AutomationProperties::GetName(element).empty() &&
357
- xaml::Automation::AutomationProperties::GetAccessibilityView(element) !=
358
- winrt::Peers::AccessibilityView::Raw) {
359
- if (auto peer = xaml::Automation::Peers::FrameworkElementAutomationPeer::FromElement(element)) {
360
- peer.RaiseAutomationEvent(winrt::AutomationEvents::LiveRegionChanged);
361
- }
362
- }
339
+ void TextViewManager::OnPointerEvent(
340
+ ShadowNodeBase *node,
341
+ winrt::Microsoft::ReactNative::ReactPointerEventArgs const &args) {
342
+ const auto textNode = static_cast<TextShadowNode *>(node);
343
+ const auto textBlock = node->GetView().as<xaml::Controls::TextBlock>();
344
+ if (textNode->m_hasDescendantPressable && args.Target() == node->GetView()) {
345
+ // Set the target to null temporarily
346
+ args.Target(nullptr);
347
+
348
+ // Get the pointer point and hit test
349
+ const auto point = args.Args().GetCurrentPoint(textBlock).RawPosition();
350
+ HitTest(node, args, point);
351
+
352
+ // Set the target back to the current view if hit test failed
353
+ if (!args.Target()) {
354
+ args.Target(node->GetView());
363
355
  }
356
+ }
364
357
 
365
- // If a property change added a background color to the text tree, update
366
- // the flag to signal recursive highlighter updates are required.
367
- if ((propertyChangeType & PropertyChangeType::AddBackgroundColor) == PropertyChangeType::AddBackgroundColor) {
368
- textNode->m_hasDescendantBackgroundColor = true;
358
+ if (args.Kind() == winrt::Microsoft::ReactNative::PointerEventKind::CaptureLost) {
359
+ if (!*textNode->selectionChanged) {
360
+ args.Kind(winrt::Microsoft::ReactNative::PointerEventKind::End);
369
361
  }
362
+ *textNode->selectionChanged = false;
363
+ }
370
364
 
371
- // Recalculate text highlighters
365
+ Super::OnPointerEvent(node, args);
366
+ }
367
+
368
+ /*static*/ void TextViewManager::UpdateTextHighlighters(ShadowNodeBase *node, bool highlightAdded) {
369
+ if (IsTextShadowNode(node)) {
370
+ const auto textNode = static_cast<TextShadowNode *>(node);
371
+ if (highlightAdded) {
372
+ textNode->m_hasDescendantTextHighlighter = true;
373
+ }
372
374
  textNode->RecalculateTextHighlighters();
373
375
  }
374
376
  }
375
377
 
376
- TextTransform TextViewManager::GetTextTransformValue(ShadowNodeBase *node) {
378
+ /*static*/ void TextViewManager::SetDescendantPressable(ShadowNodeBase *node) {
379
+ if (IsTextShadowNode(node)) {
380
+ const auto textNode = static_cast<TextShadowNode *>(node);
381
+ textNode->m_hasDescendantPressable = true;
382
+ }
383
+ }
384
+
385
+ /*static*/ TextTransform TextViewManager::GetTextTransformValue(ShadowNodeBase *node) {
377
386
  if (IsTextShadowNode(node)) {
378
387
  return static_cast<TextShadowNode *>(node)->textTransform;
379
388
  }
@@ -8,14 +8,6 @@
8
8
 
9
9
  namespace Microsoft::ReactNative {
10
10
 
11
- enum class PropertyChangeType : std::uint_fast8_t {
12
- None = 0,
13
- Text = 1 << 0,
14
- AddBackgroundColor = 1 << 1,
15
- };
16
-
17
- DEFINE_ENUM_FLAG_OPERATORS(PropertyChangeType);
18
-
19
11
  class TextViewManager : public FrameworkElementViewManager {
20
12
  using Super = FrameworkElementViewManager;
21
13
 
@@ -32,11 +24,13 @@ class TextViewManager : public FrameworkElementViewManager {
32
24
 
33
25
  YGMeasureFunc GetYogaCustomMeasureFunc() const override;
34
26
 
35
- void OnDescendantTextPropertyChanged(
36
- ShadowNodeBase *node,
37
- PropertyChangeType propertyChangeType = PropertyChangeType::Text);
27
+ void OnPointerEvent(ShadowNodeBase *node, const winrt::Microsoft::ReactNative::ReactPointerEventArgs &args) override;
28
+
29
+ static void UpdateTextHighlighters(ShadowNodeBase *node, bool highlightAdded);
30
+
31
+ static void SetDescendantPressable(ShadowNodeBase *node);
38
32
 
39
- TextTransform GetTextTransformValue(ShadowNodeBase *node);
33
+ static TextTransform GetTextTransformValue(ShadowNodeBase *node);
40
34
 
41
35
  protected:
42
36
  bool UpdateProperty(