react-native-windows 0.82.0-preview.1 → 0.82.0-preview.10

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 (56) hide show
  1. package/Libraries/Animated/nodes/AnimatedValue.js +0 -8
  2. package/Libraries/BatchedBridge/BatchedBridge.js +1 -0
  3. package/Libraries/BatchedBridge/MessageQueue.js +1 -0
  4. package/Libraries/Components/Switch/Switch.js +1 -1
  5. package/Libraries/Components/Switch/Switch.windows.js +1 -1
  6. package/Libraries/Core/ReactNativeVersion.js +2 -2
  7. package/Libraries/Core/Timers/JSTimers.js +1 -0
  8. package/Libraries/Core/Timers/NativeTiming.js +1 -0
  9. package/Libraries/Core/Timers/immediateShim.js +1 -0
  10. package/Libraries/Core/setUpPerformance.js +3 -5
  11. package/Libraries/Interaction/PanResponder.js +6 -51
  12. package/Microsoft.ReactNative/ComponentView.idl +2 -0
  13. package/Microsoft.ReactNative/Composition.Input.idl +7 -0
  14. package/Microsoft.ReactNative/Fabric/ComponentView.cpp +18 -0
  15. package/Microsoft.ReactNative/Fabric/ComponentView.h +9 -0
  16. package/Microsoft.ReactNative/Fabric/Composition/Composition.Input.cpp +12 -0
  17. package/Microsoft.ReactNative/Fabric/Composition/Composition.Input.h +15 -0
  18. package/Microsoft.ReactNative/Fabric/Composition/CompositionEventHandler.cpp +75 -0
  19. package/Microsoft.ReactNative/Fabric/Composition/CompositionEventHandler.h +1 -0
  20. package/Microsoft.ReactNative/Fabric/Composition/ContentIslandComponentView.cpp +6 -67
  21. package/Microsoft.ReactNative/Fabric/Composition/ContentIslandComponentView.h +0 -4
  22. package/Microsoft.ReactNative/Fabric/Composition/ParagraphComponentView.cpp +82 -14
  23. package/Microsoft.ReactNative/Fabric/Composition/ParagraphComponentView.h +11 -4
  24. package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.cpp +59 -31
  25. package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.h +3 -0
  26. package/Microsoft.ReactNative/Modules/ImageViewManagerModule.cpp +42 -15
  27. package/Microsoft.ReactNative.Cxx/ReactCommon/react/timing/primitives.h +12 -0
  28. package/PropertySheets/Generated/PackageVersion.g.props +2 -2
  29. package/PropertySheets/Warnings.props +1 -2
  30. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/text/BaseParagraphProps.cpp +174 -0
  31. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/text/BaseParagraphProps.h +69 -0
  32. package/Scripts/rnw-dependencies.ps1 +15 -1
  33. package/Shared/Shared.vcxitems +1 -0
  34. package/Shared/Shared.vcxitems.filters +1 -3
  35. package/codegen/NativePerformanceSpec.g.h +41 -35
  36. package/codegen/NativeReactNativeFeatureFlagsSpec.g.h +55 -49
  37. package/codegen/rnwcoreJSI-generated.cpp +434 -422
  38. package/codegen/rnwcoreJSI.h +18 -0
  39. package/index.js +6 -0
  40. package/index.windows.js +6 -0
  41. package/package.json +15 -14
  42. package/src/private/featureflags/ReactNativeFeatureFlags.js +6 -1
  43. package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +2 -1
  44. package/src/private/setup/{setUpPerformanceObserver.js → setUpPerformanceModern.js} +43 -18
  45. package/src/private/specs_DEPRECATED/components/SwitchNativeComponent.js +1 -0
  46. package/src/private/specs_DEPRECATED/modules/NativeTiming.js +1 -0
  47. package/src/private/webapis/performance/EventTiming.js +34 -15
  48. package/src/private/webapis/performance/LongTasks.js +35 -2
  49. package/src/private/webapis/performance/Performance.js +49 -13
  50. package/src/private/webapis/performance/PerformanceEntry.js +21 -8
  51. package/src/private/webapis/performance/PerformanceObserver.js +30 -1
  52. package/src/private/webapis/performance/ReactNativeStartupTiming.js +3 -24
  53. package/src/private/webapis/performance/ResourceTiming.js +29 -18
  54. package/src/private/webapis/performance/UserTiming.js +33 -28
  55. package/src/private/webapis/performance/internals/RawPerformanceEntry.js +3 -4
  56. package/src/private/webapis/performance/specs/NativePerformance.js +2 -0
