react-native-windows 0.74.10 → 0.74.12

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 (50) hide show
  1. package/Common/Common.vcxproj +8 -0
  2. package/Directory.Build.targets +5 -0
  3. package/Folly/Folly.vcxproj +10 -2
  4. package/Folly/Folly.vcxproj.filters +0 -7
  5. package/Libraries/Components/TextInput/TextInput.js +6 -3
  6. package/Libraries/Components/TextInput/TextInput.windows.js +6 -3
  7. package/Libraries/Core/ReactNativeVersion.js +1 -1
  8. package/Libraries/Text/Text.windows.js +1 -0
  9. package/Microsoft.ReactNative/Composition.Input.idl +3 -3
  10. package/Microsoft.ReactNative/CompositionSwitcher.idl +1 -0
  11. package/Microsoft.ReactNative/Fabric/Composition/ComponentViewRegistry.cpp +3 -0
  12. package/Microsoft.ReactNative/Fabric/Composition/Composition.Input.cpp +2 -2
  13. package/Microsoft.ReactNative/Fabric/Composition/Composition.Input.h +4 -4
  14. package/Microsoft.ReactNative/Fabric/Composition/CompositionContextHelper.cpp +10 -0
  15. package/Microsoft.ReactNative/Fabric/Composition/CompositionEventHandler.cpp +16 -27
  16. package/Microsoft.ReactNative/Fabric/Composition/CompositionEventHandler.h +1 -1
  17. package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.cpp +85 -48
  18. package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.h +4 -0
  19. package/Microsoft.ReactNative/Fabric/Composition/ImageComponentView.cpp +19 -15
  20. package/Microsoft.ReactNative/Fabric/Composition/ImageComponentView.h +4 -2
  21. package/Microsoft.ReactNative/Fabric/Composition/ParagraphComponentView.cpp +10 -0
  22. package/Microsoft.ReactNative/Fabric/Composition/ParagraphComponentView.h +3 -0
  23. package/Microsoft.ReactNative/Fabric/Composition/ReactNativeIsland.cpp +42 -17
  24. package/Microsoft.ReactNative/Fabric/Composition/ReactNativeIsland.h +3 -1
  25. package/Microsoft.ReactNative/Fabric/Composition/ScrollViewComponentView.cpp +42 -5
  26. package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.cpp +22 -16
  27. package/Microsoft.ReactNative/Fabric/FabricUIManagerModule.cpp +30 -6
  28. package/Microsoft.ReactNative/Fabric/FabricUIManagerModule.h +2 -0
  29. package/Microsoft.ReactNative/Fabric/WindowsImageManager.cpp +5 -0
  30. package/Microsoft.ReactNative/ReactHost/ReactInstanceWin.cpp +3 -2
  31. package/Microsoft.ReactNative/packages.lock.json +10 -0
  32. package/PropertySheets/ARM64EC.props +13 -0
  33. package/PropertySheets/Application/ARM64EC.props +13 -0
  34. package/PropertySheets/DynamicLibrary/ARM64EC.props +13 -0
  35. package/PropertySheets/Generated/PackageVersion.g.props +3 -3
  36. package/PropertySheets/JSEngine.props +2 -0
  37. package/PropertySheets/StaticLibrary/ARM64EC.props +13 -0
  38. package/ReactCommon/ReactCommon.vcxproj +9 -1
  39. package/ReactCommon/ReactCommon.vcxproj.filters +16 -12
  40. package/ReactCommon/TEMP_UntilReactCommonUpdate/yoga/yoga/algorithm/CalculateLayout.cpp +2 -0
  41. package/ReactCommon/TEMP_UntilReactCommonUpdate/yoga/yoga/config/Config.cpp +140 -0
  42. package/ReactCommon/TEMP_UntilReactCommonUpdate/yoga/yoga/config/Config.h +92 -0
  43. package/ReactCommon/TEMP_UntilReactCommonUpdate/yoga/yoga/node/LayoutResults.cpp +48 -0
  44. package/ReactCommon/TEMP_UntilReactCommonUpdate/yoga/yoga/node/LayoutResults.h +122 -0
  45. package/ReactCommon/TEMP_UntilReactCommonUpdate/yoga/yoga/node/Node.cpp +366 -0
  46. package/Scripts/OfficeReact.Win32.nuspec +16 -18
  47. package/Scripts/StripAdditionalPlatformsFromNuspec.ps1 +1 -1
  48. package/Scripts/Tfs/Layout-MSRN-Headers.ps1 +6 -6
  49. package/fmt/fmt.vcxproj +9 -1
  50. package/package.json +13 -13
@@ -11,10 +11,18 @@
11
11
  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
12
12
  <Import Project="$(ReactNativeWindowsDir)PropertySheets\React.Cpp.props" />
13
13
  <ItemGroup Label="ProjectConfigurations">
14
+ <ProjectConfiguration Include="Debug|ARM64EC">
15
+ <Configuration>Debug</Configuration>
16
+ <Platform>ARM64EC</Platform>
17
+ </ProjectConfiguration>
14
18
  <ProjectConfiguration Include="Debug|x64">
15
19
  <Configuration>Debug</Configuration>
16
20
  <Platform>x64</Platform>
17
21
  </ProjectConfiguration>
22
+ <ProjectConfiguration Include="Release|ARM64EC">
23
+ <Configuration>Release</Configuration>
24
+ <Platform>ARM64EC</Platform>
25
+ </ProjectConfiguration>
18
26
  <ProjectConfiguration Include="Release|x64">
19
27
  <Configuration>Release</Configuration>
20
28
  <Platform>x64</Platform>
@@ -21,4 +21,9 @@
21
21
  <MSBuild Projects="$(MSBuildProjectFile)" Targets="Restore" Properties="RestoreProjectStyle=PackagesConfig;RestorePackagesConfig=true;RestoreUseStaticGraphEvaluation=false" />
