react-native-windows 0.75.5 → 0.75.7

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 (40) hide show
  1. package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.windows.js +15 -15
  2. package/Libraries/Components/Button.windows.js +18 -18
  3. package/Libraries/Components/Flyout/FlyoutNativeComponent.js +5 -1
  4. package/Libraries/Components/TextInput/TextInput.windows.js +14 -10
  5. package/Libraries/Components/Touchable/Touchable.windows.js +2 -2
  6. package/Libraries/Components/Touchable/TouchableWithoutFeedback.windows.js +5 -3
  7. package/Libraries/Text/Text.windows.js +2 -2
  8. package/Libraries/Utilities/Platform.windows.js +4 -4
  9. package/Microsoft.ReactNative/Fabric/ComponentView.cpp +12 -0
  10. package/Microsoft.ReactNative/Fabric/ComponentView.h +3 -0
  11. package/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.cpp +70 -0
  12. package/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.h +8 -2
  13. package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.cpp +24 -0
  14. package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.h +2 -0
  15. package/Microsoft.ReactNative/Fabric/Composition/ReactNativeIsland.cpp +8 -3
  16. package/Microsoft.ReactNative/Fabric/Composition/ReactNativeIsland.h +1 -0
  17. package/Microsoft.ReactNative/Fabric/Composition/RootComponentView.cpp +11 -0
  18. package/Microsoft.ReactNative/Fabric/Composition/RootComponentView.h +2 -0
  19. package/Microsoft.ReactNative/Fabric/Composition/TextDrawing.cpp +1 -2
  20. package/Microsoft.ReactNative/Fabric/Composition/TextDrawing.h +1 -1
  21. package/Microsoft.ReactNative/Fabric/Composition/Theme.cpp +12 -4
  22. package/Microsoft.ReactNative/Fabric/Composition/TooltipService.cpp +338 -0
  23. package/Microsoft.ReactNative/Fabric/Composition/TooltipService.h +66 -0
  24. package/Microsoft.ReactNative/Fabric/Composition/UiaHelpers.cpp +8 -0
  25. package/Microsoft.ReactNative/Fabric/Composition/UiaHelpers.h +1 -0
  26. package/Microsoft.ReactNative/Fabric/FabricUIManagerModule.cpp +3 -0
  27. package/Microsoft.ReactNative/Fabric/ReactTaggedView.h +4 -0
  28. package/Microsoft.ReactNative/Fabric/platform/react/renderer/components/view/HostPlatformViewProps.cpp +5 -0
  29. package/Microsoft.ReactNative/Fabric/platform/react/renderer/components/view/HostPlatformViewProps.h +1 -1
  30. package/Microsoft.ReactNative/Fabric/platform/react/renderer/components/view/HostPlatformViewTraitsInitializer.h +1 -1
  31. package/Microsoft.ReactNative/Microsoft.ReactNative.vcxproj +1 -1
  32. package/Microsoft.ReactNative/ReactCoreInjection.h +0 -1
  33. package/PropertySheets/Generated/PackageVersion.g.props +3 -3
  34. package/Shared/Shared.vcxitems +3 -0
  35. package/Shared/Shared.vcxitems.filters +2 -0
  36. package/just-task.js +1 -1
  37. package/package.json +3 -4
  38. package/templates/cpp-app/template.config.js +8 -3
  39. package/templates/cpp-lib/template.config.js +8 -3
  40. package/templates/templateUtils.js +2 -3
@@ -55,21 +55,21 @@ const EventNames: Map<
55
55
  ['accessibilityServiceChanged', 'accessibilityServiceDidChange'],
56
56
  ])
57
57
  : Platform.OS === 'windows'
