react-native-windows 0.77.0 → 0.78.0-preview.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (233) hide show
  1. package/.flowconfig +1 -1
  2. package/Chakra/ChakraTracing.cpp +1 -1
  3. package/Libraries/Animated/animations/Animation.js +22 -1
  4. package/Libraries/Animated/animations/DecayAnimation.js +1 -0
  5. package/Libraries/Animated/animations/SpringAnimation.js +1 -0
  6. package/Libraries/Animated/animations/TimingAnimation.js +1 -0
  7. package/Libraries/Animated/nodes/AnimatedAddition.js +9 -2
  8. package/Libraries/Animated/nodes/AnimatedColor.js +4 -1
  9. package/Libraries/Animated/nodes/AnimatedDiffClamp.js +10 -2
  10. package/Libraries/Animated/nodes/AnimatedDivision.js +9 -2
  11. package/Libraries/Animated/nodes/AnimatedInterpolation.js +5 -1
  12. package/Libraries/Animated/nodes/AnimatedModulo.js +5 -2
  13. package/Libraries/Animated/nodes/AnimatedMultiplication.js +9 -2
  14. package/Libraries/Animated/nodes/AnimatedNode.js +25 -46
  15. package/Libraries/Animated/nodes/AnimatedObject.js +9 -2
  16. package/Libraries/Animated/nodes/AnimatedProps.js +5 -1
  17. package/Libraries/Animated/nodes/AnimatedStyle.js +5 -1
  18. package/Libraries/Animated/nodes/AnimatedSubtraction.js +9 -2
  19. package/Libraries/Animated/nodes/AnimatedTracking.js +5 -1
  20. package/Libraries/Animated/nodes/AnimatedTransform.js +5 -1
  21. package/Libraries/Animated/nodes/AnimatedValue.js +49 -4
  22. package/Libraries/Animated/nodes/AnimatedValueXY.js +3 -1
  23. package/Libraries/Animated/useAnimatedProps.js +0 -43
  24. package/Libraries/Components/Button.windows.js +3 -0
  25. package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.d.ts +1 -1
  26. package/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.js +3 -1
  27. package/Libraries/Components/LayoutConformance/LayoutConformance.d.ts +21 -0
  28. package/Libraries/Components/LayoutConformance/LayoutConformance.js +59 -0
  29. package/Libraries/Components/LayoutConformance/LayoutConformanceNativeComponent.js +29 -0
  30. package/Libraries/Components/Pressable/Pressable.windows.js +3 -0
  31. package/Libraries/Components/TextInput/RCTTextInputViewConfig.js +1 -0
  32. package/Libraries/Components/TextInput/TextInput.d.ts +5 -0
  33. package/Libraries/Components/TextInput/TextInput.flow.js +6 -0
  34. package/Libraries/Components/TextInput/TextInput.js +6 -0
  35. package/Libraries/Components/TextInput/TextInput.windows.js +9 -0
  36. package/Libraries/Components/Touchable/TouchableBounce.windows.js +2 -0
  37. package/Libraries/Components/Touchable/TouchableNativeFeedback.windows.js +2 -0
  38. package/Libraries/Components/Touchable/TouchableOpacity.windows.js +2 -0
  39. package/Libraries/Components/Touchable/TouchableWithoutFeedback.windows.js +2 -0
  40. package/Libraries/Components/View/View.windows.js +3 -0
  41. package/Libraries/Components/View/ViewAccessibility.d.ts +7 -2
  42. package/Libraries/Components/View/ViewAccessibility.windows.js +1 -0
  43. package/Libraries/Components/View/ViewPropTypes.d.ts +0 -7
  44. package/Libraries/Components/View/ViewPropTypes.js +0 -9
  45. package/Libraries/Components/View/ViewPropTypes.windows.js +1 -9
  46. package/Libraries/Core/ReactNativeVersion.js +2 -2
  47. package/Libraries/Core/setUpBatchedBridge.js +1 -16
  48. package/Libraries/EventEmitter/RCTEventEmitter.js +2 -6
  49. package/Libraries/Image/AssetSourceResolver.js +11 -0
  50. package/Libraries/Image/AssetSourceResolver.windows.js +11 -0
  51. package/Libraries/Image/Image.windows.js +2 -0
  52. package/Libraries/Inspector/BorderBox.js +26 -14
  53. package/Libraries/Inspector/BoxInspector.js +60 -42
  54. package/Libraries/Inspector/ElementBox.js +55 -48
  55. package/Libraries/Inspector/StyleInspector.js +36 -30
  56. package/Libraries/LayoutAnimation/LayoutAnimation.js +2 -2
  57. package/Libraries/Lists/FlatList.d.ts +1 -1
  58. package/Libraries/Modal/Modal.js +2 -0
  59. package/Libraries/Modal/Modal.windows.js +2 -0
  60. package/Libraries/NativeComponent/BaseViewConfig.android.js +0 -2
  61. package/Libraries/NativeComponent/BaseViewConfig.ios.js +0 -2
  62. package/Libraries/NativeComponent/BaseViewConfig.windows.js +0 -2
  63. package/Libraries/Network/RCTNetworking.android.js +24 -16
  64. package/Libraries/Network/RCTNetworking.ios.js +1 -46
  65. package/Libraries/Network/RCTNetworking.windows.js +1 -46
  66. package/Libraries/Network/RCTNetworkingEventDefinitions.flow.js +57 -0
  67. package/Libraries/ReactNative/UIManagerProperties.js +3 -1
  68. package/Libraries/Renderer/implementations/ReactFabric-dev.js +15828 -26461
  69. package/Libraries/Renderer/implementations/ReactFabric-prod.js +3907 -2560
  70. package/Libraries/Renderer/implementations/ReactFabric-profiling.js +4399 -2878
  71. package/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js +16102 -26908
  72. package/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js +4034 -2695
  73. package/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.js +4535 -3045
  74. package/Libraries/Renderer/shims/ReactNativeTypes.js +5 -6
  75. package/Libraries/StyleSheet/processTransform.js +6 -0
  76. package/Libraries/Text/Text.d.ts +6 -1
  77. package/Libraries/Text/Text.windows.js +4 -0
  78. package/Libraries/Text/TextProps.js +2 -2
  79. package/Libraries/Text/TextProps.windows.js +3 -2
  80. package/Libraries/Utilities/BackHandler.android.js +5 -4
  81. package/Libraries/Utilities/BackHandler.ios.js +4 -5
  82. package/Libraries/Utilities/BackHandler.windows.js +5 -4
  83. package/Microsoft.ReactNative/CompositionComponentView.idl +13 -1
  84. package/Microsoft.ReactNative/Fabric/ComponentView.cpp +0 -1
  85. package/Microsoft.ReactNative/Fabric/Composition/ComponentViewRegistry.cpp +0 -5
  86. package/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.cpp +92 -17
  87. package/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.h +9 -0
  88. package/Microsoft.ReactNative/Fabric/Composition/CompositionEventHandler.cpp +13 -33
  89. package/Microsoft.ReactNative/Fabric/Composition/CompositionEventHandler.h +1 -3
  90. package/Microsoft.ReactNative/Fabric/Composition/CompositionRootAutomationProvider.cpp +43 -5
  91. package/Microsoft.ReactNative/Fabric/Composition/CompositionRootAutomationProvider.h +2 -1
  92. package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.cpp +12 -10
  93. package/Microsoft.ReactNative/Fabric/Composition/ContentIslandComponentView.cpp +11 -9
  94. package/Microsoft.ReactNative/Fabric/Composition/ContentIslandComponentView.h +1 -1
  95. package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewComponentView.cpp +191 -329
  96. package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewComponentView.h +3 -61
  97. package/Microsoft.ReactNative/Fabric/Composition/PortalComponentView.cpp +66 -0
  98. package/Microsoft.ReactNative/Fabric/Composition/PortalComponentView.h +52 -0
  99. package/Microsoft.ReactNative/Fabric/Composition/ReactCompositionViewComponentBuilder.cpp +21 -0
  100. package/Microsoft.ReactNative/Fabric/Composition/ReactCompositionViewComponentBuilder.h +7 -4
  101. package/Microsoft.ReactNative/Fabric/Composition/ReactNativeIsland.cpp +79 -19
  102. package/Microsoft.ReactNative/Fabric/Composition/ReactNativeIsland.h +12 -6
  103. package/Microsoft.ReactNative/Fabric/Composition/RootComponentView.cpp +71 -17
  104. package/Microsoft.ReactNative/Fabric/Composition/RootComponentView.h +16 -0
  105. package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentDescriptor.h +5 -10
  106. package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.cpp +4 -4
  107. package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputShadowNode.cpp +138 -110
  108. package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputShadowNode.h +27 -27
  109. package/Microsoft.ReactNative/Fabric/Composition/Theme.cpp +1 -1
  110. package/Microsoft.ReactNative/Fabric/Composition/UiaHelpers.cpp +38 -33
  111. package/Microsoft.ReactNative/Fabric/Composition/UiaHelpers.h +0 -2
  112. package/Microsoft.ReactNative/Fabric/FabricUIManagerModule.cpp +5 -16
  113. package/Microsoft.ReactNative/Fabric/FabricUIManagerModule.h +0 -3
  114. package/Microsoft.ReactNative/Fabric/ImageManager.cpp +9 -0
  115. package/Microsoft.ReactNative/Fabric/WindowsComponentDescriptorRegistry.cpp +0 -2
  116. package/Microsoft.ReactNative/Fabric/platform/react/renderer/graphics/PlatformColorUtils.cpp +1 -1
  117. package/Microsoft.ReactNative/IReactCompositionViewComponentBuilder.idl +5 -0
  118. package/Microsoft.ReactNative/IReactContext.cpp +2 -2
  119. package/Microsoft.ReactNative/IReactContext.h +1 -1
  120. package/Microsoft.ReactNative/IReactContext.idl +2 -2
  121. package/Microsoft.ReactNative/IReactPackageBuilder.idl +3 -3
  122. package/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj +97 -87
  123. package/Microsoft.ReactNative/Modules/AccessibilityInfoModule.cpp +4 -0
  124. package/Microsoft.ReactNative/Modules/AlertModule.cpp +9 -4
  125. package/Microsoft.ReactNative/Modules/Animated/NativeAnimatedNodeManager.cpp +1 -1
  126. package/Microsoft.ReactNative/Modules/Animated/PropsAnimatedNode.cpp +32 -35
  127. package/Microsoft.ReactNative/Modules/Animated/PropsAnimatedNode.h +7 -4
  128. package/Microsoft.ReactNative/Modules/AppStateModule.cpp +1 -1
  129. package/Microsoft.ReactNative/Modules/AppThemeModuleUwp.cpp +2 -2
  130. package/Microsoft.ReactNative/Modules/AppearanceModule.cpp +2 -2
  131. package/Microsoft.ReactNative/Modules/DeviceInfoModule.cpp +3 -3
  132. package/Microsoft.ReactNative/Modules/I18nManagerModule.cpp +1 -1
  133. package/Microsoft.ReactNative/Modules/LogBoxModule.cpp +7 -5
  134. package/Microsoft.ReactNative/Modules/LogBoxModule.h +2 -1
  135. package/Microsoft.ReactNative/Modules/NativeUIManager.cpp +10 -10
  136. package/Microsoft.ReactNative/Modules/PaperUIManagerModule.cpp +24 -24
  137. package/Microsoft.ReactNative/Modules/Timing.cpp +2 -2
  138. package/Microsoft.ReactNative/ReactHost/IReactInstance.h +5 -0
  139. package/Microsoft.ReactNative/ReactHost/React.h +0 -3
  140. package/Microsoft.ReactNative/ReactHost/ReactInstanceWin.cpp +39 -16
  141. package/Microsoft.ReactNative/ReactHost/ReactInstanceWin.h +4 -2
  142. package/Microsoft.ReactNative/ReactNativeHost.cpp +9 -4
  143. package/Microsoft.ReactNative/ReactNativeIsland.idl +5 -1
  144. package/Microsoft.ReactNative/ReactPackageBuilder.cpp +3 -3
  145. package/Microsoft.ReactNative/ReactPackageBuilder.h +4 -4
  146. package/Microsoft.ReactNative/Utils/Helpers.cpp +0 -2
  147. package/Microsoft.ReactNative/Views/DevMenu.cpp +6 -6
  148. package/Microsoft.ReactNative/Views/DevMenu.h +1 -1
  149. package/Microsoft.ReactNative/Views/ViewManagerBase.cpp +2 -2
  150. package/Microsoft.ReactNative/Views/ViewPanel.cpp +1 -1
  151. package/Microsoft.ReactNative/Views/ViewViewManager.cpp +2 -2
  152. package/Microsoft.ReactNative/XamlUIService.cpp +13 -7
  153. package/Microsoft.ReactNative/XamlUIService.h +4 -1
  154. package/Microsoft.ReactNative/XamlUIService.idl +2 -0
  155. package/Microsoft.ReactNative.Cxx/JSI/JsiAbiApi.h +6 -2
  156. package/Microsoft.ReactNative.Cxx/ReactContext.h +1 -1
  157. package/Microsoft.ReactNative.Cxx/XamlUtils.h +12 -0
  158. package/PropertySheets/Generated/PackageVersion.g.props +3 -3
  159. package/PropertySheets/React.Cpp.props +3 -0
  160. package/PropertySheets/WebView2.props +1 -1
  161. package/PropertySheets/WinUI.props +5 -4
  162. package/ReactCommon/ReactCommon.vcxproj +5 -1
  163. package/ReactCommon/ReactCommon.vcxproj.filters +1 -1
  164. package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/JSExecutor.cpp +3 -3
  165. package/ReactCommon/TEMP_UntilReactCommonUpdate/cxxreact/NativeToJsBridge.cpp +3 -3
  166. package/ReactCommon/TEMP_UntilReactCommonUpdate/jsi/jsi/test/testlib.cpp +91 -0
  167. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/componentregistry/ComponentDescriptorRegistry.cpp +1 -12
  168. package/{Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputState.h → ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/textinput/TextInputState.h} +37 -35
  169. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/view/AccessibilityPrimitives.h +1 -0
  170. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/view/accessibilityPropsConversions.h +4 -0
  171. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/imagemanager/ImageRequestParams.h +30 -0
  172. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/runtimescheduler/SchedulerPriorityUtils.h +4 -3
  173. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/uimanager/primitives.h +179 -0
  174. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/runtime/ReactInstance.cpp +43 -57
  175. package/Shared/HermesRuntimeHolder.cpp +2 -2
  176. package/Shared/Shared.vcxitems +8 -14
  177. package/Shared/Shared.vcxitems.filters +4 -16
  178. package/Shared/Threading/BatchingQueueThread.cpp +3 -3
  179. package/codegen/NativeCPUTimeSpec.g.h +41 -0
  180. package/codegen/NativeFantomSpec.g.h +78 -0
  181. package/codegen/NativePerformanceSpec.g.h +31 -43
  182. package/codegen/NativeReactNativeFeatureFlagsSpec.g.h +84 -84
  183. package/codegen/react/components/rnwcore/ActivityIndicatorView.g.h +212 -0
  184. package/codegen/react/components/rnwcore/AndroidDrawerLayout.g.h +295 -0
  185. package/codegen/react/components/rnwcore/AndroidHorizontalScrollContentView.g.h +200 -0
  186. package/codegen/react/components/rnwcore/AndroidProgressBar.g.h +224 -0
  187. package/codegen/react/components/rnwcore/AndroidSwipeRefreshLayout.g.h +250 -0
  188. package/codegen/react/components/rnwcore/AndroidSwitch.g.h +267 -0
  189. package/codegen/react/components/rnwcore/DebuggingOverlay.g.h +234 -0
  190. package/codegen/react/components/rnwcore/InputAccessory.g.h +200 -0
  191. package/codegen/react/components/rnwcore/ModalHostView.g.h +283 -0
  192. package/codegen/react/components/rnwcore/PullToRefreshView.g.h +246 -0
  193. package/codegen/react/components/rnwcore/SafeAreaView.g.h +197 -0
  194. package/codegen/react/components/rnwcore/Switch.g.h +263 -0
  195. package/codegen/react/components/rnwcore/UnimplementedNativeView.g.h +200 -0
  196. package/codegen/rnwcoreJSI-generated.cpp +90 -57
  197. package/codegen/rnwcoreJSI.h +241 -104
  198. package/index.js +5 -0
  199. package/index.windows.js +5 -0
  200. package/just-task.js +1 -1
  201. package/package.json +25 -26
  202. package/src/private/animated/NativeAnimatedValidation.js +1 -1
  203. package/src/private/featureflags/ReactNativeFeatureFlags.js +33 -27
  204. package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +5 -5
  205. package/src/private/renderer/errorhandling/ErrorHandlers.js +12 -55
  206. package/src/private/specs/modules/{NativeJSCSamplingProfiler.js → NativeCPUTime.js} +7 -2
  207. package/src/private/specs/modules/NativeFantom.js +37 -0
  208. package/src/private/utilities/ensureInstance.js +21 -0
  209. package/src/private/webapis/dom/nodes/ReactNativeElement.js +49 -6
  210. package/src/private/webapis/dom/nodes/ReadOnlyNode.js +17 -9
  211. package/src/private/webapis/intersectionobserver/IntersectionObserver.js +11 -11
  212. package/src/private/webapis/intersectionobserver/IntersectionObserverEntry.js +1 -1
  213. package/src/private/webapis/intersectionobserver/IntersectionObserverManager.js +1 -1
  214. package/src/private/webapis/intersectionobserver/specs/NativeIntersectionObserver.js +1 -0
  215. package/src/private/webapis/performance/Performance.js +0 -12
  216. package/src/private/webapis/performance/specs/NativePerformance.js +0 -11
  217. package/types/index.d.ts +1 -0
  218. package/Libraries/HeapCapture/HeapCapture.js +0 -29
  219. package/Libraries/HeapCapture/NativeJSCHeapCapture.js +0 -13
  220. package/Libraries/Performance/NativeJSCSamplingProfiler.js +0 -13
  221. package/Libraries/Performance/SamplingProfiler.js +0 -39
  222. package/Libraries/ReactNative/__mocks__/FabricUIManager.js +0 -334
  223. package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewComponentDescriptor.h +0 -39
  224. package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewShadowNode.cpp +0 -18
  225. package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewShadowNode.h +0 -39
  226. package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputState.cpp +0 -34
  227. package/Microsoft.ReactNative/Fabric/ReactNativeConfigProperties.cpp +0 -53
  228. package/Microsoft.ReactNative/Fabric/ReactNativeConfigProperties.h +0 -26
  229. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/core/LayoutableShadowNode.cpp +0 -363
  230. package/codegen/NativeJSCSamplingProfilerSpec.g.h +0 -35
  231. package/src/private/webapis/dom/nodes/specs/__mocks__/NativeDOMMock.js +0 -413
  232. package/src/private/webapis/intersectionobserver/specs/__mocks__/NativeIntersectionObserver.js +0 -181
  233. package/src/private/webapis/mutationobserver/specs/__mocks__/NativeMutationObserver.js +0 -327