22
22
  </Target>
23
23
 
24
+ <PropertyGroup Label="WindowsAppSDKOverrides" Condition="'$(Platform)' == 'ARM64EC'">
25
+ <Ixp-Platform>win10-x64</Ixp-Platform>
26
+ <_WindowsAppSDKFoundationPlatform>x64</_WindowsAppSDKFoundationPlatform>
27
+ <_MrtCoreRuntimeIdentifier>x64</_MrtCoreRuntimeIdentifier>
28
+ </PropertyGroup>
24
29
  </Project>
@@ -17,6 +17,10 @@
17
17
  <Configuration>Debug</Configuration>
18
18
  <Platform>ARM64</Platform>
19
19
  </ProjectConfiguration>
20
+ <ProjectConfiguration Include="Debug|ARM64EC">
21
+ <Configuration>Debug</Configuration>
22
+ <Platform>ARM64EC</Platform>
23
+ </ProjectConfiguration>
20
24
  <ProjectConfiguration Include="Release|ARM64">
21
25
  <Configuration>Release</Configuration>
22
26
  <Platform>ARM64</Platform>
@@ -25,6 +29,10 @@
25
29
  <Configuration>Debug</Configuration>
26
30
  <Platform>x64</Platform>
27
31
  </ProjectConfiguration>
32
+ <ProjectConfiguration Include="Release|ARM64EC">
33
+ <Configuration>Release</Configuration>
34
+ <Platform>ARM64EC</Platform>
35
+ </ProjectConfiguration>
28
36
  <ProjectConfiguration Include="Release|x64">
29
37
  <Configuration>Release</Configuration>
30
38
  <Platform>x64</Platform>
@@ -279,7 +287,7 @@
279
287
  SourceUrl="https://github.com/facebook/folly/archive/v$(FollyVersion).zip"
280
288
  DestinationFileName="$(FollyZipFile)"
281
289
  DestinationFolder="$(FollyZipDir)"
282
- Retries="10"/>
290
+ Retries="10" />
283
291
  </Target>
284
292
  <Target Name="UnzipFolly" BeforeTargets="PrepareForBuild" DependsOnTargets="DownloadFolly">
285
293
  <Message Condition="!Exists('$(FollyDir)folly\dynamic.h')" Importance="High" Text="Unzipping folly to $([MSBuild]::NormalizePath($(FollyDir)..))." />
@@ -328,4 +336,4 @@
328
336
  <ItemGroup>
329
337
  <ProjectReference Include="..\Fmt\Fmt.vcxproj" Project="{14b93DC8-FD93-4A6D-81CB-8BC96644501C}" />
330
338
  </ItemGroup>
331
- </Project>
339
+ </Project>
@@ -83,13 +83,6 @@
83
83
  </ClCompile>
84
84
  <ClCompile Include="pch.cpp" />
85
85
  <ClCompile Include="$(FollyDir)\folly\system\AtFork.cpp" />
86
- <ClCompile Include="$(FollyDir)\folly\SharedMutex.cpp" />
87
- <ClCompile Include="$(FollyDir)\folly\concurrency\CacheLocality.cpp" />
88
- <ClCompile Include="$(FollyDir)\folly\detail\Futex.cpp" />
89
- <ClCompile Include="$(FollyDir)\folly\synchronization\ParkingLot.cpp" />
90
- <ClCompile Include="$(FollyDir)\folly\synchronization\SanitizeThread.cpp" />
91
- <ClCompile Include="$(FollyDir)\folly\portability\SysResource.cpp" />
92
- <ClCompile Include="$(FollyDir)\folly\portability\Unistd.cpp" />
93
86
  </ItemGroup>
94
87
  <ItemGroup>
95
88
  <ClInclude Include="$(FollyDir)\folly\portability\Asm.h">
@@ -1135,12 +1135,14 @@ function InternalTextInput(props: Props): React.Node {
1135
1135
  };
1136
1136
 
1137
1137
  const [mostRecentEventCount, setMostRecentEventCount] = useState<number>(0);
1138
-
1139
1138
  const [lastNativeText, setLastNativeText] = useState<?Stringish>(props.value);
1140
1139
  const [lastNativeSelectionState, setLastNativeSelection] = useState<{|
1141
- selection: ?Selection,
1140
+ selection: Selection,
1142
1141
  mostRecentEventCount: number,
1143
- |}>({selection, mostRecentEventCount});
1142
+ |}>({
1143
+ selection: {start: -1, end: -1},
1144
+ mostRecentEventCount: mostRecentEventCount,
1145
+ });
1144
1146
 
1145
1147
  const lastNativeSelection = lastNativeSelectionState.selection;
1146
1148
 