58
- ? new Map([
59
- ['change', 'TOUCH_EXPLORATION_EVENT'],
60
- ['reduceMotionChanged', 'REDUCE_MOTION_EVENT'],
61
- ['screenReaderChanged', 'TOUCH_EXPLORATION_EVENT'],
62
- ])
63
- : new Map([
64
- ['announcementFinished', 'announcementFinished'],
65
- ['boldTextChanged', 'boldTextChanged'],
66
- ['change', 'screenReaderChanged'],
67
- ['grayscaleChanged', 'grayscaleChanged'],
68
- ['invertColorsChanged', 'invertColorsChanged'],
69
- ['reduceMotionChanged', 'reduceMotionChanged'],
70
- ['reduceTransparencyChanged', 'reduceTransparencyChanged'],
71
- ['screenReaderChanged', 'screenReaderChanged'],
72
- ]);
58
+ ? new Map([
59
+ ['change', 'TOUCH_EXPLORATION_EVENT'],
60
+ ['reduceMotionChanged', 'REDUCE_MOTION_EVENT'],
61
+ ['screenReaderChanged', 'TOUCH_EXPLORATION_EVENT'],
62
+ ])
63
+ : new Map([
64
+ ['announcementFinished', 'announcementFinished'],
65
+ ['boldTextChanged', 'boldTextChanged'],
66
+ ['change', 'screenReaderChanged'],
67
+ ['grayscaleChanged', 'grayscaleChanged'],
68
+ ['invertColorsChanged', 'invertColorsChanged'],
69
+ ['reduceMotionChanged', 'reduceMotionChanged'],
70
+ ['reduceTransparencyChanged', 'reduceTransparencyChanged'],
71
+ ['screenReaderChanged', 'screenReaderChanged'],
72
+ ]);
73
73
 
