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

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 (63) 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/CompositionComponentView.idl +3 -0
  15. package/Microsoft.ReactNative/Fabric/ComponentView.cpp +18 -0
  16. package/Microsoft.ReactNative/Fabric/ComponentView.h +9 -0
  17. package/Microsoft.ReactNative/Fabric/Composition/Composition.Input.cpp +12 -0
  18. package/Microsoft.ReactNative/Fabric/Composition/Composition.Input.h +15 -0
  19. package/Microsoft.ReactNative/Fabric/Composition/CompositionEventHandler.cpp +75 -0
  20. package/Microsoft.ReactNative/Fabric/Composition/CompositionEventHandler.h +1 -0
  21. package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.cpp +84 -17
  22. package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.h +4 -0
  23. package/Microsoft.ReactNative/Fabric/Composition/ContentIslandComponentView.cpp +56 -82
  24. package/Microsoft.ReactNative/Fabric/Composition/ContentIslandComponentView.h +7 -4
  25. package/Microsoft.ReactNative/Fabric/Composition/ParagraphComponentView.cpp +82 -14
  26. package/Microsoft.ReactNative/Fabric/Composition/ParagraphComponentView.h +11 -4
  27. package/Microsoft.ReactNative/Fabric/Composition/ScrollViewComponentView.cpp +33 -0
  28. package/Microsoft.ReactNative/Fabric/Composition/ScrollViewComponentView.h +17 -0
  29. package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.cpp +59 -31
  30. package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.h +3 -0
  31. package/Microsoft.ReactNative/Modules/ImageViewManagerModule.cpp +42 -15
  32. package/Microsoft.ReactNative.Cxx/ReactCommon/react/timing/primitives.h +12 -0
  33. package/PropertySheets/Generated/PackageVersion.g.props +2 -2
  34. package/PropertySheets/Warnings.props +1 -2
  35. package/PropertySheets/WinUI.props +1 -1
  36. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/text/BaseParagraphProps.cpp +174 -0
  37. package/ReactCommon/TEMP_UntilReactCommonUpdate/react/renderer/components/text/BaseParagraphProps.h +69 -0
  38. package/Scripts/NuGetRestoreForceEvaluateAllSolutions.ps1 +5 -11
  39. package/Scripts/rnw-dependencies.ps1 +15 -1
  40. package/Shared/Shared.vcxitems +1 -0
  41. package/Shared/Shared.vcxitems.filters +1 -3
  42. package/codegen/NativePerformanceSpec.g.h +41 -35
  43. package/codegen/NativeReactNativeFeatureFlagsSpec.g.h +55 -49
  44. package/codegen/rnwcoreJSI-generated.cpp +434 -422
  45. package/codegen/rnwcoreJSI.h +18 -0
  46. package/index.js +6 -0
  47. package/index.windows.js +6 -0
  48. package/package.json +15 -14
  49. package/src/private/featureflags/ReactNativeFeatureFlags.js +6 -1
  50. package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +2 -1
  51. package/src/private/setup/{setUpPerformanceObserver.js → setUpPerformanceModern.js} +43 -18
  52. package/src/private/specs_DEPRECATED/components/SwitchNativeComponent.js +1 -0
  53. package/src/private/specs_DEPRECATED/modules/NativeTiming.js +1 -0
  54. package/src/private/webapis/performance/EventTiming.js +34 -15
  55. package/src/private/webapis/performance/LongTasks.js +35 -2
  56. package/src/private/webapis/performance/Performance.js +49 -13
  57. package/src/private/webapis/performance/PerformanceEntry.js +21 -8
  58. package/src/private/webapis/performance/PerformanceObserver.js +30 -1
  59. package/src/private/webapis/performance/ReactNativeStartupTiming.js +3 -24
  60. package/src/private/webapis/performance/ResourceTiming.js +29 -18
  61. package/src/private/webapis/performance/UserTiming.js +33 -28
  62. package/src/private/webapis/performance/internals/RawPerformanceEntry.js +3 -4
  63. package/src/private/webapis/performance/specs/NativePerformance.js +2 -0
@@ -186,6 +186,7 @@ struct CompTextHost : public winrt::implements<CompTextHost, ITextHost> {
186
186
 
187
187
  auto pt = m_outer->getClientOffset();
188
188
  m_outer->m_caretVisual.Position({x - pt.x, y - pt.y});
189
+ m_outer->m_caretPosition = {x, y};
189
190
  return true;
190
191
  }
191
192
 
@@ -696,17 +697,10 @@ void WindowsTextInputComponentView::OnPointerPressed(
696
697
  }
697
698
 
698
699
  if (m_textServices && msg) {
699
- if (msg == WM_RBUTTONUP && !windowsTextInputProps().contextMenuHidden) {
700
- ShowContextMenu(position);
701
- args.Handled(true);
702
- } else if (msg == WM_RBUTTONUP && windowsTextInputProps().contextMenuHidden) {
703
- args.Handled(true);
704
- } else {
705
- LRESULT lresult;
706
- DrawBlock db(*this);
707
- auto hr = m_textServices->TxSendMessage(msg, static_cast<WPARAM>(wParam), static_cast<LPARAM>(lParam), &lresult);
708
- args.Handled(hr != S_FALSE);
709
- }
700
+ LRESULT lresult;
701
+ DrawBlock db(*this);
702
+ auto hr = m_textServices->TxSendMessage(msg, static_cast<WPARAM>(wParam), static_cast<LPARAM>(lParam), &lresult);
703
+ args.Handled(hr != S_FALSE);
710
704
  }