@@ -7,7 +7,7 @@
7
7
  * @noformat
8
8
  * @nolint
9
9
  * @flow strict
10
- * @generated SignedSource<<9cf3e28d6ca0299bc0bb5caa75b19556>>
10
+ * @generated SignedSource<<c6ea057ee85cbc116a083e3a306b2b88>>
11
11
  */
12
12
 
13
13
  import type {ElementRef, ElementType, MixedElement} from 'react';
@@ -133,9 +133,10 @@ declare const ensureNativeMethodsAreSynced: NativeMethods;
133
133
  (ensureNativeMethodsAreSynced: INativeMethods);
134
134
 
135
135
  export type HostInstance = NativeMethods;
136
- /*::
137
- export type HostComponent<Config: {...}> = component(ref: React$RefSetter<HostInstance>, ...Config);
138
- */
136
+ export type HostComponent<Config: {...}> = component(
137
+ ref: React$RefSetter<HostInstance>,
138
+ ...Config
139
+ );
139
140
 
140
141
  type InspectorDataProps = $ReadOnly<{
141
142
  [propName: string]: string,
@@ -206,9 +207,7 @@ export type ReactNativeType = {
206
207
  componentOrHandle: ?(ElementRef<TElementType> | number),
207
208
  ): ?number,
208
209
  isChildPublicInstance(
209
- // eslint-disable-next-line no-undef
210
210
  parent: PublicInstance | HostComponent<empty>,
211
- // eslint-disable-next-line no-undef
212
211
  child: PublicInstance | HostComponent<empty>,
213
212
  ): boolean,
214
213
  dispatchCommand(
@@ -148,6 +148,12 @@ function _validateTransforms(transform: Array<Object>): void {
148
148
  );
149
149
  const key = keys[0];
150
150
  const value = transformation[key];
151
+ if (key === 'matrix' && transform.length > 1) {
152
+ console.error(
153
+ 'When using a matrix transform, you must specify exactly one transform object. Passed transform: ' +
154
+ stringifySafe(transform),
155
+ );
156
+ }
151
157
  _validateTransform(key, value, transformation);
152
158
  });