@@ -1498,6 +1500,7 @@ function InternalTextInput(props: Props): React.Node {
1498
1500
  onSelectionChange={_onSelectionChange}
1499
1501
  onSelectionChangeShouldSetResponder={emptyFunctionThatReturnsTrue}
1500
1502
  selection={selection}
1503
+ selectionColor={selectionColor}
1501
1504
  style={StyleSheet.compose(
1502
1505
  useMultilineDefaultStyle ? styles.multilineDefault : null,
1503
1506
  style,
@@ -1212,12 +1212,14 @@ function InternalTextInput(props: Props): React.Node {
1212
1212
  };
1213
1213
 
1214
1214
  const [mostRecentEventCount, setMostRecentEventCount] = useState<number>(0);
1215
-
1216
1215
  const [lastNativeText, setLastNativeText] = useState<?Stringish>(props.value);
1217
1216
  const [lastNativeSelectionState, setLastNativeSelection] = useState<{|
1218
- selection: ?Selection,
1217
+ selection: Selection,
1219
1218
  mostRecentEventCount: number,
1220
- |}>({selection, mostRecentEventCount});
1219
+ |}>({
1220
+ selection: {start: -1, end: -1},
1221
+ mostRecentEventCount: mostRecentEventCount,
1222
+ });
1221
1223
 
1222
1224
  const lastNativeSelection = lastNativeSelectionState.selection;
1223
1225
 
@@ -1649,6 +1651,7 @@ function InternalTextInput(props: Props): React.Node {
1649
1651
  onSelectionChange={_onSelectionChange}
1650
1652
  onSelectionChangeShouldSetResponder={emptyFunctionThatReturnsTrue}
1651
1653
  selection={selection}
1654
+ selectionColor={selectionColor}
1652
1655
  style={StyleSheet.compose(
1653
1656
  useMultilineDefaultStyle ? styles.multilineDefault : null,
1654
1657
  style,
@@ -16,7 +16,7 @@ const version: $ReadOnly<{
16
16
  }> = {
17
17
  major: 0,
18
18
  minor: 74,
19
- patch: 1,
19
+ patch: 3,
20
20
  prerelease: null,
21
21
  };
22
22
 
@@ -279,6 +279,7 @@ const Text: React.AbstractComponent<
279
279
  } else {
280
280
  let styleProps: ViewStyleProp = (restProps.style: any);
281
281
  if (
282
+ global.RN$Bridgeless !== true && // [Windows] Fabric text handles borders, but on paper we need to wrap it in an extra view
282
283
  styleProps &&
283
284
  styleProps.borderColor &&
284
285
  (styleProps.borderWidth ||
@@ -8,7 +8,7 @@ namespace Microsoft.ReactNative.Composition.Input
8
8
  {
9
9
  interface KeyboardSource
10
10
  {
11
- Windows.UI.Core.CoreVirtualKeyStates GetKeyState(Windows.System.VirtualKey key);
11
+ Microsoft.UI.Input.VirtualKeyStates GetKeyState(Windows.System.VirtualKey key);
12
12
  }
13
13
 
14
14
  interface RoutedEventArgs
@@ -21,14 +21,14 @@ namespace Microsoft.ReactNative.Composition.Input
21
21
  String DeviceId { get; };
22
22
  Boolean Handled { get; set; };
23
23
  Windows.System.VirtualKey Key { get; };
24
- Windows.UI.Core.CorePhysicalKeyStatus KeyStatus { get; };
24
+ Microsoft.UI.Input.PhysicalKeyStatus KeyStatus { get; };
25
25
  Windows.System.VirtualKey OriginalKey { get; };
26
26
  }
27
27
 
28
28
  interface CharacterReceivedRoutedEventArgs requires RoutedEventArgs
29
29
  {
30
30
  Boolean Handled { get; set; };
31
- Windows.UI.Core.CorePhysicalKeyStatus KeyStatus { get; };
31
+ Microsoft.UI.Input.PhysicalKeyStatus KeyStatus { get; };
32
32
  Int32 KeyCode { get; };
33
33
  };
34
34
 
@@ -106,6 +106,7 @@ namespace Microsoft.ReactNative.Composition.Experimental
106
106
  interface IScrollVisual requires IVisual
107
107
  {
108
108
  void Brush(IBrush brush);
109
+ void ScrollEnabled(Boolean isScrollEnabled);
109
110
  event Windows.Foundation.EventHandler<IScrollPositionChangedArgs> ScrollPositionChanged;
110
111
  void ContentSize(Windows.Foundation.Numerics.Vector2 size);
111
112
  Windows.Foundation.Numerics.Vector3 ScrollPosition { get; };
@@ -120,6 +120,9 @@ void ComponentViewRegistry::enqueueComponentViewWithComponentHandle(
120
120
  ComponentViewDescriptor componentViewDescriptor) noexcept {
121
121
  assert(m_registry.find(tag) != m_registry.end());
122
122
 
123
+ winrt::get_self<winrt::Microsoft::ReactNative::implementation::ComponentView>(componentViewDescriptor.view)
124
+ ->prepareForRecycle();
125
+
123
126
  m_registry.erase(tag);
124
127
  }
125
128
  } // namespace Microsoft::ReactNative
@@ -68,7 +68,7 @@ winrt::Windows::System::VirtualKey KeyRoutedEventArgs::Key() noexcept {
68
68
  return m_key;
69
69
  }
70
70
 
71
- winrt::Windows::UI::Core::CorePhysicalKeyStatus KeyRoutedEventArgs::KeyStatus() noexcept {
71
+ winrt::Microsoft::UI::Input::PhysicalKeyStatus KeyRoutedEventArgs::KeyStatus() noexcept {
72
72
  return m_keyStatus;
73
73
  }
74
74
 
@@ -118,7 +118,7 @@ void CharacterReceivedRoutedEventArgs::Handled(bool value) noexcept {
118
118
  int32_t CharacterReceivedRoutedEventArgs::KeyCode() noexcept {
119
119
  return m_keycode;
120
120
  }
121
- winrt::Windows::UI::Core::CorePhysicalKeyStatus CharacterReceivedRoutedEventArgs::KeyStatus() noexcept {
121
+ winrt::Microsoft::UI::Input::PhysicalKeyStatus CharacterReceivedRoutedEventArgs::KeyStatus() noexcept {
122
122
  return m_keyStatus;
123
123
  }
124
124
 
@@ -31,14 +31,14 @@ struct KeyRoutedEventArgs : winrt::implements<
31
31
  bool Handled() noexcept;
32
32
  void Handled(bool value) noexcept;
33
33
  winrt::Windows::System::VirtualKey Key() noexcept;
34
- winrt::Windows::UI::Core::CorePhysicalKeyStatus KeyStatus() noexcept;
34
+ winrt::Microsoft::UI::Input::PhysicalKeyStatus KeyStatus() noexcept;
35
35
  winrt::Windows::System::VirtualKey OriginalKey() noexcept;
36
36
 
37
37
  private:
38
38
  facebook::react::Tag m_tag{-1};
39
39
  bool m_handled{false};
40
40
  winrt::Windows::System::VirtualKey m_key;
41
- winrt::Windows::UI::Core::CorePhysicalKeyStatus m_keyStatus;
41
+ winrt::Microsoft::UI::Input::PhysicalKeyStatus m_keyStatus;
42
42
  };
43
43
 
44
44
  struct CharacterReceivedRoutedEventArgs
@@ -57,13 +57,13 @@ struct CharacterReceivedRoutedEventArgs
57
57
  bool Handled() noexcept;
58
58
  void Handled(bool value) noexcept;
59
59
  int32_t KeyCode() noexcept;
60
- winrt::Windows::UI::Core::CorePhysicalKeyStatus KeyStatus() noexcept;
60
+ winrt::Microsoft::UI::Input::PhysicalKeyStatus KeyStatus() noexcept;
61
61
 
62
62
  private:
63
63
  facebook::react::Tag m_tag{-1};
64
64
  bool m_handled{false};
65
65
  int32_t m_keycode;
66
- winrt::Windows::UI::Core::CorePhysicalKeyStatus m_keyStatus;
66
+ winrt::Microsoft::UI::Input::PhysicalKeyStatus m_keyStatus;
67
67
  };
68
68
 
69
69
  struct Pointer : PointerT<Pointer> {
@@ -795,6 +795,16 @@ struct CompScrollerVisual : winrt::implements<
795
795
  m_visual.Brush(TTypeRedirects::CompositionContextHelper::InnerBrush(brush));
796
796
  }
797
797
 
798
+ void ScrollEnabled(bool isScrollEnabled) noexcept {
799
+ if (isScrollEnabled) {
800
+ m_visualInteractionSource.ManipulationRedirectionMode(
801
+ TTypeRedirects::VisualInteractionSourceRedirectionMode::CapableTouchpadAndPointerWheel);
802
+ } else {
803
+ m_visualInteractionSource.ManipulationRedirectionMode(
804
+ TTypeRedirects::VisualInteractionSourceRedirectionMode::Off);
805
+ }
806
+ }
807
+
798
808
  void Opacity(float opacity) noexcept {
799
809
  m_visual.Opacity(opacity);
800
810
  }
@@ -101,9 +101,9 @@ struct CompositionKeyboardSource
101
101
  : winrt::implements<CompositionKeyboardSource, winrt::Microsoft::ReactNative::Composition::Input::KeyboardSource> {
102
102
  CompositionKeyboardSource(CompositionEventHandler *outer) : m_outer(outer) {}
103
103
 
104
- winrt::Windows::UI::Core::CoreVirtualKeyStates GetKeyState(winrt::Windows::System::VirtualKey key) noexcept {
104
+ winrt::Microsoft::UI::Input::VirtualKeyStates GetKeyState(winrt::Windows::System::VirtualKey key) noexcept {
105
105
  if (!m_outer)
106
- return winrt::Windows::UI::Core::CoreVirtualKeyStates::None;
106
+ return winrt::Microsoft::UI::Input::VirtualKeyStates::None;
107
107
  return m_outer->GetKeyState(key);
108
108
  }
109
109
 
@@ -121,23 +121,11 @@ struct CompositionInputKeyboardSource : winrt::implements<
121
121
  winrt::Microsoft::ReactNative::Composition::Input::KeyboardSource> {
122
122
  CompositionInputKeyboardSource(winrt::Microsoft::UI::Input::InputKeyboardSource source) : m_source(source) {}
123
123
 
124
- winrt::Windows::UI::Core::CoreVirtualKeyStates GetKeyState(winrt::Windows::System::VirtualKey key) noexcept {
124
+ winrt::Microsoft::UI::Input::VirtualKeyStates GetKeyState(winrt::Windows::System::VirtualKey key) noexcept {
125
125
  if (!m_source)
126
- return winrt::Windows::UI::Core::CoreVirtualKeyStates::None;
127
-
128
- static_assert(
129
- static_cast<winrt::Windows::UI::Core::CoreVirtualKeyStates>(
130
- winrt::Microsoft::UI::Input::VirtualKeyStates::Down) ==
131
- winrt::Windows::UI::Core::CoreVirtualKeyStates::Down);
132
- static_assert(
133
- static_cast<winrt::Windows::UI::Core::CoreVirtualKeyStates>(
134
- winrt::Microsoft::UI::Input::VirtualKeyStates::Locked) ==
135
- winrt::Windows::UI::Core::CoreVirtualKeyStates::Locked);
136
- static_assert(
137
- static_cast<winrt::Windows::UI::Core::CoreVirtualKeyStates>(
138
- winrt::Microsoft::UI::Input::VirtualKeyStates::None) ==
139
- winrt::Windows::UI::Core::CoreVirtualKeyStates::None);
140
- return static_cast<winrt::Windows::UI::Core::CoreVirtualKeyStates>(m_source.GetKeyState(key));
126
+ return winrt::Microsoft::UI::Input::VirtualKeyStates::None;
127
+
128
+ return m_source.GetKeyState(key);
141
129
  }
142
130
 
143
131
  void Disconnect() noexcept {
@@ -360,16 +348,15 @@ void CompositionEventHandler::onPointerWheelChanged(
360
348
  }
361
349
  }
362
350
 
363
- winrt::Windows::UI::Core::CoreVirtualKeyStates CompositionEventHandler::GetKeyState(
351
+ winrt::Microsoft::UI::Input::VirtualKeyStates CompositionEventHandler::GetKeyState(
364
352
  winrt::Windows::System::VirtualKey key) noexcept {
365
- winrt::Windows::UI::Core::CoreVirtualKeyStates coreKeyState = winrt::Windows::UI::Core::CoreVirtualKeyStates::None;
353
+ winrt::Microsoft::UI::Input::VirtualKeyStates coreKeyState = winrt::Microsoft::UI::Input::VirtualKeyStates::None;
366
354
  SHORT keyState = ::GetKeyState(static_cast<int>(key));
367
355
  if (keyState & 0x01) {
368
- coreKeyState = winrt::Windows::UI::Core::CoreVirtualKeyStates::Locked;
356
+ coreKeyState = winrt::Microsoft::UI::Input::VirtualKeyStates::Locked;
369
357
  }
370
358
  if (keyState & 0x8000) {
371
- coreKeyState = static_cast<winrt::Windows::UI::Core::CoreVirtualKeyStates>(
372
- static_cast<int>(coreKeyState) | static_cast<int>(winrt::Windows::UI::Core::CoreVirtualKeyStates::Down));
359
+ coreKeyState = coreKeyState | winrt::Microsoft::UI::Input::VirtualKeyStates::Down;
373
360
  }
374
361
 
375
362
  return coreKeyState;
@@ -510,10 +497,12 @@ void CompositionEventHandler::onKeyDown(
510
497
  return;
511
498
  }
512
499
 
513
- bool fShift = source.GetKeyState(winrt::Windows::System::VirtualKey::Shift) ==
514
- winrt::Windows::UI::Core::CoreVirtualKeyStates::Down;
515
- bool fCtrl = source.GetKeyState(winrt::Windows::System::VirtualKey::Control) ==
516
- winrt::Windows::UI::Core::CoreVirtualKeyStates::Down;
500
+ bool fShift =
501
+ (source.GetKeyState(winrt::Windows::System::VirtualKey::Shift) &
502
+ winrt::Microsoft::UI::Input::VirtualKeyStates::Down) == winrt::Microsoft::UI::Input::VirtualKeyStates::Down;
503
+ bool fCtrl =
504
+ (source.GetKeyState(winrt::Windows::System::VirtualKey::Control) &
505
+ winrt::Microsoft::UI::Input::VirtualKeyStates::Down) == winrt::Microsoft::UI::Input::VirtualKeyStates::Down;
517
506
 
518
507
  if (fShift && fCtrl && args.Key() == static_cast<winrt::Windows::System::VirtualKey>(VkKeyScanA('d')) &&
519
508
  Mso::React::ReactOptions::UseDeveloperSupport(m_context.Properties().Handle())) {
@@ -36,7 +36,7 @@ class CompositionEventHandler {
36
36
 
37
37
  int64_t SendMessage(HWND hwnd, uint32_t msg, uint64_t wParam, int64_t lParam) noexcept;
38
38
  void RemoveTouchHandlers();
39
- winrt::Windows::UI::Core::CoreVirtualKeyStates GetKeyState(winrt::Windows::System::VirtualKey key) noexcept;
39
+ winrt::Microsoft::UI::Input::VirtualKeyStates GetKeyState(winrt::Windows::System::VirtualKey key) noexcept;
40
40
 
41
41
  bool CapturePointer(
42
42
  const winrt::Microsoft::ReactNative::Composition::Input::Pointer &pointer,
@@ -16,6 +16,7 @@
16
16
  #include <Utils/ValueUtils.h>
17
17
  #include <Views/FrameworkElementTransferProperties.h>
18
18
  #include <winrt/Microsoft.ReactNative.Composition.Experimental.h>
19
+ #include <winrt/Microsoft.UI.Input.h>
19
20
  #include <winrt/Windows.UI.Composition.h>
20
21
  #include "CompositionContextHelper.h"
21
22
  #include "CompositionDynamicAutomationProvider.h"
@@ -179,11 +180,46 @@ const facebook::react::LayoutMetrics &ComponentView::layoutMetrics() const noexc
179
180
  return m_layoutMetrics;
180
181
  }
181
182
 
183
+ void ComponentView::FinalizeTransform(
184
+ facebook::react::LayoutMetrics const &layoutMetrics,
185
+ const facebook::react::ViewProps &viewProps) noexcept {
186
+ const auto resolveTransformMatrix = viewProps.resolveTransform(layoutMetrics);
187
+ winrt::Windows::Foundation::Numerics::float4x4 transformMatrix;
188
+ transformMatrix.m11 = resolveTransformMatrix.matrix[0];
189
+ transformMatrix.m12 = resolveTransformMatrix.matrix[1];
190
+ transformMatrix.m13 = resolveTransformMatrix.matrix[2];
191
+ transformMatrix.m14 = resolveTransformMatrix.matrix[3];
192
+ transformMatrix.m21 = resolveTransformMatrix.matrix[4];
193
+ transformMatrix.m22 = resolveTransformMatrix.matrix[5];
194
+ transformMatrix.m23 = resolveTransformMatrix.matrix[6];
195
+ transformMatrix.m24 = resolveTransformMatrix.matrix[7];
196
+ transformMatrix.m31 = resolveTransformMatrix.matrix[8];
197
+ transformMatrix.m32 = resolveTransformMatrix.matrix[9];
198
+ transformMatrix.m33 = resolveTransformMatrix.matrix[10];
199
+ transformMatrix.m34 = resolveTransformMatrix.matrix[11];
200
+ transformMatrix.m41 = resolveTransformMatrix.matrix[12];
201
+ transformMatrix.m42 = resolveTransformMatrix.matrix[13];
202
+ transformMatrix.m43 = resolveTransformMatrix.matrix[14];
203
+ transformMatrix.m44 = resolveTransformMatrix.matrix[15];
204
+
205
+ auto centerPointPropSet = EnsureCenterPointPropertySet();
206
+ if (centerPointPropSet) {
207
+ centerPointPropSet.InsertMatrix4x4(L"transform", transformMatrix);
208
+ }
209
+
210
+ EnsureTransformMatrixFacade();
211
+ m_FinalizeTransform = false;
212
+ }
213
+
182
214
  void ComponentView::FinalizeUpdates(winrt::Microsoft::ReactNative::ComponentViewUpdateMask updateMask) noexcept {
183
215
  if ((m_flags & ComponentViewFeatures::NativeBorder) == ComponentViewFeatures::NativeBorder) {
184
216
  finalizeBorderUpdates(m_layoutMetrics, *viewProps());
185
217
  }
186
218
 
219
+ if (m_FinalizeTransform) {
220
+ FinalizeTransform(m_layoutMetrics, *viewProps());
221
+ }
222
+
187
223
  base_type::FinalizeUpdates(updateMask);
188
224
  }
189
225
 
@@ -602,6 +638,8 @@ void SetBorderLayerPropertiesCommon(
602
638
  facebook::react::BorderStyle borderStyle) {
603
639
  layer.Offset({anchorOffset.x, anchorOffset.y, 0}, {anchorPoint.x, anchorPoint.y, 0});
604
640
  layer.RelativeSizeWithOffset(size, relativeSizeAdjustment);
641
+ layer.as<::Microsoft::ReactNative::Composition::Experimental::IVisualInterop>()->SetClippingPath(nullptr);
642
+
605
643
  if ((textureRect.right - textureRect.left) <= 0 || (textureRect.bottom - textureRect.top) <= 0)
606
644
  return;
607
645
 
@@ -703,7 +741,8 @@ void SetBorderLayerProperties(
703
741
  // if (VisualVersion::IsUseWinCompClippingRegionEnabled())
704
742
  {
705
743
  layer.Offset({anchorOffset.x, anchorOffset.y, 0}, {anchorPoint.x, anchorPoint.y, 0});
706
- layer.Size({textureRect.right - textureRect.left, textureRect.bottom - textureRect.top});
744
+ layer.RelativeSizeWithOffset(
745
+ {textureRect.right - textureRect.left, textureRect.bottom - textureRect.top}, {0.0f, 0.0f});
707
746
 
708
747
  layer.Brush(theme->Brush(*borderColor));
709
748
 
@@ -1242,30 +1281,7 @@ void ComponentView::updateTransformProps(
1242
1281
 
1243
1282
  // Transform - TODO doesn't handle multiple of the same kind of transform -- Doesn't handle hittesting updates
1244
1283
  if (oldViewProps.transform != newViewProps.transform) {
1245
- winrt::Windows::Foundation::Numerics::float4x4 transformMatrix;
1246
- transformMatrix.m11 = newViewProps.transform.matrix[0];
1247
- transformMatrix.m12 = newViewProps.transform.matrix[1];
1248
- transformMatrix.m13 = newViewProps.transform.matrix[2];
1249
- transformMatrix.m14 = newViewProps.transform.matrix[3];
1250
- transformMatrix.m21 = newViewProps.transform.matrix[4];
1251
- transformMatrix.m22 = newViewProps.transform.matrix[5];
1252
- transformMatrix.m23 = newViewProps.transform.matrix[6];
1253
- transformMatrix.m24 = newViewProps.transform.matrix[7];
1254
- transformMatrix.m31 = newViewProps.transform.matrix[8];
1255
- transformMatrix.m32 = newViewProps.transform.matrix[9];
1256
- transformMatrix.m33 = newViewProps.transform.matrix[10];
1257
- transformMatrix.m34 = newViewProps.transform.matrix[11];
1258
- transformMatrix.m41 = newViewProps.transform.matrix[12];
1259
- transformMatrix.m42 = newViewProps.transform.matrix[13];
1260
- transformMatrix.m43 = newViewProps.transform.matrix[14];
1261
- transformMatrix.m44 = newViewProps.transform.matrix[15];
1262
-
1263
- auto centerPointPropSet = EnsureCenterPointPropertySet();
1264
- if (centerPointPropSet) {
1265
- centerPointPropSet.InsertMatrix4x4(L"transform", transformMatrix);
1266
- }
1267
-
1268
- EnsureTransformMatrixFacade();
1284
+ m_FinalizeTransform = true;
1269
1285
  }
1270
1286
  }
1271
1287
 
@@ -1614,7 +1630,10 @@ inline winrt::Windows::System::VirtualKey GetLeftOrRightModifiedKey(
1614
1630
  const winrt::Microsoft::ReactNative::Composition::Input::KeyboardSource &source,
1615
1631
  winrt::Windows::System::VirtualKey leftKey,
1616
1632
  winrt::Windows::System::VirtualKey rightKey) {
1617
- return (source.GetKeyState(leftKey) == winrt::Windows::UI::Core::CoreVirtualKeyStates::Down) ? leftKey : rightKey;
1633
+ return ((source.GetKeyState(leftKey) & winrt::Microsoft::UI::Input::VirtualKeyStates::Down) ==
1634
+ winrt::Microsoft::UI::Input::VirtualKeyStates::Down)
1635
+ ? leftKey
1636
+ : rightKey;
1618
1637
  }
1619
1638
 
1620
1639
  std::string CodeFromVirtualKey(
@@ -1647,16 +1666,20 @@ void ViewComponentView::OnKeyDown(
1647
1666
  const winrt::Microsoft::ReactNative::Composition::Input::KeyboardSource &source,
1648
1667
  const winrt::Microsoft::ReactNative::Composition::Input::KeyRoutedEventArgs &args) noexcept {
1649
1668
  auto eventCode = CodeFromVirtualKey(source, args.Key());
1650
- bool fShift = source.GetKeyState(winrt::Windows::System::VirtualKey::Shift) !=
1651
- winrt::Windows::UI::Core::CoreVirtualKeyStates::None;
1652
- bool fAlt = source.GetKeyState(winrt::Windows::System::VirtualKey::Menu) !=
1653
- winrt::Windows::UI::Core::CoreVirtualKeyStates::None;
1654
- bool fCtrl = source.GetKeyState(winrt::Windows::System::VirtualKey::Control) !=
1655
- winrt::Windows::UI::Core::CoreVirtualKeyStates::None;
1656
- bool fMeta = (source.GetKeyState(winrt::Windows::System::VirtualKey::LeftWindows) !=
1657
- winrt::Windows::UI::Core::CoreVirtualKeyStates::None) ||
1658
- (source.GetKeyState(winrt::Windows::System::VirtualKey::RightWindows) !=
1659
- winrt::Windows::UI::Core::CoreVirtualKeyStates::None);
1669
+ bool fShift =
1670
+ (source.GetKeyState(winrt::Windows::System::VirtualKey::Shift) &
1671
+ winrt::Microsoft::UI::Input::VirtualKeyStates::Down) == winrt::Microsoft::UI::Input::VirtualKeyStates::Down;
1672
+ bool fAlt =
1673
+ (source.GetKeyState(winrt::Windows::System::VirtualKey::Menu) &
1674
+ winrt::Microsoft::UI::Input::VirtualKeyStates::Down) == winrt::Microsoft::UI::Input::VirtualKeyStates::Down;
1675
+ bool fCtrl =
1676
+ (source.GetKeyState(winrt::Windows::System::VirtualKey::Control) &
1677
+ winrt::Microsoft::UI::Input::VirtualKeyStates::Down) == winrt::Microsoft::UI::Input::VirtualKeyStates::Down;
1678
+ bool fMeta =
1679
+ ((source.GetKeyState(winrt::Windows::System::VirtualKey::LeftWindows) &
1680
+ winrt::Microsoft::UI::Input::VirtualKeyStates::Down) == winrt::Microsoft::UI::Input::VirtualKeyStates::Down) ||
1681
+ ((source.GetKeyState(winrt::Windows::System::VirtualKey::RightWindows) &
1682
+ winrt::Microsoft::UI::Input::VirtualKeyStates::Down) == winrt::Microsoft::UI::Input::VirtualKeyStates::Down);
1660
1683
 
1661
1684
  if (args.OriginalSource() == Tag() && !args.Handled()) {
1662
1685
  facebook::react::KeyEvent event;
@@ -1665,7 +1688,12 @@ void ViewComponentView::OnKeyDown(
1665
1688
  event.altKey = fAlt;
1666
1689
  event.metaKey = fMeta;
1667
1690
 
1668
- event.key = ::Microsoft::ReactNative::FromVirtualKey(args.Key(), event.shiftKey, !!(GetKeyState(VK_CAPITAL) & 1));
1691
+ event.key = ::Microsoft::ReactNative::FromVirtualKey(
1692
+ args.Key(),
1693
+ event.shiftKey,
1694
+ !!((source.GetKeyState(winrt::Windows::System::VirtualKey::CapitalLock) &
1695
+ winrt::Microsoft::UI::Input::VirtualKeyStates::Locked) ==
1696
+ winrt::Microsoft::UI::Input::VirtualKeyStates::Locked));
1669
1697
  event.code = eventCode;
1670
1698
  m_eventEmitter->onKeyDown(event);
1671
1699
  }
@@ -1686,16 +1714,20 @@ void ViewComponentView::OnKeyUp(
1686
1714
  const winrt::Microsoft::ReactNative::Composition::Input::KeyboardSource &source,
1687
1715
  const winrt::Microsoft::ReactNative::Composition::Input::KeyRoutedEventArgs &args) noexcept {
1688
1716
  auto eventCode = CodeFromVirtualKey(source, args.Key());
1689
- bool fShift = source.GetKeyState(winrt::Windows::System::VirtualKey::Shift) !=
1690
- winrt::Windows::UI::Core::CoreVirtualKeyStates::None;
1691
- bool fAlt = source.GetKeyState(winrt::Windows::System::VirtualKey::Menu) !=
1692
- winrt::Windows::UI::Core::CoreVirtualKeyStates::None;
1693
- bool fCtrl = source.GetKeyState(winrt::Windows::System::VirtualKey::Control) !=
1694
- winrt::Windows::UI::Core::CoreVirtualKeyStates::None;
1695
- bool fMeta = (source.GetKeyState(winrt::Windows::System::VirtualKey::LeftWindows) !=
1696
- winrt::Windows::UI::Core::CoreVirtualKeyStates::None) ||
1697
- (source.GetKeyState(winrt::Windows::System::VirtualKey::RightWindows) !=
1698
- winrt::Windows::UI::Core::CoreVirtualKeyStates::None);
1717
+ bool fShift =
1718
+ (source.GetKeyState(winrt::Windows::System::VirtualKey::Shift) &
1719
+ winrt::Microsoft::UI::Input::VirtualKeyStates::Down) == winrt::Microsoft::UI::Input::VirtualKeyStates::Down;
1720
+ bool fAlt =
1721
+ (source.GetKeyState(winrt::Windows::System::VirtualKey::Menu) &
1722
+ winrt::Microsoft::UI::Input::VirtualKeyStates::Down) == winrt::Microsoft::UI::Input::VirtualKeyStates::Down;
1723
+ bool fCtrl =
1724
+ (source.GetKeyState(winrt::Windows::System::VirtualKey::Control) &
1725
+ winrt::Microsoft::UI::Input::VirtualKeyStates::Down) == winrt::Microsoft::UI::Input::VirtualKeyStates::Down;
1726
+ bool fMeta =
1727
+ ((source.GetKeyState(winrt::Windows::System::VirtualKey::LeftWindows) &
1728
+ winrt::Microsoft::UI::Input::VirtualKeyStates::Down) == winrt::Microsoft::UI::Input::VirtualKeyStates::Down) ||
1729
+ ((source.GetKeyState(winrt::Windows::System::VirtualKey::RightWindows) &
1730
+ winrt::Microsoft::UI::Input::VirtualKeyStates::Down) == winrt::Microsoft::UI::Input::VirtualKeyStates::Down);
1699
1731
 
1700
1732
  if (args.OriginalSource() == Tag()) {
1701
1733
  facebook::react::KeyEvent event;
@@ -1704,7 +1736,12 @@ void ViewComponentView::OnKeyUp(
1704
1736
  event.altKey = fAlt;
1705
1737
  event.metaKey = fMeta;
1706
1738
 
1707
- event.key = ::Microsoft::ReactNative::FromVirtualKey(args.Key(), event.shiftKey, !!(GetKeyState(VK_CAPITAL) & 1));
1739
+ event.key = ::Microsoft::ReactNative::FromVirtualKey(
1740
+ args.Key(),
1741
+ event.shiftKey,
1742
+ !!((source.GetKeyState(winrt::Windows::System::VirtualKey::CapitalLock) &
1743
+ winrt::Microsoft::UI::Input::VirtualKeyStates::Down) ==
1744
+ winrt::Microsoft::UI::Input::VirtualKeyStates::Down));
1708
1745
  event.code = eventCode;
1709
1746
  m_eventEmitter->onKeyUp(event);
1710
1747
  }
@@ -168,7 +168,11 @@ struct ComponentView
168
168
  std::array<winrt::Microsoft::ReactNative::Composition::Experimental::ISpriteVisual, SpecialBorderLayerCount>
169
169
  FindSpecialBorderLayers() const noexcept;
170
170
  void UpdateCenterPropertySet() noexcept;
171
+ void FinalizeTransform(
172
+ facebook::react::LayoutMetrics const &layoutMetrics,
173
+ const facebook::react::ViewProps &viewProps) noexcept;
171
174
 
175
+ bool m_FinalizeTransform{false};
172
176
  ComponentViewFeatures m_flags;
173
177
  void showFocusVisual(bool show) noexcept;
174
178
  winrt::Microsoft::ReactNative::Composition::Experimental::IFocusVisual m_focusVisual{nullptr};
@@ -30,9 +30,9 @@ extern "C" HRESULT WINAPI WICCreateImagingFactory_Proxy(UINT SDKVersion, IWICIma
30
30
 
31
31
  namespace winrt::Microsoft::ReactNative::Composition::implementation {
32
32
 
33
- ImageComponentView::WindowsImageResponseObserver::WindowsImageResponseObserver(ImageComponentView &image) {
34
- m_image.copy_from(&image);
35
- }
33
+ ImageComponentView::WindowsImageResponseObserver::WindowsImageResponseObserver(
34
+ winrt::weak_ref<winrt::Microsoft::ReactNative::Composition::implementation::ImageComponentView> wkImage)
35
+ : m_wkImage(std::move(wkImage)) {}
36
36
 
37
37
  void ImageComponentView::WindowsImageResponseObserver::didReceiveProgress(float progress) const {
38
38
  // TODO progress?
@@ -40,13 +40,20 @@ void ImageComponentView::WindowsImageResponseObserver::didReceiveProgress(float
40
40
 
41
41
  void ImageComponentView::WindowsImageResponseObserver::didReceiveImage(
42
42
  facebook::react::ImageResponse const &imageResponse) const {
43
- auto imageResponseImage = std::static_pointer_cast<ImageResponseImage>(imageResponse.getImage());
44
- m_image->m_reactContext.UIDispatcher().Post(
45
- [imageResponseImage, image = m_image]() { image->didReceiveImage(imageResponseImage); });
43
+ if (auto imgComponentView{m_wkImage.get()}) {
44
+ auto imageResponseImage = std::static_pointer_cast<ImageResponseImage>(imageResponse.getImage());
45
+ imgComponentView->m_reactContext.UIDispatcher().Post([imageResponseImage, wkImage = m_wkImage]() {
46
+ if (auto image{wkImage.get()}) {
47
+ image->didReceiveImage(imageResponseImage);
48
+ }
49
+ });
50
+ }
46
51
  }
47
52
 
48
53
  void ImageComponentView::WindowsImageResponseObserver::didReceiveFailure() const {
49
- m_image->didReceiveFailureFromObserver();
54
+ if (auto imgComponentView{m_wkImage.get()}) {
55
+ imgComponentView->didReceiveFailureFromObserver();
56
+ }
50
57
  }
51
58
 
52
59
  facebook::react::SharedViewProps ImageComponentView::defaultProps() noexcept {
@@ -142,14 +149,7 @@ void ImageComponentView::updateState(
142
149
  auto newImageState = std::static_pointer_cast<facebook::react::ImageShadowNode::ConcreteState const>(state);
143
150
 
144
151
  if (!m_imageResponseObserver) {
145
- // Should ViewComponents enable_shared_from_this? then we don't need this dance to get a shared_ptr
146
- std::shared_ptr<::Microsoft::ReactNative::FabricUIManager> fabricuiManager =
147
- ::Microsoft::ReactNative::FabricUIManager::FromProperties(m_reactContext.Properties());
148
- auto componentViewDescriptor = fabricuiManager->GetViewRegistry().componentViewDescriptorWithTag(m_tag);
149
-
150
- m_imageResponseObserver = std::make_shared<WindowsImageResponseObserver>(
151
- *componentViewDescriptor.view
152
- .as<winrt::Microsoft::ReactNative::Composition::implementation::ImageComponentView>());
152
+ m_imageResponseObserver = std::make_shared<WindowsImageResponseObserver>(get_weak());
153
153
  }
154
154
 
155
155
  setStateAndResubscribeImageResponseObserver(newImageState);
@@ -178,6 +178,10 @@ void ImageComponentView::setStateAndResubscribeImageResponseObserver(
178
178
  }
179
179
  }
180
180
 
181
+ void ImageComponentView::prepareForRecycle() noexcept {
182
+ setStateAndResubscribeImageResponseObserver(nullptr);
183
+ }
184
+
181
185
  winrt::Microsoft::ReactNative::ImageProps ImageComponentView::ImageProps() noexcept {
182
186
  // We do not currently support custom ImageComponentView's
183
187
  // If we did we would need to create a AbiImageProps and possibly return them here