74
74
  /**
75
75
  * Sometimes it's useful to know whether or not the device has a screen reader
@@ -407,10 +407,10 @@ const Button: React.AbstractComponent<
407
407
  color
408
408
  ? {borderRadius: 3}
409
409
  : pressed
410
- ? [buttonStyles, styles.buttonPressed]
411
- : hover
412
- ? [buttonStyles, styles.buttonHover]
413
- : buttonStyles
410
+ ? [buttonStyles, styles.buttonPressed]
411
+ : hover
412
+ ? [buttonStyles, styles.buttonHover]
413
+ : buttonStyles
414
414
  }
415
415
  onMouseEnter={() => {
416
416
  if (!disabled) setHover(true);
@@ -445,20 +445,20 @@ const Button: React.AbstractComponent<
445
445
  color
446
446
  ? textStyles
447
447
  : pressed
448
- ? [
449
- textStyles,
450
- {
451
- color: PlatformColor('ButtonForegroundPressed'),
452
- },
453
- ]
454
- : hover
455
- ? [
456
- textStyles,
457
- {
458
- color: PlatformColor('ButtonForegroundPointerOver'),
459
- },
460
- ]
461
- : textStyles
448
+ ? [
449
+ textStyles,
450
+ {
451
+ color: PlatformColor('ButtonForegroundPressed'),
452
+ },
453
+ ]
454
+ : hover
455
+ ? [
456
+ textStyles,
457
+ {
458
+ color: PlatformColor('ButtonForegroundPointerOver'),
459
+ },
460
+ ]
461
+ : textStyles
462
462
  }
463
463
  disabled={disabled}>
464
464
  {formattedTitle}
@@ -7,7 +7,11 @@
7
7
 
8
8
  import type {ViewProps} from 'react-native/Libraries/Components/View/ViewPropTypes';
9
9
  import type {HostComponent} from 'react-native/Libraries/Renderer/shims/ReactNativeTypes';
10
- import type {DirectEventHandler, Double, Int32} from 'react-native/Libraries/Types/CodegenTypes';
10
+ import type {
11
+ DirectEventHandler,
12
+ Double,
13
+ Int32,
14
+ } from 'react-native/Libraries/Types/CodegenTypes';
11
15
 
12
16
  import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
13
17
 
@@ -1207,8 +1207,8 @@ function InternalTextInput(props: Props): React.Node {
1207
1207
  typeof props.value === 'string'
1208
1208
  ? props.value
1209
1209
  : typeof props.defaultValue === 'string'
1210
- ? props.defaultValue
1211
- : '';
1210
+ ? props.defaultValue
1211
+ : '';
1212
1212
 
1213
1213
  // This is necessary in case native updates the text and JS decides
1214
1214
  // that the update should be ignored and we should stick with the value
@@ -1313,8 +1313,12 @@ function InternalTextInput(props: Props): React.Node {
1313
1313
  }
1314
1314
  },
1315
1315
  isFocused(): boolean {
1316
- const currentlyFocusedInput = TextInputState.currentlyFocusedInput();
1317
- return currentlyFocusedInput !== null && currentlyFocusedInput === inputRef.current;
1316
+ const currentlyFocusedInput =
1317
+ TextInputState.currentlyFocusedInput();
1318
+ return (
1319
+ currentlyFocusedInput !== null &&
1320
+ currentlyFocusedInput === inputRef.current
1321
+ );
1318
1322
  },
1319
1323
  getNativeRef(): ?React.ElementRef<HostComponent<mixed>> {
1320
1324
  return inputRef.current;
@@ -1872,12 +1876,12 @@ const ExportedForwardRef: React.AbstractComponent<
1872
1876
  textContentType != null
1873
1877
  ? textContentType
1874
1878
  : Platform.OS === 'ios' &&
1875
- autoComplete &&
1876
- autoComplete in autoCompleteWebToTextContentTypeMap
1877
- ? // $FlowFixMe[invalid-computed-prop]
1878
- // $FlowFixMe[prop-missing]
1879
- autoCompleteWebToTextContentTypeMap[autoComplete]
1880
- : textContentType
1879
+ autoComplete &&
1880
+ autoComplete in autoCompleteWebToTextContentTypeMap
1881
+ ? // $FlowFixMe[invalid-computed-prop]
1882
+ // $FlowFixMe[prop-missing]
1883
+ autoCompleteWebToTextContentTypeMap[autoComplete]
1884
+ : textContentType
1881
1885
  }
1882
1886
  {...restProps}
1883
1887
  forwardedRef={forwardedRef}
@@ -45,8 +45,8 @@ const extractSingleTouch = (nativeEvent: {
45
45
  return !hasTouches && hasChangedTouches
46
46
  ? changedTouches[0]
47
47
  : hasTouches
48
- ? touches[0]
49
- : nativeEvent;
48
+ ? touches[0]
49
+ : nativeEvent;
50
50
  };
51
51
 
52
52
  /**
@@ -131,7 +131,10 @@ const PASSTHROUGH_PROPS = [
131
131
  const TouchableWithoutFeedback: React.AbstractComponent<
132
132
  Props,
133
133
  React.ElementRef<typeof Animated.View>,
134
- > = React.forwardRef(function TouchableWithoutFeedback(props: Props, ref): React.Node {
134
+ > = React.forwardRef(function TouchableWithoutFeedback(
135
+ props: Props,
136
+ ref,
137
+ ): React.Node {
135
138
  const {
136
139
  disabled,
137
140
  rejectResponderTermination,
@@ -153,7 +156,6 @@ const TouchableWithoutFeedback: React.AbstractComponent<
153
156
  onMouseLeave, // [Windows]
154
157
  } = props;
155
158
 
156
-
157
159
  const pressabilityConfig = useMemo(
158
160
  () => ({
159
161
  cancelable: !rejectResponderTermination,
@@ -262,4 +264,4 @@ const TouchableWithoutFeedback: React.AbstractComponent<
262
264
  return React.cloneElement(element, {...elementProps, ref}, ...children);
263
265
  });
264
266
 
265
- module.exports = TouchableWithoutFeedback;
267
+ module.exports = TouchableWithoutFeedback;
@@ -294,7 +294,7 @@ const Text: React.AbstractComponent<
294
294
  style={processedStyle}
295
295
  />
296
296
  );
297
- // [Windows] Following else statement forked due to PR #5740
297
+ // [Windows] Following else statement forked due to PR #5740
298
298
  } else {
299
299
  let styleProps: ViewStyleProp = (style: any);
300
300
  if (
@@ -441,4 +441,4 @@ const verticalAlignToTextAlignVerticalMap = {
441
441
  middle: 'center',
442
442
  };
443
443
 
444
- module.exports = Text;
444
+ module.exports = Text;
@@ -70,10 +70,10 @@ const Platform: PlatformType = {
70
70
  ? // $FlowFixMe[incompatible-return]
71
71
  spec.windows
72
72
  : 'native' in spec
73
- ? // $FlowFixMe[incompatible-return]
74
- spec.native
75
- : // $FlowFixMe[incompatible-return]
76
- spec.default,
73
+ ? // $FlowFixMe[incompatible-return]
74
+ spec.native
75
+ : // $FlowFixMe[incompatible-return]
76
+ spec.default,
77
77
  };
78
78
 
79
79
  module.exports = Platform;
@@ -14,6 +14,7 @@
14
14
  #include <Fabric/Composition/RootComponentView.h>
15
15
  #include "AbiEventEmitter.h"
16
16
  #include "AbiShadowNode.h"
17
+ #include "ReactCoreInjection.h"
17
18
 
18
19
  namespace winrt::Microsoft::ReactNative::Composition::implementation {
19
20
  struct RootComponentView;
@@ -262,6 +263,17 @@ void ComponentView::HandleCommand(const winrt::Microsoft::ReactNative::HandleCom
262
263
  }
263
264
  }
264
265
 
266
+ HWND ComponentView::GetHwndForParenting() noexcept {
267
+ if (m_parent) {
268
+ return winrt::get_self<winrt::Microsoft::ReactNative::implementation::ComponentView>(m_parent)
269
+ ->GetHwndForParenting();
270
+ }
271
+
272
+ // Fallback if we do not know any more specific HWND
273
+ return reinterpret_cast<HWND>(winrt::Microsoft::ReactNative::implementation::ReactCoreInjection::GetTopLevelWindowId(
274
+ m_reactContext.Properties().Handle()));
275
+ }
276
+
265
277
  winrt::Microsoft::ReactNative::Composition::implementation::RootComponentView *ComponentView::rootComponentView()
266
278
  const noexcept {
267
279
  if (m_rootView)
@@ -209,6 +209,9 @@ struct ComponentView : public ComponentViewT<ComponentView> {
209
209
  // Notify up the tree to bring the rect into view by scrolling as needed
210
210
  virtual void StartBringIntoView(BringIntoViewOptions &&args) noexcept;
211
211
 
212
+ // Eventually PopupContentLink and similar APIs will remove the need for this.
213
+ virtual HWND GetHwndForParenting() noexcept;
214
+
212
215
  virtual const winrt::Microsoft::ReactNative::IComponentProps userProps(
213
216
  facebook::react::Props::Shared const &props) noexcept;
214
217
 
@@ -125,6 +125,22 @@ HRESULT __stdcall CompositionDynamicAutomationProvider::get_ProviderOptions(Prov
125
125
  return S_OK;
126
126
  }
127
127
 
128
+ bool accessibilityValueHasValue(const facebook::react::AccessibilityValue &value) {
129
+ return (value.min.has_value() && value.max.has_value()) || value.now.has_value() || value.text.has_value();
130
+ }
131
+
132
+ bool expandableControl(const facebook::react::SharedViewProps props) {
133
+ if (props->accessibilityState.has_value() && props->accessibilityState->expanded.has_value())
134
+ return true;
135
+ auto accessibilityActions = props->accessibilityActions;
136
+ for (size_t i = 0; i < accessibilityActions.size(); i++) {
137
+ if (accessibilityActions[i].name == "expand" || accessibilityActions[i].name == "collapse") {
138
+ return true;
139
+ }
140
+ }
141
+ return false;
142
+ }
143
+
128
144
  HRESULT __stdcall CompositionDynamicAutomationProvider::GetPatternProvider(PATTERNID patternId, IUnknown **pRetVal) {
129
145
  if (pRetVal == nullptr)
130
146
  return E_POINTER;
@@ -165,6 +181,15 @@ HRESULT __stdcall CompositionDynamicAutomationProvider::GetPatternProvider(PATTE
165
181
  AddRef();
166
182
  }
167
183
 
184
+ if (patternId == UIA_ExpandCollapsePatternId &&
185
+ (accessibilityRole == "combobox" || accessibilityRole == "splitbutton" || accessibilityRole == "treeitem" ||
186
+ (expandableControl(props) &&
187
+ (accessibilityRole == "toolbar" || accessibilityRole == "menuitem" || accessibilityRole == "menubar" ||
188
+ accessibilityRole == "listitem" || accessibilityRole == "group" || accessibilityRole == "button")))) {
189
+ *pRetVal = static_cast<IExpandCollapseProvider *>(this);
190
+ AddRef();
191
+ }
192
+
168
193
  return S_OK;
169
194
  }
170
195
 
@@ -333,6 +358,13 @@ HRESULT __stdcall CompositionDynamicAutomationProvider::GetPropertyValue(PROPERT
333
358
  pRetVal->lVal = GetLiveSetting(props->accessibilityLiveRegion);
334
359
  break;
335
360
  }
361
+ case UIA_ItemStatusPropertyId: {
362
+ pRetVal->vt = VT_BSTR;
363
+ pRetVal->bstrVal = (props->accessibilityState.has_value() && props->accessibilityState->busy)
364
+ ? SysAllocString(L"Busy")
365
+ : SysAllocString(L"");
366
+ break;
367
+ }
336
368
  }
337
369
 
338
370
  return hr;
@@ -464,4 +496,42 @@ HRESULT __stdcall CompositionDynamicAutomationProvider::Toggle() {
464
496
  return S_OK;
465
497
  }
466
498
 
499
+ HRESULT __stdcall CompositionDynamicAutomationProvider::get_ExpandCollapseState(ExpandCollapseState *pRetVal) {
500
+ if (pRetVal == nullptr)
501
+ return E_POINTER;
502
+ auto strongView = m_view.view();
503
+
504
+ if (!strongView)
505
+ return UIA_E_ELEMENTNOTAVAILABLE;
506
+
507
+ auto props = std::static_pointer_cast<const facebook::react::ViewProps>(
508
+ winrt::get_self<winrt::Microsoft::ReactNative::implementation::ComponentView>(strongView)->props());
509
+
510
+ if (props == nullptr)
511
+ return UIA_E_ELEMENTNOTAVAILABLE;
512
+
513
+ *pRetVal = props->accessibilityState->expanded.has_value()
514
+ ? GetExpandCollapseState(props->accessibilityState->expanded.value())
515
+ : ExpandCollapseState_Collapsed;
516
+ return S_OK;
517
+ }
518
+
519
+ HRESULT __stdcall CompositionDynamicAutomationProvider::Expand() {
520
+ auto strongView = m_view.view();
521
+
522
+ if (!strongView)
523
+ return UIA_E_ELEMENTNOTAVAILABLE;
524
+ DispatchAccessibilityAction(m_view, "expand");
525
+ return S_OK;
526
+ }
527
+
528
+ HRESULT __stdcall CompositionDynamicAutomationProvider::Collapse() {
529
+ auto strongView = m_view.view();
530
+
531
+ if (!strongView)
532
+ return UIA_E_ELEMENTNOTAVAILABLE;
533
+ DispatchAccessibilityAction(m_view, "collapse");
534
+ return S_OK;
535
+ }
536
+
467
537
  } // namespace winrt::Microsoft::ReactNative::implementation
@@ -16,7 +16,8 @@ class CompositionDynamicAutomationProvider : public winrt::implements<
16
16
  IInvokeProvider,
17
17
  IScrollItemProvider,
18
18
  IValueProvider,
19
- IToggleProvider> {
19
+ IToggleProvider,
20
+ IExpandCollapseProvider> {
20
21
  public:
21
22
  CompositionDynamicAutomationProvider(
22
23
  const winrt::Microsoft::ReactNative::Composition::ComponentView &componentView) noexcept;
@@ -47,10 +48,15 @@ class CompositionDynamicAutomationProvider : public winrt::implements<
47
48
  virtual HRESULT __stdcall get_Value(BSTR *pRetVal) override;
48
49
  virtual HRESULT __stdcall get_IsReadOnly(BOOL *pRetVal) override;
49
50
 
50
- // inherited via IToggleProivder
51
+ // inherited via IToggleProvider
51
52
  virtual HRESULT __stdcall get_ToggleState(ToggleState *pRetVal) override;
52
53
  virtual HRESULT __stdcall Toggle() override;
53
54
 
55
+ // inherited via IExpandCollapseProvider
56
+ virtual HRESULT __stdcall get_ExpandCollapseState(ExpandCollapseState *pRetVal) override;
57
+ virtual HRESULT __stdcall Expand() override;
58
+ virtual HRESULT __stdcall Collapse() override;
59
+
54
60
  private:
55
61
  ::Microsoft::ReactNative::ReactTaggedView m_view;
56
62
  };
@@ -23,6 +23,7 @@
23
23
  #include "CompositionHelpers.h"
24
24
  #include "RootComponentView.h"
25
25
  #include "Theme.h"
26
+ #include "TooltipService.h"
26
27
  #include "UiaHelpers.h"
27
28
  #include "d2d1helper.h"
28
29
 
@@ -43,6 +44,13 @@ ComponentView::ComponentView(
43
44
  m_outerVisual.InsertAt(m_focusVisual.InnerVisual(), 0);
44
45
  }
45
46
 
47
+ ComponentView::~ComponentView() {
48
+ if (m_tooltipTracked) {
49
+ TooltipService::GetCurrent(m_reactContext.Properties())->StopTracking(*this);
50
+ m_tooltipTracked = false;
51
+ }
52
+ }
53
+
46
54
  facebook::react::Tag ComponentView::Tag() const noexcept {
47
55
  return m_tag;
48
56
  }
@@ -130,6 +138,16 @@ void ComponentView::updateProps(
130
138
  updateShadowProps(oldViewProps, newViewProps);
131
139
  }
132
140
 
141
+ if (oldViewProps.tooltip != newViewProps.tooltip) {
142
+ if (!m_tooltipTracked && newViewProps.tooltip) {
143
+ TooltipService::GetCurrent(m_reactContext.Properties())->StartTracking(*this);
144
+ m_tooltipTracked = true;
145
+ } else if (m_tooltipTracked && !newViewProps.tooltip) {
146
+ TooltipService::GetCurrent(m_reactContext.Properties())->StopTracking(*this);
147
+ m_tooltipTracked = false;
148
+ }
149
+ }
150
+
133
151
  base_type::updateProps(props, oldProps);
134
152
  }
135
153
 
@@ -1291,6 +1309,12 @@ void ComponentView::updateAccessibilityProps(
1291
1309
  !(oldViewProps.accessibilityState && oldViewProps.accessibilityState->disabled),
1292
1310
  !(newViewProps.accessibilityState && newViewProps.accessibilityState->disabled));
1293
1311
 
1312
+ winrt::Microsoft::ReactNative::implementation::UpdateUiaProperty(
1313
+ m_uiaProvider,
1314
+ UIA_IsEnabledPropertyId,
1315
+ !(oldViewProps.accessibilityState && oldViewProps.accessibilityState->busy),
1316
+ !(newViewProps.accessibilityState && newViewProps.accessibilityState->busy));
1317
+
1294
1318
  winrt::Microsoft::ReactNative::implementation::UpdateUiaProperty(
1295
1319
  m_uiaProvider, UIA_ControlTypePropertyId, oldViewProps.accessibilityRole, newViewProps.accessibilityRole);
1296
1320
 
@@ -30,6 +30,7 @@ struct ComponentView : public ComponentViewT<
30
30
  facebook::react::Tag tag,
31
31
  winrt::Microsoft::ReactNative::ReactContext const &reactContext,
32
32
  ComponentViewFeatures flags);
33
+ virtual ~ComponentView();
33
34
 
34
35
  virtual winrt::Microsoft::ReactNative::Composition::Experimental::IVisual Visual() const noexcept {
35
36
  return nullptr;
@@ -151,6 +152,7 @@ struct ComponentView : public ComponentViewT<
151
152
  const facebook::react::ViewProps &viewProps) noexcept;
152
153
 
153
154
  bool m_FinalizeTransform{false};
155
+ bool m_tooltipTracked{false};
154
156
  ComponentViewFeatures m_flags;
155
157
  void showFocusVisual(bool show) noexcept;
156
158
  winrt::Microsoft::ReactNative::Composition::Experimental::IFocusVisual m_focusVisual{nullptr};
@@ -157,6 +157,7 @@ void ReactNativeIsland::ReactViewHost(winrt::Microsoft::ReactNative::IReactViewH
157
157
  }
158
158
 
159
159
  if (m_reactViewHost) {
160
+ UninitRootView();
160
161
  m_reactViewHost.DetachViewInstance();
161
162
  }
162
163
 
@@ -332,7 +333,7 @@ winrt::IInspectable ReactNativeIsland::GetUiaProvider() noexcept {
332
333
  if (m_uiaProvider == nullptr) {
333
334
  m_uiaProvider =
334
335
  winrt::make<winrt::Microsoft::ReactNative::implementation::CompositionRootAutomationProvider>(*this);
335
- if (m_hwnd) {
336
+ if (m_hwnd && !m_island) {
336
337
  auto pRootProvider =
337
338
  static_cast<winrt::Microsoft::ReactNative::implementation::CompositionRootAutomationProvider *>(
338
339
  m_uiaProvider.as<IRawElementProviderSimple>().get());
@@ -348,6 +349,10 @@ void ReactNativeIsland::SetWindow(uint64_t hwnd) noexcept {
348
349
  m_hwnd = reinterpret_cast<HWND>(hwnd);
349
350
  }
350
351
 
352
+ HWND ReactNativeIsland::GetHwndForParenting() noexcept {
353
+ return m_hwnd;
354
+ }
355
+
351
356
  int64_t ReactNativeIsland::SendMessage(uint32_t msg, uint64_t wParam, int64_t lParam) noexcept {
352
357
  if (m_rootTag == -1)
353
358
  return 0;
@@ -367,7 +372,7 @@ int64_t ReactNativeIsland::SendMessage(uint32_t msg, uint64_t wParam, int64_t lP
367
372
  bool ReactNativeIsland::CapturePointer(
368
373
  const winrt::Microsoft::ReactNative::Composition::Input::Pointer &pointer,
369
374
  facebook::react::Tag tag) noexcept {
370
- if (m_hwnd) {
375
+ if (m_hwnd && !m_island) {
371
376
  SetCapture(m_hwnd);
372
377
  }
373
378
  return m_CompositionEventHandler->CapturePointer(pointer, tag);
@@ -377,7 +382,7 @@ void ReactNativeIsland::ReleasePointerCapture(
377
382
  const winrt::Microsoft::ReactNative::Composition::Input::Pointer &pointer,
378
383
  facebook::react::Tag tag) noexcept {
379
384
  if (m_CompositionEventHandler->ReleasePointerCapture(pointer, tag)) {
380
- if (m_hwnd) {
385
+ if (m_hwnd && !m_island) {
381
386
  if (m_hwnd == GetCapture()) {
382
387
  ReleaseCapture();
383
388
  }
@@ -82,6 +82,7 @@ struct ReactNativeIsland
82
82
  void AddRenderedVisual(const winrt::Microsoft::ReactNative::Composition::Experimental::IVisual &visual) noexcept;
83
83
  void RemoveRenderedVisual(const winrt::Microsoft::ReactNative::Composition::Experimental::IVisual &visual) noexcept;
84
84
  bool TrySetFocus() noexcept;
85
+ HWND GetHwndForParenting() noexcept;
85
86
 
86
87
  winrt::Microsoft::ReactNative::Composition::ICustomResourceLoader Resources() noexcept;
87
88
  void Resources(const winrt::Microsoft::ReactNative::Composition::ICustomResourceLoader &resources) noexcept;
@@ -231,4 +231,15 @@ winrt::Microsoft::ReactNative::implementation::ClipState RootComponentView::getC
231
231
  return winrt::Microsoft::ReactNative::implementation::ClipState::NoClip;
232
232
  }
233
233
 
234
+ HWND RootComponentView::GetHwndForParenting() noexcept {
235
+ if (auto rootView = m_wkRootView.get()) {
236
+ auto hwnd = winrt::get_self<winrt::Microsoft::ReactNative::implementation::ReactNativeIsland>(rootView)
237
+ ->GetHwndForParenting();
238
+ if (hwnd)
239
+ return hwnd;
240
+ }
241
+
242
+ return base_type::GetHwndForParenting();
243
+ }
244
+
234
245
  } // namespace winrt::Microsoft::ReactNative::Composition::implementation
@@ -64,6 +64,8 @@ struct RootComponentView : RootComponentViewT<RootComponentView, ViewComponentVi
64
64
  winrt::Microsoft::ReactNative::ComponentView FindFirstFocusableElement() noexcept;
65
65
  winrt::Microsoft::ReactNative::ComponentView FindLastFocusableElement() noexcept;
66
66
 
67
+ HWND GetHwndForParenting() noexcept override;
68
+
67
69
  private:
68
70
  // should this be a ReactTaggedView? - It shouldn't actually matter since if the view is going away it should always
69
71
  // be clearing its focus But being a reactTaggedView might make it easier to identify cases where that isn't
@@ -16,7 +16,7 @@
16
16
  namespace winrt::Microsoft::ReactNative::Composition {
17
17
 
18
18
  void RenderText(
19
- ID2D1DeviceContext &deviceContext,
19
+ ID2D1RenderTarget &deviceContext,
20
20
  ::IDWriteTextLayout &textLayout,
21
21
  const facebook::react::AttributedString &attributedString,
22
22
  const facebook::react::TextAttributes &textAttributes,
@@ -26,7 +26,6 @@ void RenderText(
26
26
  float offsetX = offset.x / pointScaleFactor;
27
27
  float offsetY = offset.y / pointScaleFactor;
28
28
 
29
- assert(deviceContext.GetUnitMode() == D2D1_UNIT_MODE_DIPS);
30
29
  const auto dpi = pointScaleFactor * 96.0f;
31
30
  float oldDpiX, oldDpiY;
32
31
  deviceContext.GetDpi(&oldDpiX, &oldDpiY);
@@ -14,7 +14,7 @@
14
14
  namespace winrt::Microsoft::ReactNative::Composition {
15
15
 
16
16
  void RenderText(
17
- ID2D1DeviceContext &deviceContext,
17
+ ID2D1RenderTarget &deviceContext,
18
18
  ::IDWriteTextLayout &textLayout,
19
19
  const facebook::react::AttributedString &attributedString,
20
20
  const facebook::react::TextAttributes &textAttributes,
@@ -296,7 +296,9 @@ bool Theme::TryGetPlatformColor(const std::string &platformColor, winrt::Windows
296
296
  {"ScrollBarThumbFillDisabled", "ControlStrongFillColorDisabled"},
297
297
  {"ScrollBarTrackFill",
298
298
  "AcrylicInAppFillColorDefault"}, // TODO make AcrylicInAppFillColorDefault a real acrylic brush
299
- };
299
+ {"ToolTipBackground", "SystemChromeMediumLowColor"},
300
+ {"ToolTipForeground", "SystemControlForegroundBaseHighColor"},
301
+ {"ToolTipBorderBrush", "SystemControlTransientBorderColor"}};
300
302
 
301
303
  static std::unordered_map<std::string, winrt::Windows::UI::Color, std::hash<std::string_view>, std::equal_to<>>
302
304
  s_lightColors = {
@@ -326,7 +328,9 @@ bool Theme::TryGetPlatformColor(const std::string &platformColor, winrt::Windows
326
328
  {"ControlStrongFillColorDefault", {0x72, 0x00, 0x00, 0x00}},
327
329
  {"ControlStrongFillColorDisabled", {0x51, 0x00, 0x00, 0x00}},
328
330
  {"AcrylicInAppFillColorDefault", {0x9E, 0xFF, 0xFF, 0xFF}},
329
- };
331
+ {"SystemChromeMediumLowColor", {0xFF, 0xF2, 0xF2, 0xF2}},
332
+ {"SystemControlForegroundBaseHighColor", {0xFF, 0x00, 0x00, 0x00}},
333
+ {"SystemControlTransientBorderColor", {0x24, 0x00, 0x00, 0x00}}};
330
334
 
331
335
  static std::unordered_map<std::string, winrt::Windows::UI::Color, std::hash<std::string_view>, std::equal_to<>>
332
336
  s_darkColors = {
@@ -356,7 +360,9 @@ bool Theme::TryGetPlatformColor(const std::string &platformColor, winrt::Windows
356
360
  {"ControlStrongFillColorDefault", {0x8B, 0xFF, 0xFF, 0xFF}},
357
361
  {"ControlStrongFillColorDisabled", {0x3F, 0xFF, 0xFF, 0xFF}},
358
362
  {"AcrylicInAppFillColorDefault", {0x9E, 0x00, 0x00, 0x00}},
359
- };
363
+ {"SystemChromeMediumLowColor", {0xFF, 0x2B, 0x2B, 0x2B}},
364
+ {"SystemControlForegroundBaseHighColor", {0xFF, 0xFF, 0xFF, 0xFF}},
365
+ {"SystemControlTransientBorderColor", {0x5C, 0x00, 0x00, 0x00}}};
360
366
 
361
367
  static std::unordered_map<
362
368
  std::string,
@@ -391,7 +397,9 @@ bool Theme::TryGetPlatformColor(const std::string &platformColor, winrt::Windows
391
397
  {"SubtleFillColorSecondary", {winrt::Windows::UI::ViewManagement::UIElementType::ButtonFace, {}}},
392
398
  {"ControlStrongFillColorDefault", {winrt::Windows::UI::ViewManagement::UIElementType::ButtonFace, {}}},
393
399
  {"ControlStrongFillColorDisabled", {winrt::Windows::UI::ViewManagement::UIElementType::ButtonFace, {}}},
394
- };
400
+ {"SystemChromeMediumLowColor", {winrt::Windows::UI::ViewManagement::UIElementType::ButtonFace, {}}},
401
+ {"SystemControlForegroundBaseHighColor", {winrt::Windows::UI::ViewManagement::UIElementType::ButtonText, {}}},
402
+ {"SystemControlTransientBorderColor", {winrt::Windows::UI::ViewManagement::UIElementType::ButtonText, {}}}};
395
403
 
396
404
  auto alias = s_xamlAliasedColors.find(platformColor);
397
405
  if (alias != s_xamlAliasedColors.end()) {