153
159
  }
@@ -12,7 +12,7 @@ import {Constructor} from '../../types/private/Utilities';
12
12
  import {AccessibilityProps} from '../Components/View/ViewAccessibility';
13
13
  import {NativeMethods} from '../../types/public/ReactNativeTypes';
14
14
  import {ColorValue, StyleProp} from '../StyleSheet/StyleSheet';
15
- import {TextStyle} from '../StyleSheet/StyleSheetTypes';
15
+ import {TextStyle, ViewStyle} from '../StyleSheet/StyleSheetTypes';
16
16
  import {
17
17
  GestureResponderEvent,
18
18
  LayoutChangeEvent,
@@ -209,6 +209,11 @@ export interface TextProps
209
209
  * Specifies smallest possible scale a font can reach when adjustsFontSizeToFit is enabled. (values 0.01-1.0).
210
210
  */
211
211
  minimumFontScale?: number | undefined;
212
+
213
+ /**
214
+ * Controls how touch events are handled. Similar to `View`'s `pointerEvents`.
215
+ */
216
+ pointerEvents?: ViewStyle['pointerEvents'] | undefined;
212
217
  }
213
218
 
214
219
  /**
@@ -60,6 +60,7 @@ const Text: component(
60
60
  'aria-posinset': ariaPosinset, // Windows
61
61
  'aria-setsize': ariaSetsize, // Windows
62
62
  'aria-selected': ariaSelected,
63
+ 'aria-readonly': ariaReadOnly, //Windows
63
64
  children,
64
65
  ellipsizeMode,
65
66
  disabled,
@@ -98,6 +99,7 @@ const Text: component(
98
99
  ariaDisabled != null ||
99
100
  ariaExpanded != null ||
100
101
  ariaSelected != null ||
102
+ ariaReadOnly != null || // Windows
101
103
  ariaMultiselectable != null || // Windows
102
104
  ariaRequired != null // Windows
103
105
  ) {
@@ -108,6 +110,7 @@ const Text: component(
108
110
  disabled: ariaDisabled ?? _accessibilityState.disabled,
109
111
  expanded: ariaExpanded ?? _accessibilityState.expanded,
110
112
  selected: ariaSelected ?? _accessibilityState.selected,
113
+ readOnly: ariaReadOnly ?? _accessibilityState.readOnly, // Windows
111
114
  multiselectable:
112
115
  ariaMultiselectable ?? _accessibilityState.multiselectable, // Windows
113
116
  required: ariaRequired ?? _accessibilityState.required, // Windows
@@ -119,6 +122,7 @@ const Text: component(
119
122
  disabled: ariaDisabled,
120
123
  expanded: ariaExpanded,
121
124
  selected: ariaSelected,
125
+ readOnly: ariaReadOnly, // Windows
122
126
  multiselectable: ariaMultiselectable, // Windows
123
127
  required: ariaRequired, // Windows
124
128
  };
@@ -17,7 +17,7 @@ import type {
17
17
  AccessibilityState,
18
18
  Role,
19
19
  } from '../Components/View/ViewAccessibility';
20
- import type {TextStyleProp} from '../StyleSheet/StyleSheet';
20
+ import type {ColorValue, TextStyleProp} from '../StyleSheet/StyleSheet';
21
21
  import type {
22
22
  LayoutEvent,
23
23
  PointerEvent,
@@ -212,7 +212,7 @@ export type TextProps = $ReadOnly<{
212
212
  *
213
213
  * See https://reactnative.dev/docs/text#selectioncolor
214
214
  */