711
705
 
712
706
  // Emits the OnPressIn event
@@ -768,10 +762,18 @@ void WindowsTextInputComponentView::OnPointerReleased(
768
762
  }
769
763
 
770
764
  if (m_textServices && msg) {
771
- LRESULT lresult;
772
- DrawBlock db(*this);
773
- auto hr = m_textServices->TxSendMessage(msg, static_cast<WPARAM>(wParam), static_cast<LPARAM>(lParam), &lresult);
774
- args.Handled(hr != S_FALSE);
765
+ // Show context menu on right button release (standard Windows behavior)
766
+ if (msg == WM_RBUTTONUP && !windowsTextInputProps().contextMenuHidden) {
767
+ ShowContextMenu(LocalToScreen(position));
768
+ args.Handled(true);
769
+ } else if (msg == WM_RBUTTONUP) {
770
+ // Context menu is hidden - don't mark as handled, let app add custom behavior
771
+ } else {
772
+ LRESULT lresult;
773
+ DrawBlock db(*this);
774
+ auto hr = m_textServices->TxSendMessage(msg, static_cast<WPARAM>(wParam), static_cast<LPARAM>(lParam), &lresult);
775
+ args.Handled(hr != S_FALSE);
776
+ }
775
777
  }
776
778
 
777
779
  // Emits the OnPressOut event