@@ -18,7 +18,6 @@ import type {AnimatedNodeConfig} from './AnimatedNode';
18
18
  import type AnimatedTracking from './AnimatedTracking';
19
19
 
20
20
  import NativeAnimatedHelper from '../../../src/private/animated/NativeAnimatedHelper';
21
- import InteractionManager from '../../Interaction/InteractionManager';
22
21
  import AnimatedInterpolation from './AnimatedInterpolation';
23
22
  import AnimatedWithChildren from './AnimatedWithChildren';
24
23
 
@@ -312,10 +311,6 @@ export default class AnimatedValue extends AnimatedWithChildren {
312
311
  * See https://reactnative.dev/docs/animatedvalue#animate
313
312
  */
314
313
  animate(animation: Animation, callback: ?EndCallback): void {
315
- let handle = null;
316
- if (animation.__isInteraction) {
317
- handle = InteractionManager.createInteractionHandle();
318
- }
319
314
  const previousAnimation = this._animation;
320
315
  this._animation && this._animation.stop();
321
316
  this._animation = animation;
@@ -328,9 +323,6 @@ export default class AnimatedValue extends AnimatedWithChildren {
328
323
  },
329
324
  result => {
330
325
  this._animation = null;
331
- if (handle !== null) {
332
- InteractionManager.clearInteractionHandle(handle);
333
- }
334
326
  callback && callback(result);
335
327
  },
336
328
  previousAnimation,
@@ -6,6 +6,7 @@
6
6
  *
7
7
  * @flow strict
8
8
  * @format
9
+ * @deprecated
9
10
  */
10
11
 
11
12
  'use strict';
@@ -6,6 +6,7 @@
6
6
  *
7
7
  * @flow strict
8
8
  * @format
9
+ * @deprecated
9
10
  */
10
11
 
11
12
  'use strict';
@@ -264,7 +264,7 @@ const Switch: component(
264
264
  disabled,
265
265
  onTintColor: trackColorForTrue,
266
266
  style: StyleSheet.compose(
267
- {height: 31, width: 51},
267
+ {alignSelf: 'flex-start' as const},
268
268
  StyleSheet.compose(
269
269
  style,
270
270
  ios_backgroundColor == null
@@ -272,7 +272,7 @@ const Switch: component(
272
272
  disabled,
273
273
  onTintColor: trackColorForTrue,
274
274
  style: StyleSheet.compose(
275
- {height: 31, width: 51},
275
+ {height: 31, width: 51}, // #windows
276
276
  StyleSheet.compose(
277
277
  style,
278
278
  ios_backgroundColor == null
@@ -28,8 +28,8 @@
28
28
  export default class ReactNativeVersion {
29
29
  static major: number = 0;
30
30
  static minor: number = 82;
31
- static patch: number = 0;
32
- static prerelease: string | null = 'rc.0';
31
+ static patch: number = 1;
32
+ static prerelease: string | null = null;
33
33
 
34
34
  static getVersionString(): string {
35
35
  return `${this.major}.${this.minor}.${this.patch}${this.prerelease != null ? `-${this.prerelease}` : ''}`;
@@ -6,6 +6,7 @@
6
6
  *
7
7
  * @flow
8
8
  * @format
9
+ * @deprecated
9
10
  */
10
11
 
11
12
  import NativeTiming from './NativeTiming';
@@ -6,6 +6,7 @@
6
6
  *
7
7
  * @flow strict
8
8
  * @format
9
+ * @deprecated
9
10
  */
10
11
 
11
12
  export * from '../../../src/private/specs_DEPRECATED/modules/NativeTiming';
@@ -6,6 +6,7 @@
6
6
  *
7
7
  * @flow
8
8
  * @format
9
+ * @deprecated
9
10
  */
10
11
 
11
12
  'use strict';
@@ -4,19 +4,17 @@
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
7
+ * @flow strict-local
8
8
  * @format
9
9
  */
10
10
 
11
+ import setUpPerformanceModern from '../../src/private/setup/setUpPerformanceModern';
11
12
  import NativePerformance from '../../src/private/webapis/performance/specs/NativePerformance';
12
13
 
13
14
  // In case if the native implementation of the Performance API is available, use it,
14
15
  // otherwise fall back to the legacy/default one, which only defines 'Performance.now()'
15
16
  if (NativePerformance) {
16
- const Performance =
17
- require('../../src/private/webapis/performance/Performance').default;
18
- // $FlowExpectedError[cannot-write]
19
- global.performance = new Performance();
17
+ setUpPerformanceModern();
20
18
  } else {
21
19
  if (!global.performance) {
22
20
  // $FlowExpectedError[cannot-write]
@@ -12,7 +12,6 @@
12
12
 
13
13
  import type {GestureResponderEvent} from '../Types/CoreEventTypes';
14
14
 
15
- const InteractionManager = require('./InteractionManager').default;
16
15
  const TouchHistoryMath = require('./TouchHistoryMath').default;
17
16
 
18
17
  const currentCentroidXOfTouchesChangedAfter =
@@ -31,9 +30,6 @@ const currentCentroidY = TouchHistoryMath.currentCentroidY;
31
30
  * single-touch gestures resilient to extra touches, and can be used to
32
31
  * recognize simple multi-touch gestures.
33
32
  *
34
- * By default, `PanResponder` holds an `InteractionManager` handle to block
35
- * long-running JS events from interrupting active gestures.
36
- *
37
33
  * It provides a predictable wrapper of the responder handlers provided by the
38
34
  * [gesture responder system](docs/gesture-responder-system.html).
39
35
  * For each handler, it provides a new `gestureState` object alongside the
@@ -405,9 +401,6 @@ const PanResponder = {
405
401
  getInteractionHandle: () => ?number,
406
402
  panHandlers: GestureResponderHandlerMethods,
407
403
  } {
408
- const interactionState = {
409
- handle: (null: ?number),
410
- };
411
404
  const gestureState: PanResponderGestureState = {
412
405
  // Useful for debugging
413
406
  stateID: Math.random(),
@@ -464,10 +457,6 @@ const PanResponder = {
464
457
  },
465
458
 
466
459
  onResponderGrant(event: GestureResponderEvent): boolean {
467
- if (!interactionState.handle) {
468
- interactionState.handle =
469
- InteractionManager.createInteractionHandle();
470
- }
471
460
  gestureState.x0 = currentCentroidX(event.touchHistory);
472
461
  gestureState.y0 = currentCentroidY(event.touchHistory);
473
462
  gestureState.dx = 0;
@@ -482,21 +471,11 @@ const PanResponder = {
482
471
  },
483
472
 
484
473
  onResponderReject(event: GestureResponderEvent): void {
485
- clearInteractionHandle(
486
- interactionState,
487
- config.onPanResponderReject,
488
- event,
489
- gestureState,
490
- );
474
+ config.onPanResponderReject?.call(undefined, event, gestureState);
491
475
  },
492
476
 
493
477
  onResponderRelease(event: GestureResponderEvent): void {
494
- clearInteractionHandle(
495
- interactionState,
496
- config.onPanResponderRelease,
497
- event,
498
- gestureState,
499
- );
478
+ config.onPanResponderRelease?.call(undefined, event, gestureState);
500
479
  PanResponder._initializeGestureState(gestureState);
501
480
  },
502
481
 
@@ -529,21 +508,11 @@ const PanResponder = {
529
508
  onResponderEnd(event: GestureResponderEvent): void {
530
509
  const touchHistory = event.touchHistory;
531
510
  gestureState.numberActiveTouches = touchHistory.numberActiveTouches;
532
- clearInteractionHandle(
533
- interactionState,
534
- config.onPanResponderEnd,
535
- event,
536
- gestureState,
537
- );
511
+ config.onPanResponderEnd?.call(undefined, event, gestureState);
538
512
  },
539
513
 
540
514
  onResponderTerminate(event: GestureResponderEvent): void {
541
- clearInteractionHandle(
542
- interactionState,
543
- config.onPanResponderTerminate,
544
- event,
545
- gestureState,
546
- );
515
+ config.onPanResponderTerminate?.call(undefined, event, gestureState);
547
516
  PanResponder._initializeGestureState(gestureState);
548
517
  },
549
518
 
@@ -556,27 +525,13 @@ const PanResponder = {
556
525
  return {
557
526
  panHandlers,
558
527
  getInteractionHandle(): ?number {
559
- return interactionState.handle;
528
+ // TODO: Deprecate and delete this method.
529
+ return null;
560
530
  },
561
531
  };
562
532
  },
563
533
  };
564
534
 
565
- function clearInteractionHandle(
566
- interactionState: {handle: ?number, ...},
567
- callback: ?(ActiveCallback | PassiveCallback),
568
- event: GestureResponderEvent,
569
- gestureState: PanResponderGestureState,
570
- ) {
571
- if (interactionState.handle) {
572
- InteractionManager.clearInteractionHandle(interactionState.handle);
573
- interactionState.handle = null;
574
- }
575
- if (callback) {
576
- callback(event, gestureState);
577
- }
578
- }
579
-
580
535
  export type PanResponderInstance = ReturnType<(typeof PanResponder)['create']>;
581
536
 
582
537
  export default PanResponder;
@@ -106,6 +106,8 @@ namespace Microsoft.ReactNative
106
106
  DOC_STRING("Used to handle key up events when this component is focused, or if a child component did not handle the key up")
107
107
  event Windows.Foundation.EventHandler<Microsoft.ReactNative.Composition.Input.KeyRoutedEventArgs> KeyUp;
108
108
  event Windows.Foundation.EventHandler<Microsoft.ReactNative.Composition.Input.CharacterReceivedRoutedEventArgs> CharacterReceived;
109
+ DOC_STRING("Used to handle context menu key events (SHIFT+F10 or Context Menu key) when this component is focused")
110
+ event Windows.Foundation.EventHandler<Microsoft.ReactNative.Composition.Input.ContextMenuKeyEventArgs> ContextMenuKey;
109
111
  event Windows.Foundation.EventHandler<Microsoft.ReactNative.Composition.Input.PointerRoutedEventArgs> PointerPressed;
110
112
  event Windows.Foundation.EventHandler<Microsoft.ReactNative.Composition.Input.PointerRoutedEventArgs> PointerReleased;
111
113
  event Windows.Foundation.EventHandler<Microsoft.ReactNative.Composition.Input.PointerRoutedEventArgs> PointerMoved;
@@ -34,6 +34,13 @@ namespace Microsoft.ReactNative.Composition.Input
34
34
  KeyboardSource KeyboardSource { get; };
35
35
  };
36
36
 
37
+ DOC_STRING("Event arguments for context menu key events (SHIFT+F10 or Context Menu key)")
38
+ interface ContextMenuKeyEventArgs requires RoutedEventArgs
39
+ {
40
+ DOC_STRING("Gets or sets whether the event was handled. Set to true to prevent default behavior.")
41
+ Boolean Handled { get; set; };
42
+ };
43
+
37
44
  interface IPointerPointTransform
38
45
  {
39
46
  IPointerPointTransform Inverse { get; };
@@ -469,6 +469,16 @@ void ComponentView::CharacterReceived(winrt::event_token const &token) noexcept
469
469
  m_characterReceivedEvent.remove(token);
470
470
  }
471
471
 
472
+ winrt::event_token ComponentView::ContextMenuKey(
473
+ winrt::Windows::Foundation::EventHandler<
474
+ winrt::Microsoft::ReactNative::Composition::Input::ContextMenuKeyEventArgs> const &handler) noexcept {
475
+ return m_contextMenuKeyEvent.add(handler);
476
+ }
477
+
478
+ void ComponentView::ContextMenuKey(winrt::event_token const &token) noexcept {
479
+ m_contextMenuKeyEvent.remove(token);
480
+ }
481
+
472
482
  winrt::event_token ComponentView::PointerPressed(
473
483
  winrt::Windows::Foundation::EventHandler<
474
484
  winrt::Microsoft::ReactNative::Composition::Input::PointerRoutedEventArgs> const &handler) noexcept {
@@ -609,6 +619,14 @@ void ComponentView::OnCharacterReceived(
609
619
  }
610
620
  }
611
621
 
622
+ void ComponentView::OnContextMenuKey(
623
+ const winrt::Microsoft::ReactNative::Composition::Input::ContextMenuKeyEventArgs &args) noexcept {
624
+ m_contextMenuKeyEvent(*this, args);
625
+ if (m_parent && !args.Handled()) {
626
+ winrt::get_self<winrt::Microsoft::ReactNative::implementation::ComponentView>(m_parent)->OnContextMenuKey(args);
627
+ }
628
+ }
629
+
612
630
  bool ComponentView::focusable() const noexcept {
613
631
  return false;
614
632
  }
@@ -167,6 +167,10 @@ struct ComponentView
167
167
  winrt::Windows::Foundation::EventHandler<
168
168
  winrt::Microsoft::ReactNative::Composition::Input::CharacterReceivedRoutedEventArgs> const &handler) noexcept;
169
169
  void CharacterReceived(winrt::event_token const &token) noexcept;
170
+ winrt::event_token ContextMenuKey(
171
+ winrt::Windows::Foundation::EventHandler<
172
+ winrt::Microsoft::ReactNative::Composition::Input::ContextMenuKeyEventArgs> const &handler) noexcept;
173
+ void ContextMenuKey(winrt::event_token const &token) noexcept;
170
174
  winrt::event_token PointerPressed(
171
175
  winrt::Windows::Foundation::EventHandler<
172
176
  winrt::Microsoft::ReactNative::Composition::Input::PointerRoutedEventArgs> const &handler) noexcept;
@@ -253,6 +257,8 @@ struct ComponentView
253
257
  virtual void OnKeyUp(const winrt::Microsoft::ReactNative::Composition::Input::KeyRoutedEventArgs &args) noexcept;
254
258
  virtual void OnCharacterReceived(
255
259
  const winrt::Microsoft::ReactNative::Composition::Input::CharacterReceivedRoutedEventArgs &args) noexcept;
260
+ virtual void OnContextMenuKey(
261
+ const winrt::Microsoft::ReactNative::Composition::Input::ContextMenuKeyEventArgs &args) noexcept;
256
262
 
257
263
  protected:
258
264
  winrt::com_ptr<winrt::Microsoft::ReactNative::Composition::ReactCompositionViewComponentBuilder> m_builder;
@@ -277,6 +283,9 @@ struct ComponentView
277
283
  winrt::event<winrt::Windows::Foundation::EventHandler<
278
284
  winrt::Microsoft::ReactNative::Composition::Input::CharacterReceivedRoutedEventArgs>>
279
285
  m_characterReceivedEvent;
286
+ winrt::event<winrt::Windows::Foundation::EventHandler<
287
+ winrt::Microsoft::ReactNative::Composition::Input::ContextMenuKeyEventArgs>>
288
+ m_contextMenuKeyEvent;
280
289
  winrt::event<winrt::Windows::Foundation::EventHandler<
281
290
  winrt::Microsoft::ReactNative::Composition::Input::PointerRoutedEventArgs>>
282
291
  m_pointerPressedEvent;
@@ -136,6 +136,18 @@ winrt::Microsoft::ReactNative::Composition::Input::KeyboardSource CharacterRecei
136
136
  return m_source;
137
137
  }
138
138
 
139
+ ContextMenuKeyEventArgs::ContextMenuKeyEventArgs(facebook::react::Tag tag) : m_tag(tag) {}
140
+
141
+ int32_t ContextMenuKeyEventArgs::OriginalSource() noexcept {
142
+ return m_tag;
143
+ }
144
+ bool ContextMenuKeyEventArgs::Handled() noexcept {
145
+ return m_handled;
146
+ }
147
+ void ContextMenuKeyEventArgs::Handled(bool value) noexcept {
148
+ m_handled = value;
149
+ }
150
+
139
151
  Pointer::Pointer(winrt::Microsoft::ReactNative::Composition::Input::PointerDeviceType type, uint32_t id)
140
152
  : m_type(type), m_id(id) {}
141
153
 
@@ -78,6 +78,21 @@ struct CharacterReceivedRoutedEventArgs
78
78
  const winrt::Microsoft::ReactNative::Composition::Input::KeyboardSource m_source;
79
79
  };
80
80
 
81
+ struct ContextMenuKeyEventArgs : winrt::implements<
82
+ ContextMenuKeyEventArgs,
83
+ winrt::Microsoft::ReactNative::Composition::Input::ContextMenuKeyEventArgs,
84
+ winrt::Microsoft::ReactNative::Composition::Input::RoutedEventArgs> {
85
+ ContextMenuKeyEventArgs(facebook::react::Tag tag);
86
+
87
+ int32_t OriginalSource() noexcept;
88
+ bool Handled() noexcept;
89
+ void Handled(bool value) noexcept;
90
+
91
+ private:
92
+ facebook::react::Tag m_tag{-1};
93
+ bool m_handled{false};
94
+ };
95
+
81
96
  struct Pointer : PointerT<Pointer> {
82
97
  Pointer(winrt::Microsoft::ReactNative::Composition::Input::PointerDeviceType type, uint32_t id);
83
98
 
@@ -320,6 +320,32 @@ void CompositionEventHandler::Initialize() noexcept {
320
320
  }
321
321
  }
322
322
  });
323
+
324
+ m_contextMenuKeyToken =
325
+ keyboardSource.ContextMenuKey([wkThis = weak_from_this()](
326
+ winrt::Microsoft::UI::Input::InputKeyboardSource const & /*source*/,
327
+ winrt::Microsoft::UI::Input::ContextMenuKeyEventArgs const &args) {
328
+ if (auto strongThis = wkThis.lock()) {
329
+ if (auto strongRootView = strongThis->m_wkRootView.get()) {
330
+ if (strongThis->SurfaceId() == -1)
331
+ return;
332
+
333
+ auto focusedComponent = strongThis->RootComponentView().GetFocusedComponent();
334
+ if (focusedComponent) {
335
+ auto tag =
336
+ winrt::get_self<winrt::Microsoft::ReactNative::implementation::ComponentView>(focusedComponent)
337
+ ->Tag();
338
+ auto contextMenuArgs = winrt::make<
339
+ winrt::Microsoft::ReactNative::Composition::Input::implementation::ContextMenuKeyEventArgs>(tag);
340
+ winrt::get_self<winrt::Microsoft::ReactNative::implementation::ComponentView>(focusedComponent)
341
+ ->OnContextMenuKey(contextMenuArgs);
342
+ if (contextMenuArgs.Handled()) {
343
+ args.Handled(true);
344
+ }
345
+ }
346
+ }
347
+ }
348
+ });
323
349
  }
324
350
  }
325
351
 
@@ -336,6 +362,7 @@ CompositionEventHandler::~CompositionEventHandler() {
336
362
  keyboardSource.KeyDown(m_keyDownToken);
337
363
  keyboardSource.KeyUp(m_keyUpToken);
338
364
  keyboardSource.CharacterReceived(m_characterReceivedToken);
365
+ keyboardSource.ContextMenuKey(m_contextMenuKeyToken);
339
366
  }
340
367
  }
341
368
 
@@ -443,6 +470,54 @@ int64_t CompositionEventHandler::SendMessage(HWND hwnd, uint32_t msg, uint64_t w
443
470
  }
444
471
  return 0;
445
472
  }
473
+ case WM_RBUTTONDOWN: {
474
+ if (auto strongRootView = m_wkRootView.get()) {
475
+ auto pp = winrt::make<winrt::Microsoft::ReactNative::Composition::Input::implementation::PointerPoint>(
476
+ hwnd, msg, wParam, lParam, strongRootView.ScaleFactor());
477
+ onPointerPressed(pp, GetKeyModifiers(wParam));
478
+ }
479
+ return 0;
480
+ }
481
+ case WM_RBUTTONUP: {
482
+ if (auto strongRootView = m_wkRootView.get()) {
483
+ auto pp = winrt::make<winrt::Microsoft::ReactNative::Composition::Input::implementation::PointerPoint>(
484
+ hwnd, msg, wParam, lParam, strongRootView.ScaleFactor());
485
+ onPointerReleased(pp, GetKeyModifiers(wParam));
486
+ }
487
+ return 0;
488
+ }
489
+ case WM_MBUTTONDOWN: {
490
+ if (auto strongRootView = m_wkRootView.get()) {
491
+ auto pp = winrt::make<winrt::Microsoft::ReactNative::Composition::Input::implementation::PointerPoint>(
492
+ hwnd, msg, wParam, lParam, strongRootView.ScaleFactor());
493
+ onPointerPressed(pp, GetKeyModifiers(wParam));
494
+ }
495
+ return 0;
496
+ }
497
+ case WM_MBUTTONUP: {
498
+ if (auto strongRootView = m_wkRootView.get()) {
499
+ auto pp = winrt::make<winrt::Microsoft::ReactNative::Composition::Input::implementation::PointerPoint>(
500
+ hwnd, msg, wParam, lParam, strongRootView.ScaleFactor());
501
+ onPointerReleased(pp, GetKeyModifiers(wParam));
502
+ }
503
+ return 0;
504
+ }
505
+ case WM_XBUTTONDOWN: {
506
+ if (auto strongRootView = m_wkRootView.get()) {
507
+ auto pp = winrt::make<winrt::Microsoft::ReactNative::Composition::Input::implementation::PointerPoint>(
508
+ hwnd, msg, wParam, lParam, strongRootView.ScaleFactor());
509
+ onPointerPressed(pp, GetKeyModifiers(wParam));
510
+ }
511
+ return 0;
512
+ }
513
+ case WM_XBUTTONUP: {
514
+ if (auto strongRootView = m_wkRootView.get()) {
515
+ auto pp = winrt::make<winrt::Microsoft::ReactNative::Composition::Input::implementation::PointerPoint>(
516
+ hwnd, msg, wParam, lParam, strongRootView.ScaleFactor());
517
+ onPointerReleased(pp, GetKeyModifiers(wParam));
518
+ }
519
+ return 0;
520
+ }
446
521
  case WM_POINTERUP: {
447
522
  if (auto strongRootView = m_wkRootView.get()) {
448
523
  auto pp = winrt::make<winrt::Microsoft::ReactNative::Composition::Input::implementation::PointerPoint>(
@@ -175,6 +175,7 @@ class CompositionEventHandler : public std::enable_shared_from_this<CompositionE
175
175
  winrt::event_token m_keyDownToken;
176
176
  winrt::event_token m_keyUpToken;
177
177
  winrt::event_token m_characterReceivedToken;
178
+ winrt::event_token m_contextMenuKeyToken;
178
179
  };
179
180
 
180
181
  } // namespace Microsoft::ReactNative
@@ -171,24 +171,6 @@ ContentIslandComponentView::~ContentIslandComponentView() noexcept {
171
171
  m_navigationHost.DepartFocusRequested(m_navigationHostDepartFocusRequestedToken);
172
172
  m_navigationHostDepartFocusRequestedToken = {};
173
173
  }
174
- if (m_childSiteLink) {
175
- if (m_fragmentRootAutomationProviderRequestedToken) {
176
- m_childSiteLink.FragmentRootAutomationProviderRequested(m_fragmentRootAutomationProviderRequestedToken);
177
- m_fragmentRootAutomationProviderRequestedToken = {};
178
- }
179
- if (m_parentAutomationProviderRequestedToken) {
180
- m_childSiteLink.ParentAutomationProviderRequested(m_parentAutomationProviderRequestedToken);
181
- m_parentAutomationProviderRequestedToken = {};
182
- }
183
- if (m_nextSiblingAutomationProviderRequestedToken) {
184
- m_childSiteLink.NextSiblingAutomationProviderRequested(m_nextSiblingAutomationProviderRequestedToken);
185
- m_nextSiblingAutomationProviderRequestedToken = {};
186
- }
187
- if (m_previousSiblingAutomationProviderRequestedToken) {
188
- m_childSiteLink.PreviousSiblingAutomationProviderRequested(m_previousSiblingAutomationProviderRequestedToken);
189
- m_previousSiblingAutomationProviderRequestedToken = {};
190
- }
191
- }
192
174
  if (m_islandToConnect) {
193
175
  m_islandToConnect.Close();
194
176
  }
@@ -230,56 +212,13 @@ void ContentIslandComponentView::prepareForRecycle() noexcept {
230
212
  }
231
213
 
232
214
  void ContentIslandComponentView::ConfigureChildSiteLinkAutomation() noexcept {
233
- // This automation mode must be set before connecting the child ContentIsland.
234
- // It puts the child content into a mode where it won't own its own framework root. Instead, the child island's
235
- // automation peers will use the same framework root as the automation peer of this ContentIslandComponentView.
236
- m_childSiteLink.AutomationOption(winrt::Microsoft::UI::Content::ContentAutomationOptions::FragmentBased);
237
-
238
- // These events are raised in response to the child ContentIsland asking for providers.
239
- // For example, the ContentIsland.FragmentRootAutomationProvider property will return
240
- // the provider we provide here in FragmentRootAutomationProviderRequested.
241
-
242
- // We capture "this" as a raw pointer because ContentIslandComponentView doesn't currently support weak ptrs.
243
- // It's safe because we disconnect these events in the destructor.
244
-
245
- m_fragmentRootAutomationProviderRequestedToken = m_childSiteLink.FragmentRootAutomationProviderRequested(
246
- [this](
247
- const winrt::Microsoft::UI::Content::IContentSiteAutomation &,
248
- const winrt::Microsoft::UI::Content::ContentSiteAutomationProviderRequestedEventArgs &args) {
249
- // The child island's fragment tree doesn't have its own fragment root.
250
- // Here's how we can provide the correct fragment root to the child's UIA logic.
251
- winrt::com_ptr<IRawElementProviderFragmentRoot> fragmentRoot{nullptr};
252
- auto uiaProvider = this->EnsureUiaProvider();
253
- uiaProvider.as<IRawElementProviderFragment>()->get_FragmentRoot(fragmentRoot.put());
254
- args.AutomationProvider(fragmentRoot.as<IInspectable>());
255
- args.Handled(true);
256
- });
257
-
258
- m_parentAutomationProviderRequestedToken = m_childSiteLink.ParentAutomationProviderRequested(
259
- [this](
260
- const winrt::Microsoft::UI::Content::IContentSiteAutomation &,
261
- const winrt::Microsoft::UI::Content::ContentSiteAutomationProviderRequestedEventArgs &args) {
262
- auto uiaProvider = this->EnsureUiaProvider();
263
- args.AutomationProvider(uiaProvider);
264
- args.Handled(true);
265
- });
266
-
267
- m_nextSiblingAutomationProviderRequestedToken = m_childSiteLink.NextSiblingAutomationProviderRequested(
268
- [](const winrt::Microsoft::UI::Content::IContentSiteAutomation &,
269
- const winrt::Microsoft::UI::Content::ContentSiteAutomationProviderRequestedEventArgs &args) {
270
- // The ContentIsland will always be the one and only child of this node, so it won't have siblings.
271
- args.AutomationProvider(nullptr);
272
- args.Handled(true);
273
- });
274
-
275
- m_previousSiblingAutomationProviderRequestedToken = m_childSiteLink.PreviousSiblingAutomationProviderRequested(
276
- [](const winrt::Microsoft::UI::Content::IContentSiteAutomation &,
277
- const winrt::Microsoft::UI::Content::ContentSiteAutomationProviderRequestedEventArgs &args) {
278
- // The ContentIsland will always be the one and only child of this node, so it won't have siblings.
279
- args.AutomationProvider(nullptr);
280
- args.Handled(true);
281
- });
215
+ // Use FrameworkBased to let the XamlIsland manage its own framework-level accessibility tree
216
+ // and raise focus events naturally. This tells the system that the child island has its own
217
+ // framework (WinUI/XAML) that manages automation.
218
+ m_childSiteLink.AutomationOption(winrt::Microsoft::UI::Content::ContentAutomationOptions::FrameworkBased);
282
219
 
220
+ // When using FrameworkBased mode, we don't register automation callbacks - let the XamlIsland handle its own UIA
221
+ // tree.
283
222
  if (m_innerAutomationProvider) {
284
223
  m_innerAutomationProvider->SetChildSiteLink(m_childSiteLink);
285
224
  }
@@ -70,10 +70,6 @@ struct ContentIslandComponentView : ContentIslandComponentViewT<ContentIslandCom
70
70
 
71
71
  // Automation
72
72
  void ConfigureChildSiteLinkAutomation() noexcept;
73
- winrt::event_token m_fragmentRootAutomationProviderRequestedToken{};
74
- winrt::event_token m_parentAutomationProviderRequestedToken{};
75
- winrt::event_token m_nextSiblingAutomationProviderRequestedToken{};
76
- winrt::event_token m_previousSiblingAutomationProviderRequestedToken{};
77
73
  };
78
74
 
79
75
  } // namespace winrt::Microsoft::ReactNative::Composition::implementation