215
- selectionColor?: ?string,
215
+ selectionColor?: ?ColorValue,
216
216
 
217
217
  dataDetectorType?: ?('phoneNumber' | 'link' | 'email' | 'none' | 'all'),
218
218
 
@@ -17,7 +17,7 @@ import type {
17
17
  AccessibilityState,
18
18
  Role,
19
19
  } from '../Components/View/ViewAccessibility';
20
- import type {TextStyleProp} from '../StyleSheet/StyleSheet';
20
+ import type {ColorValue, TextStyleProp} from '../StyleSheet/StyleSheet';
21
21
  import type {
22
22
  LayoutEvent,
23
23
  PointerEvent,
@@ -97,6 +97,7 @@ export type TextProps = $ReadOnly<{
97
97
  'aria-posinset'?: ?number, // Windows
98
98
  'aria-setsize'?: ?number, // Windows
99
99
  'aria-level'?: ?number, // Windows
100
+ 'aria-readonly'?: ?boolean, // Windows
100
101
  'aria-multiselectable'?: ?boolean, // Windows
101
102
  'aria-required'?: ?boolean, // Windows
102
103
 
@@ -221,7 +222,7 @@ export type TextProps = $ReadOnly<{
221
222
  *
222
223
  * See https://reactnative.dev/docs/text#selectioncolor
223
224
  */
224
- selectionColor?: ?string,
225
+ selectionColor?: ?ColorValue,
225
226
 
226
227
  dataDetectorType?: ?('phoneNumber' | 'link' | 'email' | 'none' | 'all'),
227
228
 
@@ -14,12 +14,13 @@ import RCTDeviceEventEmitter from '../EventEmitter/RCTDeviceEventEmitter';
14
14
  const DEVICE_BACK_EVENT = 'hardwareBackPress';
15
15
 
16
16
  type BackPressEventName = 'backPress' | 'hardwareBackPress';
17
+ type BackPressHandler = () => ?boolean;
17
18
 
18
- const _backPressSubscriptions = [];
19
+ const _backPressSubscriptions: Array<BackPressHandler> = [];
19
20
 
20
21
  RCTDeviceEventEmitter.addListener(DEVICE_BACK_EVENT, function () {
21
22
  for (let i = _backPressSubscriptions.length - 1; i >= 0; i--) {
22
- if (_backPressSubscriptions[i]()) {
23
+ if (_backPressSubscriptions[i]?.()) {
23
24
  return;
24
25
  }
25
26
  }
@@ -57,7 +58,7 @@ type TBackHandler = {|
57
58
  +exitApp: () => void,
58
59
  +addEventListener: (
59
60
  eventName: BackPressEventName,
60
- handler: () => ?boolean,
61
+ handler: BackPressHandler,
61
62
  ) => {remove: () => void, ...},
62
63
  |};
63
64
  const BackHandler: TBackHandler = {
@@ -76,7 +77,7 @@ const BackHandler: TBackHandler = {
76
77
  */
77
78
  addEventListener: function (
78
79
  eventName: BackPressEventName,
79
- handler: () => ?boolean,
80
+ handler: BackPressHandler,
80
81
  ): {remove: () => void, ...} {
81
82
  if (_backPressSubscriptions.indexOf(handler) === -1) {
82
83
  _backPressSubscriptions.push(handler);
@@ -4,13 +4,12 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
+ * @flow strict-local
7
8
  * @format
8
- * @flow
9
9
  */
10
10
 
11
- 'use strict';
12
-
13
11
  type BackPressEventName = 'backPress' | 'hardwareBackPress';
12
+ type BackPressHandler = () => ?boolean;
14
13
 
15
14
  function emptyFunction(): void {}
16
15
 
@@ -18,13 +17,13 @@ type TBackHandler = {|
18
17
  +exitApp: () => void,
19
18
  +addEventListener: (
20
19
  eventName: BackPressEventName,
21
- handler: () => ?boolean,
20
+ handler: BackPressHandler,
22
21
  ) => {remove: () => void, ...},
23
22
  |};
24
23
 
25
24
  let BackHandler: TBackHandler = {
26
25
  exitApp: emptyFunction,
27
- addEventListener(_eventName: BackPressEventName, _handler: Function) {
26
+ addEventListener(_eventName: BackPressEventName, _handler: BackPressHandler) {
28
27
  return {
29
28
  remove: emptyFunction,
30
29
  };
@@ -14,12 +14,13 @@ import RCTDeviceEventEmitter from '../EventEmitter/RCTDeviceEventEmitter';
14
14
  const DEVICE_BACK_EVENT = 'hardwareBackPress';
15
15
 
16
16
  type BackPressEventName = 'backPress' | 'hardwareBackPress';
17
+ type BackPressHandler = () => ?boolean;
17
18
 
18
- const _backPressSubscriptions = [];
19
+ const _backPressSubscriptions: Array<BackPressHandler> = [];
19
20
 
20
21
  RCTDeviceEventEmitter.addListener(DEVICE_BACK_EVENT, function () {
21
22
  for (let i = _backPressSubscriptions.length - 1; i >= 0; i--) {
22
- if (_backPressSubscriptions[i]()) {
23
+ if (_backPressSubscriptions[i]?.()) {
23
24
  return;
24
25
  }
25
26
  }
@@ -57,7 +58,7 @@ type TBackHandler = {|
57
58
  +exitApp: () => void,
58
59
  +addEventListener: (
59
60
  eventName: BackPressEventName,
60
- handler: () => ?boolean,
61
+ handler: BackPressHandler,
61
62
  ) => {remove: () => void, ...},
62
63
  |};
63
64
  const BackHandler: TBackHandler = {
@@ -76,7 +77,7 @@ const BackHandler: TBackHandler = {
76
77
  */
77
78
  addEventListener: function (
78
79
  eventName: BackPressEventName,
79
- handler: () => ?boolean,
80
+ handler: BackPressHandler,
80
81
  ): {remove: () => void, ...} {
81
82
  if (_backPressSubscriptions.indexOf(handler) === -1) {
82
83
  _backPressSubscriptions.push(handler);
@@ -7,6 +7,7 @@ import "ViewProps.idl";
7
7
  import "Composition.Input.idl";
8
8
  import "CompositionSwitcher.idl";
9
9
  import "IReactContext.idl";
10
+ import "ReactNativeIsland.idl";
10
11
 
11
12
  #include "DocString.h"
12
13
 
@@ -110,8 +111,19 @@ namespace Microsoft.ReactNative.Composition
110
111
  [default_interface]
111
112
  runtimeclass RootComponentView : ViewComponentView {
112
113
  Microsoft.ReactNative.ComponentView GetFocusedComponent();
114
+ Microsoft.ReactNative.ReactNativeIsland ReactNativeIsland { get; };
115
+ DOC_STRING("Is non-null if this RootComponentView is the content of a portal")
116
+ PortalComponentView Portal { get; };
113
117
  };
114
-
118
+
119
+ [experimental]
120
+ [webhosthidden]
121
+ [default_interface]
122
+ DOC_STRING("Used to implement UI that is hosted outside the main UI tree, such as modal.")
123
+ runtimeclass PortalComponentView : Microsoft.ReactNative.ComponentView {
124
+ RootComponentView ContentRoot { get; };
125
+ };
126
+
115
127
  [experimental]
116
128
  [webhosthidden]
117
129
  [default_interface]
@@ -639,7 +639,6 @@ facebook::react::Tag ComponentView::hitTest(
639
639
  }
640
640
 
641
641
  winrt::IInspectable ComponentView::EnsureUiaProvider() noexcept {
642
- assert(false);
643
642
  return nullptr;
644
643
  }
645
644
 
@@ -15,8 +15,6 @@
15
15
  #include <Fabric/Composition/CompositionViewComponentView.h>
16
16
  #include <Fabric/Composition/DebuggingOverlayComponentView.h>
17
17
  #include <Fabric/Composition/ImageComponentView.h>
18
- #include <Fabric/Composition/Modal/WindowsModalHostViewComponentView.h>
19
- #include <Fabric/Composition/Modal/WindowsModalHostViewShadowNode.h>
20
18
  #include <Fabric/Composition/ParagraphComponentView.h>
21
19
  #include <Fabric/Composition/RootComponentView.h>
22
20
  #include <Fabric/Composition/ScrollViewComponentView.h>
@@ -59,9 +57,6 @@ ComponentViewDescriptor const &ComponentViewRegistry::dequeueComponentViewWithCo
59
57
  } else if (componentHandle == facebook::react::ImageShadowNode::Handle()) {
60
58
  view = winrt::Microsoft::ReactNative::Composition::implementation::ImageComponentView::Create(
61
59
  compContext, tag, m_context);
62
- } else if (componentHandle == facebook::react::WindowsModalHostViewShadowNode::Handle()) {
63
- view = winrt::Microsoft::ReactNative::Composition::implementation::WindowsModalHostComponentView::Create(
64
- compContext, tag, m_context);
65
60
  } else if (componentHandle == facebook::react::WindowsTextInputShadowNode::Handle()) {
66
61
  view = winrt::Microsoft::ReactNative::Composition::implementation::WindowsTextInputComponentView::Create(
67
62
  compContext, tag, m_context);
@@ -141,8 +141,12 @@ HRESULT __stdcall CompositionDynamicAutomationProvider::get_ProviderOptions(Prov
141
141
  return S_OK;
142
142
  }
143
143
 
144
- bool accessibilityValueHasValue(const facebook::react::AccessibilityValue &value) {
145
- return (value.min.has_value() && value.max.has_value()) || value.now.has_value() || value.text.has_value();
144
+ bool accessibilityValueHasTextValue(const facebook::react::AccessibilityValue &value) {
145
+ return value.text.has_value();
146
+ }
147
+
148
+ bool accessibilityValueHasNumericValue(const facebook::react::AccessibilityValue &value) {
149
+ return (value.min.has_value() && value.max.has_value() && value.now.has_value());
146
150
  }
147
151
 
148
152
  bool expandableControl(const facebook::react::SharedViewProps props) {
@@ -188,8 +192,6 @@ HRESULT __stdcall CompositionDynamicAutomationProvider::GetPatternProvider(PATTE
188
192
  winrt::get_self<winrt::Microsoft::ReactNative::implementation::ComponentView>(strongView)->props());
189
193
  if (props == nullptr)
190
194
  return UIA_E_ELEMENTNOTAVAILABLE;
191
- auto accessibilityRole =
192
- props->accessibilityRole.empty() ? compositionView->DefaultControlType() : props->accessibilityRole;
193
195
  // Invoke control pattern is used to support controls that do not maintain state
194
196
  // when activated but rather initiate or perform a single, unambiguous action.
195
197
  if (patternId == UIA_InvokePatternId && (props->onAccessibilityTap)) {
@@ -203,8 +205,15 @@ HRESULT __stdcall CompositionDynamicAutomationProvider::GetPatternProvider(PATTE
203
205
  }
204
206
 
205
207
  if (patternId == UIA_ValuePatternId &&
206
- (strongView.try_as<winrt::Microsoft::ReactNative::Composition::implementation::WindowsTextInputComponentView>() ||
207
- accessibilityValueHasValue(props->accessibilityValue))) {
208
+ ((strongView
209
+ .try_as<winrt::Microsoft::ReactNative::Composition::implementation::WindowsTextInputComponentView>() &&
210
+ !accessibilityValueHasNumericValue(props->accessibilityValue)) ||
211
+ accessibilityValueHasTextValue(props->accessibilityValue))) {
212
+ *pRetVal = static_cast<IValueProvider *>(this);
213
+ AddRef();
214
+ }
215
+
216
+ if (patternId == UIA_RangeValuePatternId && accessibilityValueHasNumericValue(props->accessibilityValue)) {
208
217
  *pRetVal = static_cast<IValueProvider *>(this);
209
218
  AddRef();
210
219
  }
@@ -485,6 +494,8 @@ HRESULT __stdcall CompositionDynamicAutomationProvider::SetValue(LPCWSTR val) {
485
494
 
486
495
  winrt::get_self<winrt::Microsoft::ReactNative::implementation::ComponentView>(strongView)
487
496
  ->setAcccessiblityValue(winrt::to_string(val));
497
+ // TODO: Edit once/if onAccessibilityAction props supports returning UIA event data. See
498
+ // https://github.com/react-native-community/discussions-and-proposals/issues/843.
488
499
  DispatchAccessibilityAction(m_view, "setValue");
489
500
  return S_OK;
490
501
  }
@@ -516,22 +527,86 @@ HRESULT __stdcall CompositionDynamicAutomationProvider::get_IsReadOnly(BOOL *pRe
516
527
  if (props == nullptr)
517
528
  return UIA_E_ELEMENTNOTAVAILABLE;
518
529
  auto accessibilityRole = props->accessibilityRole;
519
- if (accessibilityRole.empty()) {
520
- // Control is using default control type. Use default IsReadOnly value.
521
- *pRetVal = winrt::get_self<winrt::Microsoft::ReactNative::implementation::ComponentView>(strongView)
522
- ->getAcccessiblityIsReadOnly();
523
- } else if (
524
- accessibilityRole == "textinput" || accessibilityRole == "searchbox" || accessibilityRole == "adjustable" ||
525
- accessibilityRole == "spinbutton" || accessibilityRole == "combobox") {
526
- // Control is using customized control type which should not be IsReadOnly for value pattern.
527
- *pRetVal = false;
530
+ if (props->accessibilityState.has_value() && props->accessibilityState->readOnly.has_value()) {
531
+ *pRetVal = props->accessibilityState->readOnly.value();
528
532
  } else {
529
- // Control is using customized control type which should be IsReadOnly for value pattern.
530
- *pRetVal = true;
533
+ // Use default IsReadOnly value.
534
+ *pRetVal = false;
531
535
  }
532
536
  return S_OK;
533
537
  }
534
538
 
539
+ HRESULT __stdcall CompositionDynamicAutomationProvider::get_LargeChange(double *pRetVal) {
540
+ // no-op
541
+ return S_OK;
542
+ }
543
+ HRESULT __stdcall CompositionDynamicAutomationProvider::get_Maximum(double *pRetVal) {
544
+ if (pRetVal == nullptr)
545
+ return E_POINTER;
546
+ auto strongView = m_view.view();
547
+
548
+ if (!strongView)
549
+ return UIA_E_ELEMENTNOTAVAILABLE;
550
+
551
+ auto props = std::static_pointer_cast<const facebook::react::ViewProps>(
552
+ winrt::get_self<winrt::Microsoft::ReactNative::implementation::ComponentView>(strongView)->props());
553
+
554
+ if (props == nullptr)
555
+ return UIA_E_ELEMENTNOTAVAILABLE;
556
+
557
+ *pRetVal = props->accessibilityValue.max.value();
558
+ return S_OK;
559
+ }
560
+ HRESULT __stdcall CompositionDynamicAutomationProvider::get_Minimum(double *pRetVal) {
561
+ if (pRetVal == nullptr)
562
+ return E_POINTER;
563
+ auto strongView = m_view.view();
564
+
565
+ if (!strongView)
566
+ return UIA_E_ELEMENTNOTAVAILABLE;
567
+
568
+ auto props = std::static_pointer_cast<const facebook::react::ViewProps>(
569
+ winrt::get_self<winrt::Microsoft::ReactNative::implementation::ComponentView>(strongView)->props());
570
+
571
+ if (props == nullptr)
572
+ return UIA_E_ELEMENTNOTAVAILABLE;
573
+
574
+ *pRetVal = props->accessibilityValue.min.value();
575
+ return S_OK;
576
+ }
577
+ HRESULT __stdcall CompositionDynamicAutomationProvider::get_SmallChange(double *pRetVal) {
578
+ // no-op
579
+ return S_OK;
580
+ }
581
+ HRESULT __stdcall CompositionDynamicAutomationProvider::get_Value(double *pRetVal) {
582
+ if (pRetVal == nullptr)
583
+ return E_POINTER;
584
+ auto strongView = m_view.view();
585
+
586
+ if (!strongView)
587
+ return UIA_E_ELEMENTNOTAVAILABLE;
588
+
589
+ auto props = std::static_pointer_cast<const facebook::react::ViewProps>(
590
+ winrt::get_self<winrt::Microsoft::ReactNative::implementation::ComponentView>(strongView)->props());
591
+
592
+ if (props == nullptr)
593
+ return UIA_E_ELEMENTNOTAVAILABLE;
594
+
595
+ *pRetVal = props->accessibilityValue.now.value();
596
+ return S_OK;
597
+ }
598
+ HRESULT __stdcall CompositionDynamicAutomationProvider::SetValue(double val) {
599
+ auto strongView = m_view.view();
600
+
601
+ if (!strongView)
602
+ return UIA_E_ELEMENTNOTAVAILABLE;
603
+
604
+ // TODO: Edit once/if onAccessibilityAction props supports returning UIA event data. See
605
+ // https://github.com/react-native-community/discussions-and-proposals/issues/843.
606
+ DispatchAccessibilityAction(m_view, "setValue");
607
+ return S_OK;
608
+ }
609
+
535
610
  HRESULT __stdcall CompositionDynamicAutomationProvider::get_ToggleState(ToggleState *pRetVal) {
536
611
  if (pRetVal == nullptr)
537
612
  return E_POINTER;
@@ -16,6 +16,7 @@ class CompositionDynamicAutomationProvider : public winrt::implements<
16
16
  IInvokeProvider,
17
17
  IScrollItemProvider,
18
18
  IValueProvider,
19
+ IRangeValueProvider,
19
20
  IToggleProvider,
20
21
  IExpandCollapseProvider,
21
22
  ISelectionProvider,
@@ -50,6 +51,14 @@ class CompositionDynamicAutomationProvider : public winrt::implements<
50
51
  virtual HRESULT __stdcall get_Value(BSTR *pRetVal) override;
51
52
  virtual HRESULT __stdcall get_IsReadOnly(BOOL *pRetVal) override;
52
53
 
54
+ // inherited via IRangeValueProvider
55
+ virtual HRESULT __stdcall get_LargeChange(double *pRetVal) override;
56
+ virtual HRESULT __stdcall get_Maximum(double *pRetVal) override;
57
+ virtual HRESULT __stdcall get_Minimum(double *pRetVal) override;
58
+ virtual HRESULT __stdcall get_SmallChange(double *pRetVal) override;
59
+ virtual HRESULT __stdcall get_Value(double *pRetVal) override;
60
+ virtual HRESULT __stdcall SetValue(double val) override;
61
+
53
62
  // inherited via IToggleProvider
54
63
  virtual HRESULT __stdcall get_ToggleState(ToggleState *pRetVal) override;
55
64
  virtual HRESULT __stdcall Toggle() override;
@@ -9,7 +9,6 @@
9
9
  #include <IReactContext.h>
10
10
  #include <React.h>
11
11
  #include <Views/DevMenu.h>
12
- #include <Views/ShadowNodeBase.h>
13
12
  #include <windows.h>
14
13
  #include <windowsx.h>
15
14
  #include <winrt/Windows.UI.Core.h>
@@ -142,9 +141,8 @@ struct CompositionInputKeyboardSource : winrt::implements<
142
141
 
143
142
  CompositionEventHandler::CompositionEventHandler(
144
143
  const winrt::Microsoft::ReactNative::ReactContext &context,
145
- const winrt::Microsoft::ReactNative::ReactNativeIsland &reactNativeIsland,
146
- const int fragmentTag)
147
- : m_fragmentTag(fragmentTag), m_context(context), m_wkRootView(reactNativeIsland) {}
144
+ const winrt::Microsoft::ReactNative::ReactNativeIsland &reactNativeIsland)
145
+ : m_context(context), m_wkRootView(reactNativeIsland) {}
148
146
 
149
147
  void CompositionEventHandler::Initialize() noexcept {
150
148
  #ifdef USE_WINUI3
@@ -348,11 +346,8 @@ facebook::react::SurfaceId CompositionEventHandler::SurfaceId() const noexcept {
348
346
 
349
347
  winrt::Microsoft::ReactNative::Composition::implementation::RootComponentView &
350
348
  CompositionEventHandler::RootComponentView() const noexcept {
351
- auto rootComponentViewDescriptor = (::Microsoft::ReactNative::FabricUIManager::FromProperties(m_context.Properties()))
352
- ->GetViewRegistry()
353
- .componentViewDescriptorWithTag(SurfaceId());
354
- return *rootComponentViewDescriptor.view
355
- .as<winrt::Microsoft::ReactNative::Composition::implementation::RootComponentView>();
349
+ auto island = m_wkRootView.get();
350
+ return *winrt::get_self<winrt::Microsoft::ReactNative::implementation::ReactNativeIsland>(island)->GetComponentView();
356
351
  }
357
352
 
358
353
  void CompositionEventHandler::onPointerWheelChanged(
@@ -365,6 +360,9 @@ void CompositionEventHandler::onPointerWheelChanged(
365
360
  facebook::react::Point ptLocal;
366
361
  facebook::react::Point ptScaled = {static_cast<float>(position.X), static_cast<float>(position.Y)};
367
362
 
363
+ // In the case of a sub rootview, we may have a non-zero origin. hitTest takes a pt in the parent coords, so we
364
+ // need to apply the current origin
365
+ ptScaled += RootComponentView().layoutMetrics().frame.origin;
368
366
  auto tag = RootComponentView().hitTest(ptScaled, ptLocal);
369
367
 
370
368
  if (tag == -1)
@@ -977,6 +975,11 @@ void CompositionEventHandler::getTargetPointerArgs(
977
975
  tag = -1;
978
976
 
979
977
  ptScaled = {position.X, position.Y};
978
+
979
+ // In the case of a sub rootview, we may have a non-zero origin. hitTest takes a pt in the parent coords, so we need
980
+ // to apply the current origin
981
+ ptScaled += RootComponentView().layoutMetrics().frame.origin;
982
+
980
983
  if (std::find(m_capturedPointers.begin(), m_capturedPointers.end(), pointerId) != m_capturedPointers.end()) {
981
984
  assert(m_pointerCapturingComponentTag != -1);
982
985
  tag = m_pointerCapturingComponentTag;
@@ -989,30 +992,7 @@ void CompositionEventHandler::getTargetPointerArgs(
989
992
  ptLocal.y = ptScaled.y - (clientRect.top / strongRootView.ScaleFactor());
990
993
  }
991
994
  } else {
992
- if (m_fragmentTag == -1) {
993
- tag = RootComponentView().hitTest(ptScaled, ptLocal);
994
- return;
995
- }
996
-
997
- // check if the fragment tag exists
998
- if (!fabricuiManager->GetViewRegistry().findComponentViewWithTag(m_fragmentTag)) {
999
- return;
1000
- }
1001
-
1002
- auto fagmentView = fabricuiManager->GetViewRegistry().componentViewDescriptorWithTag(m_fragmentTag).view;
1003
- auto fagmentchildren = fagmentView.Children();
1004
-
1005
- // call the hitTest with the fargment as the RootComponent
1006
- for (auto index = fagmentchildren.Size(); index > 0; index--) {
1007
- auto childView = fagmentchildren.GetAt(index - 1);
1008
- auto targetTag =
1009
- winrt::get_self<winrt::Microsoft::ReactNative::implementation::ComponentView>(childView)->hitTest(
1010
- ptScaled, ptLocal);
1011
- if (targetTag != -1) {
1012
- tag = targetTag;
1013
- break;
1014
- }
1015
- }
995
+ tag = RootComponentView().hitTest(ptScaled, ptLocal);
1016
996
  }
1017
997
  }
1018
998
 
@@ -31,8 +31,7 @@ class CompositionEventHandler : public std::enable_shared_from_this<CompositionE
31
31
  public:
32
32
  CompositionEventHandler(
33
33
  const winrt::Microsoft::ReactNative::ReactContext &context,
34
- const winrt::Microsoft::ReactNative::ReactNativeIsland &ReactNativeIsland,
35
- const int fragmentTag);
34
+ const winrt::Microsoft::ReactNative::ReactNativeIsland &ReactNativeIsland);
36
35
  virtual ~CompositionEventHandler();
37
36
 
38
37
  void Initialize() noexcept;
@@ -152,7 +151,6 @@ class CompositionEventHandler : public std::enable_shared_from_this<CompositionE
152
151
 
153
152
  std::map<PointerId, ActiveTouch> m_activeTouches; // iOS is map of touch event args to ActiveTouch..?
154
153
  PointerId m_touchId = 0;
155
- int m_fragmentTag = -1;
156
154
 
157
155
  std::map<PointerId, std::vector<ReactTaggedView>> m_currentlyHoveredViewsPerPointer;
158
156
  winrt::weak_ref<winrt::Microsoft::ReactNative::ReactNativeIsland> m_wkRootView;
@@ -27,6 +27,25 @@ HRESULT __stdcall CompositionRootAutomationProvider::GetRuntimeId(SAFEARRAY **pR
27
27
 
28
28
  *pRetVal = nullptr;
29
29
 
30
+ if (!m_island)
31
+ return E_FAIL;
32
+
33
+ *pRetVal = SafeArrayCreateVector(VT_I4, 0, 3);
34
+ if (*pRetVal == nullptr)
35
+ return E_OUTOFMEMORY;
36
+
37
+ auto rgiRuntimeId = static_cast<int *>((*pRetVal)->pvData);
38
+
39
+ rgiRuntimeId[0] = UiaAppendRuntimeId;
40
+ rgiRuntimeId[1] = 0;
41
+ rgiRuntimeId[2] = 0;
42
+
43
+ if (auto rootView = m_wkRootView.get()) {
44
+ auto tag = rootView.RootTag();
45
+ rgiRuntimeId[1] = LODWORD(tag);
46
+ rgiRuntimeId[2] = HIDWORD(tag);
47
+ }
48
+
30
49
  return S_OK;
31
50
  }
32
51
 
@@ -153,8 +172,18 @@ HRESULT __stdcall CompositionRootAutomationProvider::get_FragmentRoot(IRawElemen
153
172
  if (pRetVal == nullptr)
154
173
  return E_POINTER;
155
174
 
156
- AddRef();
157
- *pRetVal = this;
175
+ *pRetVal = nullptr;
176
+
177
+ #ifdef USE_EXPERIMENTAL_WINUI3
178
+ if (m_island) {
179
+ auto parentRoot = m_island.FragmentRootAutomationProvider();
180
+ auto spFragment = parentRoot.try_as<IRawElementProviderFragmentRoot>();
181
+ if (spFragment) {
182
+ *pRetVal = spFragment.detach();
183
+ return S_OK;
184
+ }
185
+ }
186
+ #endif
158
187
 
159
188
  return S_OK;
160
189
  }
@@ -167,7 +196,7 @@ HRESULT __stdcall CompositionRootAutomationProvider::get_ProviderOptions(Provide
167
196
  return S_OK;
168
197
  }
169
198
 
170
- winrt::Microsoft::ReactNative::Composition::implementation::RootComponentView *
199
+ winrt::com_ptr<winrt::Microsoft::ReactNative::Composition::implementation::RootComponentView>
171
200
  CompositionRootAutomationProvider::rootComponentView() noexcept {
172
201
  if (auto rootView = m_wkRootView.get()) {
173
202
  auto innerRootView = winrt::get_self<winrt::Microsoft::ReactNative::implementation::ReactNativeIsland>(rootView);
@@ -249,8 +278,6 @@ HRESULT __stdcall CompositionRootAutomationProvider::Navigate(
249
278
  if (pRetVal == nullptr)
250
279
  return E_POINTER;
251
280
 
252
- // Fragment roots do not enable navigation to a parent or siblings; navigation among fragment roots is handled by the
253
- // default window providers. Elements in fragments must navigate only to other elements within that fragment.
254
281
  if (direction == NavigateDirection_FirstChild || direction == NavigateDirection_LastChild) {
255
282
  if (auto rootView = rootComponentView()) {
256
283
  auto uiaProvider = rootView->EnsureUiaProvider();
@@ -260,6 +287,17 @@ HRESULT __stdcall CompositionRootAutomationProvider::Navigate(
260
287
  return S_OK;
261
288
  }
262
289
  }
290
+ } else if (direction == NavigateDirection_Parent) {
291
+ #ifdef USE_EXPERIMENTAL_WINUI3
292
+ if (m_island) {
293
+ auto parent = m_island.ParentAutomationProvider();
294
+ auto spFragment = parent.try_as<IRawElementProviderFragment>();
295
+ if (spFragment) {
296
+ *pRetVal = spFragment.detach();
297
+ return S_OK;
298
+ }
299
+ }
300
+ #endif
263
301
  }
264
302
  *pRetVal = nullptr;
265
303
  return S_OK;