@@ -1508,18 +1510,26 @@ void WindowsTextInputComponentView::UpdateCharFormat() noexcept {
1508
1510
  cfNew.wWeight =
1509
1511
  props.textAttributes.fontWeight ? static_cast<WORD>(*props.textAttributes.fontWeight) : DWRITE_FONT_WEIGHT_NORMAL;
1510
1512
 
1511
- // set font style
1512
- // cfNew.dwMask |= (CFM_ITALIC | CFM_STRIKEOUT | CFM_UNDERLINE);
1513
- // int dFontStyle = fontDetails.FontStyle;
1514
- // if (dFontStyle & FS_Italic) {
1515
- // cfNew.dwEffects |= CFE_ITALIC;
1516
- // }
1517
- // if (dFontStyle & FS_StrikeOut) {
1518
- // cfNew.dwEffects |= CFE_STRIKEOUT;
1519
- //}
1520
- // if (dFontStyle & FS_Underline) {
1521
- // cfNew.dwEffects |= CFE_UNDERLINE;
1522
- // }
1513
+ // set font style (italic)
1514
+ cfNew.dwMask |= CFM_ITALIC;
1515
+ if (props.textAttributes.fontStyle == facebook::react::FontStyle::Italic ||
1516
+ props.textAttributes.fontStyle == facebook::react::FontStyle::Oblique) {
1517
+ cfNew.dwEffects |= CFE_ITALIC;
1518
+ }
1519
+
1520
+ // set text decoration (underline and strikethrough)
1521
+ cfNew.dwMask |= (CFM_UNDERLINE | CFM_STRIKEOUT);
1522
+ if (props.textAttributes.textDecorationLineType.has_value()) {
1523
+ auto decorationType = *props.textAttributes.textDecorationLineType;
1524
+ if (decorationType == facebook::react::TextDecorationLineType::Underline ||
1525
+ decorationType == facebook::react::TextDecorationLineType::UnderlineStrikethrough) {
1526
+ cfNew.dwEffects |= CFE_UNDERLINE;
1527
+ }
1528
+ if (decorationType == facebook::react::TextDecorationLineType::Strikethrough ||
1529
+ decorationType == facebook::react::TextDecorationLineType::UnderlineStrikethrough) {
1530
+ cfNew.dwEffects |= CFE_STRIKEOUT;
1531
+ }
1532
+ }
1523
1533
 
1524
1534
  // set font family
1525
1535
  if (!props.textAttributes.fontFamily.empty()) {
@@ -1871,6 +1881,21 @@ void WindowsTextInputComponentView::updateSpellCheck(bool enable) noexcept {
1871
1881
  m_textServices->TxSendMessage(EM_SETLANGOPTIONS, IMF_SPELLCHECKING, enable ? newLangOptions : 0, &lresult));
1872
1882
  }
1873
1883
 
1884
+ void WindowsTextInputComponentView::OnContextMenuKey(
1885
+ const winrt::Microsoft::ReactNative::Composition::Input::ContextMenuKeyEventArgs &args) noexcept {
1886
+ // Handle context menu key event (SHIFT+F10 or Context Menu key)
1887
+ if (!windowsTextInputProps().contextMenuHidden) {
1888
+ // m_caretPosition is stored from TxSetCaretPos in RichEdit client rect space (physical pixels).
1889
+ // LocalToScreen expects logical (DIP) coordinates, so divide by pointScaleFactor.
1890
+ auto screenPt = LocalToScreen(winrt::Windows::Foundation::Point{
1891
+ static_cast<float>(m_caretPosition.x) / m_layoutMetrics.pointScaleFactor,
1892
+ static_cast<float>(m_caretPosition.y) / m_layoutMetrics.pointScaleFactor});
1893
+ ShowContextMenu(screenPt);
1894
+ args.Handled(true);
1895
+ }
1896
+ // If contextMenuHidden, don't mark as handled - let app handle it
1897
+ }
1898
+
1874
1899
  void WindowsTextInputComponentView::ShowContextMenu(const winrt::Windows::Foundation::Point &position) noexcept {
1875
1900
  HMENU menu = CreatePopupMenu();
1876
1901
  if (!menu)
@@ -1890,13 +1915,16 @@ void WindowsTextInputComponentView::ShowContextMenu(const winrt::Windows::Founda
1890
1915
  AppendMenuW(menu, MF_STRING | (canPaste ? 0 : MF_GRAYED), 3, L"Paste");
1891
1916
  AppendMenuW(menu, MF_STRING | (!isEmpty && !isReadOnly ? 0 : MF_GRAYED), 4, L"Select All");
1892
1917
 
1893
- POINT cursorPos;
1894
- GetCursorPos(&cursorPos);
1895
-
1896
1918
  HWND hwnd = GetActiveWindow();
1897
1919
 
1898
1920
  int cmd = TrackPopupMenu(
1899
- menu, TPM_LEFTALIGN | TPM_TOPALIGN | TPM_RETURNCMD | TPM_NONOTIFY, cursorPos.x, cursorPos.y, 0, hwnd, NULL);
1921
+ menu,
1922
+ TPM_LEFTALIGN | TPM_TOPALIGN | TPM_RETURNCMD | TPM_NONOTIFY,
1923
+ static_cast<int>(position.X),
1924
+ static_cast<int>(position.Y),
1925
+ 0,
1926
+ hwnd,
1927
+ NULL);
1900
1928
 
1901
1929
  if (cmd == 1) { // Cut
1902
1930
  m_textServices->TxSendMessage(WM_CUT, 0, 0, &res);
@@ -67,6 +67,8 @@ struct WindowsTextInputComponentView
67
67
  void OnKeyUp(const winrt::Microsoft::ReactNative::Composition::Input::KeyRoutedEventArgs &args) noexcept override;
68
68
  void OnCharacterReceived(const winrt::Microsoft::ReactNative::Composition::Input::CharacterReceivedRoutedEventArgs
69
69
  &args) noexcept override;
70
+ void OnContextMenuKey(
71
+ const winrt::Microsoft::ReactNative::Composition::Input::ContextMenuKeyEventArgs &args) noexcept override;
70
72
  void onMounted() noexcept override;
71
73
 
72
74
  std::optional<std::string> getAccessiblityValue() noexcept override;
@@ -146,6 +148,7 @@ struct WindowsTextInputComponentView
146
148
  DWORD m_propBitsMask{0};
147
149
  DWORD m_propBits{0};
148
150
  HCURSOR m_hcursor{nullptr};
151
+ POINT m_caretPosition{0, 0};
149
152
  std::chrono::steady_clock::time_point m_lastClickTime{};
150
153
  std::vector<facebook::react::CompWindowsTextInputSubmitKeyEventsStruct> m_submitKeyEvents;
151
154
  };
@@ -24,15 +24,28 @@ using namespace Windows::Storage::Streams;
24
24
 
25
25
  namespace Microsoft::ReactNative {
26
26
 
27
+ static const char *ERROR_INVALID_URI = "E_INVALID_URI";
28
+ static const char *ERROR_GET_SIZE_FAILURE = "E_GET_SIZE_FAILURE";
29
+
27
30
  winrt::fire_and_forget GetImageSizeAsync(
28
31
  const winrt::Microsoft::ReactNative::IReactPropertyBag &properties,
29
32
  std::string uriString,
30
33
  winrt::Microsoft::ReactNative::JSValue &&headers,
31
34
  Mso::Functor<void(int32_t width, int32_t height)> successCallback,
32
- Mso::Functor<void()> errorCallback) {
35
+ Mso::Functor<void(const char *errorCode, std::string errorMessage)> errorCallback) {
33
36
  bool succeeded{false};
37
+ const char *errorCode = ERROR_GET_SIZE_FAILURE;
38
+ std::string errorMessage;
34
39
 
35
40
  try {
41
+ // Validate URI is not empty
42
+ if (uriString.empty()) {
43
+ errorCode = ERROR_INVALID_URI;
44
+ errorMessage = "Cannot get the size of an image for an empty URI";
45
+ errorCallback(errorCode, errorMessage);
46
+ co_return;
47
+ }
48
+
36
49
  ReactImageSource source;
37
50
  source.uri = uriString;
38
51
  if (!headers.IsNull()) {
@@ -45,28 +58,38 @@ winrt::fire_and_forget GetImageSizeAsync(
45
58
  winrt::hstring scheme{uri.SchemeName()};
46
59
  bool needsDownload = (scheme == L"http") || (scheme == L"https");
47
60
  bool inlineData = scheme == L"data";
61
+ bool isLocalFile = (scheme == L"file") || (scheme == L"ms-appx") || (scheme == L"ms-appdata");
48
62
 
49
63
  winrt::IRandomAccessStream memoryStream;
50
- if (needsDownload) {
64
+ if (needsDownload || isLocalFile) {
51
65
  memoryStream = co_await GetImageStreamAsync(properties, source);
52
66
  } else if (inlineData) {
53
67
  memoryStream = co_await GetImageInlineDataAsync(source);
54
68
  }
55
- auto result = wicBitmapSourceFromStream(memoryStream);
56
- if (!std::get<std::shared_ptr<facebook::react::ImageErrorInfo>>(result)) {
57
- auto imagingFactory = std::get<winrt::com_ptr<IWICImagingFactory>>(result);
58
- auto wicBmpSource = std::get<winrt::com_ptr<IWICBitmapSource>>(result);
59
- UINT width, height;
60
- if (SUCCEEDED(wicBmpSource->GetSize(&width, &height))) {
61
- successCallback(width, height);
62
- succeeded = true;
69
+
70
+ if (memoryStream) {
71
+ auto result = wicBitmapSourceFromStream(memoryStream);
72
+ if (!std::get<std::shared_ptr<facebook::react::ImageErrorInfo>>(result)) {
73
+ auto imagingFactory = std::get<winrt::com_ptr<IWICImagingFactory>>(result);
74
+ auto wicBmpSource = std::get<winrt::com_ptr<IWICBitmapSource>>(result);
75
+ UINT width, height;
76
+ if (SUCCEEDED(wicBmpSource->GetSize(&width, &height))) {
77
+ successCallback(width, height);
78
+ succeeded = true;
79
+ }
63
80
  }
64
81
  }
65
- } catch (winrt::hresult_error const &) {
82
+ } catch (winrt::hresult_error const &e) {
83
+ errorMessage = "Failed to get image size: " + Microsoft::Common::Unicode::Utf16ToUtf8(std::wstring(e.message())) +
84
+ " for URI: " + uriString;
66
85
  }
67
86
 
68
- if (!succeeded)
69
- errorCallback();
87
+ if (!succeeded) {
88
+ if (errorMessage.empty()) {
89
+ errorMessage = "Failed to get image size for URI: " + uriString;
90
+ }
91
+ errorCallback(errorCode, errorMessage);
92
+ }
70
93
 
71
94
  co_return;
72
95
  }
@@ -85,7 +108,9 @@ void ImageLoader::getSize(std::string uri, React::ReactPromise<std::vector<doubl
85
108
  [result](double width, double height) noexcept {
86
109
  result.Resolve(std::vector<double>{width, height});
87
110
  },
88
- [result]() noexcept { result.Reject("Failed"); });
111
+ [result](const char *errorCode, std::string errorMessage) noexcept {
112
+ result.Reject(React::ReactError{errorCode, errorMessage});
113
+ });
89
114
  });
90
115
  }
91
116
 
@@ -105,7 +130,9 @@ void ImageLoader::getSizeWithHeaders(
105
130
  [result](double width, double height) noexcept {
106
131
  result.Resolve(Microsoft::ReactNativeSpecs::ImageLoaderIOSSpec_getSizeWithHeaders_returnType{width, height});
107
132
  },
108
- [result]() noexcept { result.Reject("Failed"); });
133
+ [result](const char *errorCode, std::string errorMessage) noexcept {
134
+ result.Reject(React::ReactError{errorCode, errorMessage});
135
+ });
109
136
  });
110
137
  }
111
138
 
@@ -201,6 +201,11 @@ class HighResTimeStamp {
201
201
  return HighResTimeStamp(chronoNow());
202
202
  }
203
203
 
204
+ static HighResDuration unsafeOriginFromUnixTimeStamp() noexcept {
205
+ static auto origin = computeUnsafeOriginFromUnixTimeStamp();
206
+ return origin;
207
+ }
208
+
204
209
  static constexpr HighResTimeStamp min() noexcept {
205
210
  return HighResTimeStamp(std::chrono::steady_clock::time_point::min());
206
211
  }
@@ -285,6 +290,13 @@ class HighResTimeStamp {
285
290
 
286
291
  std::chrono::steady_clock::time_point chronoTimePoint_;
287
292
 
293
+ static HighResDuration computeUnsafeOriginFromUnixTimeStamp() noexcept {
294
+ auto systemNow = std::chrono::system_clock::now();
295
+ auto steadyNow = std::chrono::steady_clock::now();
296
+ return HighResDuration(
297
+ systemNow.time_since_epoch() - steadyNow.time_since_epoch());
298
+ }
299
+
288
300
  #ifdef REACT_NATIVE_DEBUG
289
301
  static std::function<std::chrono::steady_clock::time_point()>&
290
302
  getTimeStampProvider() {
@@ -10,11 +10,11 @@
10
10
  -->
11
11
  <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
12
12
  <PropertyGroup>
13
- <ReactNativeWindowsVersion>0.82.0-preview.1</ReactNativeWindowsVersion>
13
+ <ReactNativeWindowsVersion>0.82.0-preview.11</ReactNativeWindowsVersion>
14
14
  <ReactNativeWindowsMajor>0</ReactNativeWindowsMajor>
15
15
  <ReactNativeWindowsMinor>82</ReactNativeWindowsMinor>
16
16
  <ReactNativeWindowsPatch>0</ReactNativeWindowsPatch>
17
17
  <ReactNativeWindowsCanary>false</ReactNativeWindowsCanary>
18
- <ReactNativeWindowsCommitId>ff00401de651ccddf5a25d411c3ace8e49f12189</ReactNativeWindowsCommitId>
18
+ <ReactNativeWindowsCommitId>d7ba35e21aee54fe408ad39cd45ad5254334c673</ReactNativeWindowsCommitId>
19
19
  </PropertyGroup>
20
20
  </Project>
@@ -24,8 +24,7 @@
24
24
  4701; <!-- potentially uninitialized local variable used -->
25
25
  4703; <!-- potentially uninitialized local pointer variable used -->
26
26
  4789; <!-- destination of memory copy too small -->
27
- 4995; <!-- function marked as pragma deprecated -->
28
- 4996 <!-- deprecated function (including std::) -->
27
+ 4995 <!-- function marked as pragma deprecated -->
29
28
  </SDLMandatoryWarnings>
30
29
 
31
30
  <!-- SDL RECOMMENDED WARNINGS (Strongly recommended to fix) -->
@@ -10,7 +10,7 @@
10
10
  <WinUI3ExperimentalVersion Condition="'$(WinUI3ExperimentalVersion)'==''">2.0.0-experimental3</WinUI3ExperimentalVersion>
11
11
  <!-- This value is also used by the CLI, see /packages/@react-native-windows/cli/.../autolinkWindows.ts -->
12
12
  <WinUI3Version Condition="'$(WinUI3Version)'=='' AND '$(UseExperimentalWinUI3)'=='true'">$(WinUI3ExperimentalVersion)</WinUI3Version>
13
- <WinUI3Version Condition="'$(WinUI3Version)'==''">1.8.251106002</WinUI3Version>
13
+ <WinUI3Version Condition="'$(WinUI3Version)'==''">1.8.260209005</WinUI3Version>
14
14
  <!-- This is needed to prevent build errors with WinAppSDK >= 1.7 trying to double build WindowsAppRuntimeAutoInitializer.cpp -->
15
15
  <WindowsAppSdkAutoInitialize Condition="'$(WindowsAppSdkAutoInitialize)'=='' And $([MSBuild]::VersionGreaterThan('$(WinUI3Version)', '1.7.0'))">false</WindowsAppSdkAutoInitialize>
16
16
  </PropertyGroup>
@@ -0,0 +1,174 @@
1
+ /*
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ #include "BaseParagraphProps.h"
9
+
10
+ #include <react/featureflags/ReactNativeFeatureFlags.h>
11
+ #include <react/renderer/attributedstring/conversions.h>
12
+ #include <react/renderer/attributedstring/primitives.h>
13
+ #include <react/renderer/core/propsConversions.h>
14
+ #include <react/renderer/debug/debugStringConvertibleUtils.h>
15
+
16
+ #include <glog/logging.h>
17
+
18
+ namespace facebook::react {
19
+
20
+ BaseParagraphProps::BaseParagraphProps(
21
+ const PropsParserContext& context,
22
+ const BaseParagraphProps& sourceProps,
23
+ const RawProps& rawProps)
24
+ : ViewProps(context, sourceProps, rawProps),
25
+ BaseTextProps(context, sourceProps, rawProps),
26
+ paragraphAttributes(
27
+ ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
28
+ ? sourceProps.paragraphAttributes
29
+ : convertRawProp(
30
+ context,
31
+ rawProps,
32
+ sourceProps.paragraphAttributes,
33
+ {})),
34
+ isSelectable(
35
+ ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
36
+ ? sourceProps.isSelectable
37
+ : convertRawProp(
38
+ context,
39
+ rawProps,
40
+ "selectable",
41
+ sourceProps.isSelectable,
42
+ false)),
43
+ onTextLayout(
44
+ ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
45
+ ? sourceProps.onTextLayout
46
+ : convertRawProp(
47
+ context,
48
+ rawProps,
49
+ "onTextLayout",
50
+ sourceProps.onTextLayout,
51
+ {})),
52
+ // [Windows]
53
+ selectionColor(
54
+ ReactNativeFeatureFlags::enableCppPropsIteratorSetter()
55
+ ? sourceProps.selectionColor
56
+ : convertRawProp(
57
+ context,
58
+ rawProps,
59
+ "selectionColor",
60
+ sourceProps.selectionColor,
61
+ {})) {
62
+ /*
63
+ * These props are applied to `View`, therefore they must not be a part of
64
+ * base text attributes.
65
+ */
66
+ textAttributes.opacity = std::numeric_limits<Float>::quiet_NaN();
67
+ textAttributes.backgroundColor = {};
68
+ };
69
+
70
+ void BaseParagraphProps::setProp(
71
+ const PropsParserContext& context,
72
+ RawPropsPropNameHash hash,
73
+ const char* propName,
74
+ const RawValue& value) {
75
+ // All Props structs setProp methods must always, unconditionally,
76
+ // call all super::setProp methods, since multiple structs may
77
+ // reuse the same values.
78
+ ViewProps::setProp(context, hash, propName, value);
79
+ BaseTextProps::setProp(context, hash, propName, value);
80
+
81
+ static auto defaults = BaseParagraphProps{};
82
+
83
+ // ParagraphAttributes has its own switch statement - to keep all
84
+ // of these fields together, and because there are some collisions between
85
+ // propnames parsed here and outside of ParagraphAttributes.
86
+ // This code is also duplicated in AndroidTextInput.
87
+ static auto paDefaults = ParagraphAttributes{};
88
+ switch (hash) {
89
+ REBUILD_FIELD_SWITCH_CASE(
90
+ paDefaults,
91
+ value,
92
+ paragraphAttributes,
93
+ maximumNumberOfLines,
94
+ "numberOfLines");
95
+ REBUILD_FIELD_SWITCH_CASE(
96
+ paDefaults, value, paragraphAttributes, ellipsizeMode, "ellipsizeMode");
97
+ REBUILD_FIELD_SWITCH_CASE(
98
+ paDefaults,
99
+ value,
100
+ paragraphAttributes,
101
+ textBreakStrategy,
102
+ "textBreakStrategy");
103
+ REBUILD_FIELD_SWITCH_CASE(
104
+ paDefaults,
105
+ value,
106
+ paragraphAttributes,
107
+ adjustsFontSizeToFit,
108
+ "adjustsFontSizeToFit");
109
+ REBUILD_FIELD_SWITCH_CASE(
110
+ paDefaults,
111
+ value,
112
+ paragraphAttributes,
113
+ minimumFontScale,
114
+ "minimumFontScale");
115
+ REBUILD_FIELD_SWITCH_CASE(
116
+ paDefaults,
117
+ value,
118
+ paragraphAttributes,
119
+ minimumFontSize,
120
+ "minimumFontSize");
121
+ REBUILD_FIELD_SWITCH_CASE(
122
+ paDefaults,
123
+ value,
124
+ paragraphAttributes,
125
+ maximumFontSize,
126
+ "maximumFontSize");
127
+ REBUILD_FIELD_SWITCH_CASE(
128
+ paDefaults,
129
+ value,
130
+ paragraphAttributes,
131
+ includeFontPadding,
132
+ "includeFontPadding");
133
+ REBUILD_FIELD_SWITCH_CASE(
134
+ paDefaults,
135
+ value,
136
+ paragraphAttributes,
137
+ android_hyphenationFrequency,
138
+ "android_hyphenationFrequency");
139
+ REBUILD_FIELD_SWITCH_CASE(
140
+ paDefaults,
141
+ value,
142
+ paragraphAttributes,
143
+ textAlignVertical,
144
+ "textAlignVertical");
145
+ }
146
+
147
+ switch (hash) {
148
+ RAW_SET_PROP_SWITCH_CASE(isSelectable, "selectable");
149
+ RAW_SET_PROP_SWITCH_CASE_BASIC(onTextLayout);
150
+ // [Windows]
151
+ RAW_SET_PROP_SWITCH_CASE_BASIC(selectionColor);
152
+ }
153
+
154
+ /*
155
+ * These props are applied to `View`, therefore they must not be a part of
156
+ * base text attributes.
157
+ */
158
+ textAttributes.opacity = std::numeric_limits<Float>::quiet_NaN();
159
+ textAttributes.backgroundColor = {};
160
+ }
161
+
162
+ #pragma mark - DebugStringConvertible
163
+
164
+ #if RN_DEBUG_STRING_CONVERTIBLE
165
+ SharedDebugStringConvertibleList BaseParagraphProps::getDebugProps() const {
166
+ return ViewProps::getDebugProps() + BaseTextProps::getDebugProps() +
167
+ paragraphAttributes.getDebugProps() +
168
+ SharedDebugStringConvertibleList{
169
+ debugStringConvertibleItem("selectable", isSelectable),
170
+ // [Windows]
171
+ debugStringConvertibleItem("selectionColor", selectionColor)};
172
+ }
173
+ #endif
174
+ } // namespace facebook::react
@@ -0,0 +1,69 @@
1
+ /*
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ #pragma once
9
+
10
+ #include <limits>
11
+ #include <memory>
12
+ // [Windows]
13
+ #include <optional>
14
+
15
+ #include <react/renderer/attributedstring/ParagraphAttributes.h>
16
+ #include <react/renderer/components/text/BaseTextProps.h>
17
+ #include <react/renderer/components/view/ViewProps.h>
18
+ #include <react/renderer/core/Props.h>
19
+ #include <react/renderer/core/PropsParserContext.h>
20
+ // [Windows]
21
+ #include <react/renderer/graphics/Color.h>
22
+
23
+ namespace facebook::react {
24
+
25
+ /*
26
+ * Props of <Paragraph> component.
27
+ * Most of the props are directly stored in composed `ParagraphAttributes`
28
+ * object.
29
+ */
30
+ class BaseParagraphProps : public ViewProps, public BaseTextProps {
31
+ public:
32
+ BaseParagraphProps() = default;
33
+ BaseParagraphProps(
34
+ const PropsParserContext &context,
35
+ const BaseParagraphProps &sourceProps,
36
+ const RawProps &rawProps);
37
+
38
+ void
39
+ setProp(const PropsParserContext &context, RawPropsPropNameHash hash, const char *propName, const RawValue &value);
40
+
41
+ #pragma mark - Props
42
+
43
+ /*
44
+ * Contains all prop values that affect visual representation of the
45
+ * paragraph.
46
+ */
47
+ ParagraphAttributes paragraphAttributes{};
48
+
49
+ /*
50
+ * Defines can the text be selected (and copied) or not.
51
+ */
52
+ bool isSelectable{};
53
+
54
+ bool onTextLayout{};
55
+
56
+ /*
57
+ * Defines the color of the selection highlight.
58
+ * [Windows]
59
+ */
60
+ std::optional<SharedColor> selectionColor{};
61
+
62
+ #pragma mark - DebugStringConvertible
63
+
64
+ #if RN_DEBUG_STRING_CONVERTIBLE
65
+ SharedDebugStringConvertibleList getDebugProps() const override;
66
+ #endif
67
+ };
68
+
69
+ } // namespace facebook::react
@@ -20,23 +20,17 @@ try {
20
20
  $packagesSolutions = (Get-ChildItem -File -Recurse -Path $RepoRoot\packages -Filter *.sln ) | Where-Object { !$_.FullName.Contains('node_modules') -and !$_.FullName.Contains('e2etest') }
21
21
  $vnextSolutions = (Get-ChildItem -File -Path $RepoRoot\vnext -Filter *.sln)
22
22
 
23
- # Run all solutions for each platform to ensure all projects are restored
24
- # (some projects are only configured for specific platforms)
25
- $platforms = @("x64","x86","ARM64")
23
+ # Run all solutions with their defaults
26
24
  $($packagesSolutions; $vnextSolutions) | Foreach-Object {
27
- foreach ($platform in $platforms) {
28
- Write-Host Restoring $_.FullName with Platform=$platform
29
- & msbuild /t:Restore /p:RestoreForceEvaluate=true /p:Platform=$platform $_.FullName
30
- }
25
+ Write-Host Restoring $_.FullName with defaults
26
+ & msbuild /t:Restore /p:RestoreForceEvaluate=true $_.FullName
31
27
  }
32
28
 
33
29
  # Re-run solutions that build with UseExperimentalWinUI3
34
30
  $experimentalSolutions = @("playground-composition.sln", "Microsoft.ReactNative.NewArch.sln", "ReactWindows-Desktop.sln");
35
31
  $($packagesSolutions; $vnextSolutions) | Where-Object { $experimentalSolutions -contains $_.Name } | Foreach-Object {
36
- foreach ($platform in $platforms) {
37
- Write-Host Restoring $_.FullName with UseExperimentalWinUI3=true Platform=$platform
38
- & msbuild /t:Restore /p:RestoreForceEvaluate=true /p:UseExperimentalWinUI3=true /p:Platform=$platform $_.FullName
39
- }
32
+ Write-Host Restoring $_.FullName with UseExperimentalWinUI3=true
33
+ & msbuild /t:Restore /p:RestoreForceEvaluate=true /p:UseExperimentalWinUI3=true $_.FullName
40
34
  }
41
35
  }
42
36
  finally {
@@ -469,7 +469,7 @@ $requirements = @(
469
469
  Name = 'Node.js (LTS, >= 22.0)';
470
470
  Tags = @('appDev');
471
471
  Valid = { CheckNode; }
472
- Install = { WinGetInstall OpenJS.NodeJS.LTS "22.14.0" };
472
+ Install = { WinGetInstall OpenJS.NodeJS.22 "22.22.0"};
473
473
  HasVerboseOutput = $true;
474
474
  },
475
475
  @{
@@ -600,6 +600,9 @@ function WinGetInstall {
600
600
  Write-Verbose "Executing `winget install `"$wingetPackage`"";
601
601
  & winget install "$wingetPackage" --accept-source-agreements --accept-package-agreements
602
602
  }
603
+
604
+ # Refresh PATH environment variable to pick up newly installed tools
605
+ $env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User")
603
606
  }
604
607
 
605
608
  function IsElevated {
@@ -685,6 +688,17 @@ foreach ($req in $filteredRequirements)
685
688
  $LASTEXITCODE = 0;
686
689
  $outputFromInstall = Invoke-Command $req.Install -ErrorAction Stop;
687
690
 
691
+ # Re-validate after install attempt - winget may return non-zero for "already installed"
692
+ $validAfterInstall = $false;
693
+ try {
694
+ $validAfterInstall = Invoke-Command $req.Valid;
695
+ } catch { }
696
+
697
+ if ($validAfterInstall) {
698
+ $Installed++;
699
+ continue; # go to the next item
700
+ }
701
+
688
702
  if ($LASTEXITCODE -ne 0) {
689
703
  throw "Last exit code was non-zero: $LASTEXITCODE - $outputFromInstall";
690
704
  }
@@ -444,6 +444,7 @@
444
444
  <CLCompile Include="$(ReactNativeDir)\ReactCommon\react\nativemodule\featureflags\NativeReactNativeFeatureFlags.cpp" />
445
445
  <CLCompile Include="$(ReactNativeDir)\ReactCommon\react\nativemodule\dom\NativeDOM.cpp" DisableSpecificWarnings="4715;%(DisableSpecificWarnings)" />
446
446
  <CLCompile Include="$(ReactNativeDir)\ReactCommon\react\nativemodule\idlecallbacks\NativeIdleCallbacks.cpp" />
447
+ <CLCompile Include="$(ReactNativeDir)\ReactCommon\react\nativemodule\webperformance\NativePerformance.cpp" DisableSpecificWarnings="4996;%(DisableSpecificWarnings)" />
447
448
  <ClCompile Include="$(ReactNativeDir)\ReactCommon\react\renderer\attributedstring\AttributedString.cpp" />
448
449
  <ClCompile Include="$(ReactNativeDir)\ReactCommon\react\renderer\attributedstring\AttributedStringBox.cpp" DisableSpecificWarnings="4715;%(DisableSpecificWarnings)" />
449
450
  <ClCompile Include="$(ReactNativeDir)\ReactCommon\react\renderer\components\view\BaseViewProps.cpp" DisableSpecificWarnings="4459;4715;%(DisableSpecificWarnings)" />
@@ -266,7 +266,6 @@
266
266
  <ClCompile Include="$(ReactNativeDir)\ReactCommon\jsinspector-modern\HostTarget.cpp" />
267
267
  <ClCompile Include="$(ReactNativeDir)\ReactCommon\jsinspector-modern\InspectorUtilities.cpp" />
268
268
  <ClCompile Include="$(ReactNativeDir)\ReactCommon\jsinspector-modern\RuntimeAgent.cpp" />
269
- <ClCompile Include="$(ReactNativeDir)\ReactCommon\cxxreact\Instance.cpp" />
270
269
  <ClCompile Include="$(ReactNativeDir)\ReactCommon\jsinspector-modern\FallbackRuntimeAgentDelegate.cpp" />
271
270
  <ClCompile Include="$(ReactNativeDir)\ReactCommon\jsinspector-modern\FallbackRuntimeTargetDelegate.cpp" />
272
271
  <ClCompile Include="$(ReactNativeDir)\ReactCommon\jsinspector-modern\RuntimeTarget.cpp" />
@@ -279,7 +278,6 @@
279
278
  <ClCompile Include="$(ReactNativeDir)\ReactCommon\react\utils\jsi-utils.cpp" />
280
279
  <ClCompile Include="$(MSBuildThisFileDirectory)..\Microsoft.ReactNative\Fabric\Composition\TextDrawing.cpp" />
281
280
  <ClCompile Include="$(ReactNativeDir)\ReactCommon\react\renderer\graphics\ColorComponents.cpp" />
282
- <ClCompile Include="$(ReactNativeDir)\ReactCommon\cxxreact\JSExecutor.cpp" />
283
281
  <ClCompile Include="$(ReactNativeDir)\ReactCommon\jsinspector-modern\RuntimeTargetConsole.cpp" />
284
282
  <ClCompile Include="$(ReactNativeDir)\ReactCommon\reactperflogger\reactperflogger\ReactPerfettoLogger.cpp" />
285
283
  <ClCompile Include="$(MSBuildThisFileDirectory)Networking\NetworkPropertyIds.cpp" />
@@ -290,7 +288,7 @@
290
288
  <ClCompile Include="$(MSBuildThisFileDirectory)..\codegen\rnwcoreJSI-generated.cpp" />
291
289
  <ClCompile Include="$(ReactNativeDir)\ReactCommon\jsinspector-modern\tracing\PerformanceTracer.cpp" />
292
290
  <ClCompile Include="$(ReactNativeDir)\ReactCommon\jsinspector-modern\tracing\TraceEventSerializer.cpp" />
293
- <ClCompile Include="$(ReactNativeDir)\ReactCommon\jsinspector-modern\HostTargetTraceRecording.cpp " />
291
+ <ClCompile Include="$(ReactNativeDir)\ReactCommon\jsinspector-modern\HostTargetTraceRecording.cpp " />
294
292
  <ClCompile Include="$(ReactNativeDir)\ReactCommon\jsinspector-modern\HostTargetTracing.cpp" />
295
293
  <ClCompile Include="$(ReactNativeDir)\ReactCommon\jsinspector-modern\tracing\TraceRecordingStateSerializer.cpp" />
296
294
  <ClCompile Include="$(ReactNativeDir)\ReactCommon\jsinspector-modern\PerfMonitorV2.cpp" />