react-native-windows 0.74.0-preview.4 → 0.74.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. package/Libraries/Core/ReactNativeVersion.js +1 -1
  2. package/Microsoft.ReactNative/CompositionRootView.idl +4 -2
  3. package/Microsoft.ReactNative/Fabric/Composition/CompositionContextHelper.cpp +8 -2
  4. package/Microsoft.ReactNative/Fabric/Composition/CompositionEventHandler.cpp +188 -141
  5. package/Microsoft.ReactNative/Fabric/Composition/CompositionEventHandler.h +1 -1
  6. package/Microsoft.ReactNative/Fabric/Composition/CompositionRootView.cpp +53 -35
  7. package/Microsoft.ReactNative/Fabric/Composition/CompositionRootView.h +6 -1
  8. package/Microsoft.ReactNative/Fabric/Composition/CompositionRootView_emptyimpl.cpp +7 -0
  9. package/Microsoft.ReactNative/Fabric/Composition/CompositionViewComponentView.cpp +79 -77
  10. package/Microsoft.ReactNative/Fabric/Composition/ImageComponentView.cpp +7 -14
  11. package/Microsoft.ReactNative/Fabric/Composition/Modal/WindowsModalHostViewComponentView.cpp +2 -5
  12. package/Microsoft.ReactNative/Fabric/Composition/ParagraphComponentView.cpp +2 -1
  13. package/Microsoft.ReactNative/Fabric/Composition/RootComponentView.cpp +5 -1
  14. package/Microsoft.ReactNative/Fabric/Composition/ScrollViewComponentView.cpp +2 -8
  15. package/Microsoft.ReactNative/Fabric/Composition/TextInput/WindowsTextInputComponentView.cpp +20 -15
  16. package/Microsoft.ReactNative/Fabric/Composition/Theme.cpp +28 -10
  17. package/Microsoft.ReactNative/Fabric/Composition/Theme.h +4 -3
  18. package/Microsoft.ReactNative/Fabric/Composition/Theme_emptyimpl.cpp +2 -6
  19. package/Microsoft.ReactNative/Fabric/Composition/UnimplementedNativeViewComponentView.cpp +2 -5
  20. package/Microsoft.ReactNative/Theme.idl +1 -2
  21. package/Microsoft.ReactNative/Utils/KeyboardUtils.cpp +10 -2
  22. package/Microsoft.ReactNative/Utils/KeyboardUtils.h +4 -1
  23. package/Microsoft.ReactNative.Cxx/AutoDraw.h +4 -1
  24. package/Microsoft.ReactNative.Cxx/CompositionSwitcher.Experimental.interop.h +1 -1
  25. package/PropertySheets/Generated/PackageVersion.g.props +3 -3
  26. package/Scripts/OfficeReact.Win32.nuspec +2 -0
  27. package/package.json +18 -15
@@ -526,6 +526,15 @@ static const winrt::Microsoft::ReactNative::ReactPropertyId<winrt::Microsoft::Re
526
526
  return prop;
527
527
  }
528
528
 
529
+ static const winrt::Microsoft::ReactNative::ReactPropertyId<
530
+ winrt::Microsoft::ReactNative::Composition::ICustomResourceLoader>
531
+ &ThemeResourcesPropertyId() noexcept {
532
+ static const winrt::Microsoft::ReactNative::ReactPropertyId<
533
+ winrt::Microsoft::ReactNative::Composition::ICustomResourceLoader>
534
+ prop{L"ReactNative.Composition", L"ThemeResources"};
535
+ return prop;
536
+ }
537
+
529
538
  winrt::Microsoft::ReactNative::Composition::Theme Theme::EmptyTheme() noexcept {
530
539
  static winrt::Microsoft::ReactNative::Composition::Theme s_emptyTheme{nullptr};
531
540
  if (!s_emptyTheme) {
@@ -537,14 +546,28 @@ winrt::Microsoft::ReactNative::Composition::Theme Theme::EmptyTheme() noexcept {
537
546
  /*static*/ winrt::Microsoft::ReactNative::Composition::Theme Theme::GetDefaultTheme(
538
547
  const winrt::Microsoft::ReactNative::IReactContext &context) noexcept {
539
548
  return winrt::Microsoft::ReactNative::ReactPropertyBag(context.Properties())
540
- .GetOrCreate(ThemePropertyId(), [context]() { return winrt::make<Theme>(context, nullptr); });
549
+ .GetOrCreate(ThemePropertyId(), [context]() {
550
+ return winrt::make<Theme>(
551
+ context,
552
+ winrt::Microsoft::ReactNative::ReactPropertyBag(context.Properties()).Get(ThemeResourcesPropertyId()));
553
+ });
541
554
  }
542
555
 
543
- /*static*/ void Theme::SetDefaultTheme(
556
+ /*static*/ void Theme::SetDefaultResources(
544
557
  const winrt::Microsoft::ReactNative::ReactInstanceSettings &settings,
545
- const winrt::Microsoft::ReactNative::Composition::Theme &theme) noexcept {
546
- winrt::Microsoft::ReactNative::ReactPropertyBag(settings.Properties()).Set(ThemePropertyId(), theme);
547
- settings.Notifications().SendNotification(ThemeChangedEventName(), nullptr, nullptr);
558
+ const winrt::Microsoft::ReactNative::Composition::ICustomResourceLoader &resources) noexcept {
559
+ winrt::Microsoft::ReactNative::ReactPropertyBag properties(settings.Properties());
560
+ properties.Set(ThemeResourcesPropertyId(), resources);
561
+ // If a default theme has already been created - we need to update it with the new resources
562
+ if (auto theme = properties.Get(ThemePropertyId())) {
563
+ winrt::get_self<Theme>(theme)->UpdateCustomResources(resources);
564
+ }
565
+ }
566
+
567
+ void Theme::UpdateCustomResources(
568
+ const winrt::Microsoft::ReactNative::Composition::ICustomResourceLoader &resources) noexcept {
569
+ m_customResourceLoader = resources;
570
+ ClearCacheAndRaiseChangedEvent();
548
571
  }
549
572
 
550
573
  IReactPropertyNamespace ThemeNamespace() noexcept {
@@ -552,9 +575,4 @@ IReactPropertyNamespace ThemeNamespace() noexcept {
552
575
  return value;
553
576
  }
554
577
 
555
- /*static*/ IReactPropertyName Theme::ThemeChangedEventName() noexcept {
556
- static IReactPropertyName propName = ReactPropertyBagHelper::GetName(ThemeNamespace(), L"Changed");
557
- return propName;
558
- }
559
-
560
578
  } // namespace winrt::Microsoft::ReactNative::Composition::implementation
@@ -50,12 +50,13 @@ struct Theme : ThemeT<Theme, Experimental::IInternalTheme> {
50
50
 
51
51
  static winrt::Microsoft::ReactNative::Composition::Theme GetDefaultTheme(
52
52
  const winrt::Microsoft::ReactNative::IReactContext &context) noexcept;
53
- static void SetDefaultTheme(
53
+ static void SetDefaultResources(
54
54
  const winrt::Microsoft::ReactNative::ReactInstanceSettings &settings,
55
- const winrt::Microsoft::ReactNative::Composition::Theme &theme) noexcept;
56
- static winrt::Microsoft::ReactNative::IReactPropertyName ThemeChangedEventName() noexcept;
55
+ const winrt::Microsoft::ReactNative::Composition::ICustomResourceLoader &resources) noexcept;
57
56
 
58
57
  private:
58
+ void UpdateCustomResources(
59
+ const winrt::Microsoft::ReactNative::Composition::ICustomResourceLoader &resources) noexcept;
59
60
  bool TryGetPlatformColor(const std::string &platformColor, winrt::Windows::UI::Color &color) noexcept;
60
61
  void ClearCacheAndRaiseChangedEvent() noexcept;
61
62
 
@@ -74,12 +74,8 @@ winrt::Microsoft::ReactNative::Composition::Theme Theme::EmptyTheme() noexcept {
74
74
  return nullptr;
75
75
  }
76
76
 
77
- /*static*/ void Theme::SetDefaultTheme(
77
+ /*static*/ void Theme::SetDefaultResources(
78
78
  const winrt::Microsoft::ReactNative::ReactInstanceSettings &,
79
- const winrt::Microsoft::ReactNative::Composition::Theme &) noexcept {}
80
-
81
- /*static*/ IReactPropertyName Theme::ThemeChangedEventName() noexcept {
82
- return nullptr;
83
- }
79
+ const winrt::Microsoft::ReactNative::Composition::ICustomResourceLoader &) noexcept {}
84
80
 
85
81
  } // namespace winrt::Microsoft::ReactNative::Composition::implementation
@@ -76,14 +76,11 @@ void UnimplementedNativeViewComponentView::updateLayoutMetrics(
76
76
 
77
77
  POINT offset;
78
78
  {
79
- ::Microsoft::ReactNative::Composition::AutoDrawDrawingSurface autoDraw(drawingSurface, &offset);
79
+ ::Microsoft::ReactNative::Composition::AutoDrawDrawingSurface autoDraw(
80
+ drawingSurface, m_layoutMetrics.pointScaleFactor, &offset);
80
81
  if (auto d2dDeviceContext = autoDraw.GetRenderTarget()) {
81
82
  d2dDeviceContext->Clear(D2D1::ColorF(D2D1::ColorF::Red, 0.3f));
82
83
  assert(d2dDeviceContext->GetUnitMode() == D2D1_UNIT_MODE_DIPS);
83
- const auto dpi = m_layoutMetrics.pointScaleFactor * 96.0f;
84
- float oldDpiX, oldDpiY;
85
- d2dDeviceContext->GetDpi(&oldDpiX, &oldDpiY);
86
- d2dDeviceContext->SetDpi(dpi, dpi);
87
84
 
88
85
  float offsetX = static_cast<float>(offset.x / m_layoutMetrics.pointScaleFactor);
89
86
  float offsetY = static_cast<float>(offset.y / m_layoutMetrics.pointScaleFactor);
@@ -61,8 +61,7 @@ namespace Microsoft.ReactNative.Composition
61
61
  event Windows.Foundation.EventHandler<Object> ThemeChanged;
62
62
 
63
63
  static Theme GetDefaultTheme(Microsoft.ReactNative.IReactContext context);
64
- static void SetDefaultTheme(Microsoft.ReactNative.ReactInstanceSettings settings, Theme theme);
65
- static Microsoft.ReactNative.IReactPropertyName ThemeChangedEventName { get; };
64
+ static void SetDefaultResources(Microsoft.ReactNative.ReactInstanceSettings settings, ICustomResourceLoader theme);
66
65
  };
67
66
 
68
67
  } // namespace Microsoft.ReactNative
@@ -348,6 +348,14 @@ static const std::string GetOrUnidentified(
348
348
  return "Unidentified";
349
349
  }
350
350
 
351
+ const std::string GetOrUnidentifiedCode(winrt::Windows::System::VirtualKey virtualKey) {
352
+ return GetOrUnidentified(virtualKey, g_virtualKeyToCode);
353
+ }
354
+
355
+ const std::string GetOrUnidentifiedKey(winrt::Windows::System::VirtualKey virtualKey) {
356
+ return GetOrUnidentified(virtualKey, g_virtualKeyToKey);
357
+ }
358
+
351
359
  std::string FromVirtualKey(winrt::Windows::System::VirtualKey virtualKey, bool fShift, bool fCaps) {
352
360
  int vk = static_cast<int>(virtualKey);
353
361
 
@@ -362,7 +370,7 @@ std::string FromVirtualKey(winrt::Windows::System::VirtualKey virtualKey, bool f
362
370
  return std::string{c};
363
371
  }
364
372
 
365
- return GetOrUnidentified(virtualKey, g_virtualKeyToKey);
373
+ return GetOrUnidentifiedKey(virtualKey);
366
374
  }
367
375
 
368
376
  bool IsModifiedKeyPressed(winrt::CoreWindow const &coreWindow, winrt::Windows::System::VirtualKey virtualKey) {
@@ -410,7 +418,7 @@ std::string CodeFromVirtualKey(winrt::Windows::System::VirtualKey virtualKey) {
410
418
  }
411
419
  }
412
420
 
413
- return GetOrUnidentified(virtualKey, g_virtualKeyToCode);
421
+ return GetOrUnidentifiedCode(virtualKey);
414
422
  }
415
423
 
416
424
  } // namespace Microsoft::ReactNative
@@ -12,4 +12,7 @@ bool IsModifiedKeyPressed(winrt::CoreWindow const &coreWindow, winrt::Windows::S
12
12
  std::string FromVirtualKey(winrt::Windows::System::VirtualKey virtualKey, bool fShift, bool fCaps);
13
13
  std::string CodeFromVirtualKey(winrt::Windows::System::VirtualKey virtualKey);
14
14
 
15
- } // namespace Microsoft::ReactNative
15
+ const std::string GetOrUnidentifiedCode(winrt::Windows::System::VirtualKey virtualKey);
16
+ const std::string GetOrUnidentifiedKey(winrt::Windows::System::VirtualKey virtualKey);
17
+
18
+ } // namespace Microsoft::ReactNative
@@ -11,13 +11,16 @@ class AutoDrawDrawingSurface {
11
11
  public:
12
12
  AutoDrawDrawingSurface(
13
13
  winrt::Microsoft::ReactNative::Composition::Experimental::IDrawingSurfaceBrush &drawingSurface,
14
+ float scaleFactor,
14
15
  POINT *offset) noexcept {
15
16
  drawingSurface.as(m_drawingSurfaceInterop);
16
- m_drawingSurfaceInterop->BeginDraw(m_d2dDeviceContext.put(), offset);
17
+ auto dpi = scaleFactor * 96.0f;
18
+ m_drawingSurfaceInterop->BeginDraw(m_d2dDeviceContext.put(), dpi, dpi, offset);
17
19
  }
18
20
 
19
21
  ~AutoDrawDrawingSurface() noexcept {
20
22
  if (m_d2dDeviceContext) {
23
+ m_d2dDeviceContext = nullptr;
21
24
  m_drawingSurfaceInterop->EndDraw();
22
25
  }
23
26
  }
@@ -15,7 +15,7 @@
15
15
  namespace Microsoft::ReactNative::Composition::Experimental {
16
16
 
17
17
  struct __declspec(uuid("941FDD90-ED27-49CE-A1CD-86ECB2D4A0FA")) ICompositionDrawingSurfaceInterop : public IUnknown {
18
- virtual HRESULT BeginDraw(ID2D1DeviceContext **deviceContextOut, POINT *offset) noexcept = 0;
18
+ virtual HRESULT BeginDraw(ID2D1DeviceContext **deviceContextOut, float xDpi, float yDpi, POINT *offset) noexcept = 0;
19
19
  virtual HRESULT EndDraw() noexcept = 0;
20
20
  };
21
21
 
@@ -10,11 +10,11 @@
10
10
  -->
11
11
  <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
12
12
  <PropertyGroup>
13
- <ReactNativeWindowsVersion>0.74.0-preview.4</ReactNativeWindowsVersion>
13
+ <ReactNativeWindowsVersion>0.74.1</ReactNativeWindowsVersion>
14
14
  <ReactNativeWindowsMajor>0</ReactNativeWindowsMajor>
15
15
  <ReactNativeWindowsMinor>74</ReactNativeWindowsMinor>
16
- <ReactNativeWindowsPatch>0</ReactNativeWindowsPatch>
16
+ <ReactNativeWindowsPatch>1</ReactNativeWindowsPatch>
17
17
  <ReactNativeWindowsCanary>false</ReactNativeWindowsCanary>
18
- <ReactNativeWindowsCommitId>377d16da702ed9ba7e7e66cc3483fffe72d56d9e</ReactNativeWindowsCommitId>
18
+ <ReactNativeWindowsCommitId>7fd1f4439e2e1f109d4d2b20a97073f14bcbf504</ReactNativeWindowsCommitId>
19
19
  </PropertyGroup>
20
20
  </Project>
@@ -40,6 +40,7 @@
40
40
  <file src="$nugetroot$\inc\runtimeexecutor\ReactCommon\RuntimeExecutor.h" target="inc\ReactCommon"/>
41
41
  <file src="$nugetroot$\inc\cxxreact\*" target="inc\cxxreact"/>
42
42
  <file src="$nugetroot$\inc\jsi\**\*.*" target="inc\jsi"/>
43
+ <file src="$nugetroot$\inc\jsinspector-modern\*" target="inc\jsinspector-modern"/>
43
44
  <file src="$nugetroot$\inc\Yoga\*.*" target="inc\Yoga"/>
44
45
  <file src="$nugetroot$\inc\folly\**\*.*" target="inc" />
45
46
  <file src="$nugetroot$\inc\fmt\**\*.*" target="inc\fmt" />
@@ -62,6 +63,7 @@
62
63
  <file src="$nugetroot$\inc\Shared\Networking\OriginPolicy.h" target="inc"/>
63
64
  <file src="$nugetroot$\inc\Shared\RuntimeOptions.h" target="inc"/>
64
65
  <file src="$nugetroot$\inc\Shared\Tracing.h" target="inc"/>
66
+ <file src="$nugetroot$\inc\Shared\JSI\JSExecutorFactoryDelegate.h" target="inc\JSI"/>
65
67
 
66
68
  <!-- Test DLL -->
67
69
  <file src="$nugetroot$\inc\Test\WebSocketServer.h" target="inc\Test" />
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-windows",
3
- "version": "0.74.0-preview.4",
3
+ "version": "0.74.1",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -26,15 +26,15 @@
26
26
  "@react-native-community/cli": "13.6.4",
27
27
  "@react-native-community/cli-platform-android": "13.6.4",
28
28
  "@react-native-community/cli-platform-ios": "13.6.4",
29
- "@react-native-windows/cli": "0.74.0-preview.2",
29
+ "@react-native-windows/cli": "0.74.0",
30
30
  "@react-native/assets": "1.0.0",
31
- "@react-native/assets-registry": "0.74.80",
32
- "@react-native/codegen": "0.74.80",
33
- "@react-native/community-cli-plugin": "0.74.80",
34
- "@react-native/gradle-plugin": "0.74.80",
35
- "@react-native/js-polyfills": "0.74.80",
36
- "@react-native/normalize-colors": "0.74.80",
37
- "@react-native/virtualized-lists": "0.74.80",
31
+ "@react-native/assets-registry": "0.74.81",
32
+ "@react-native/codegen": "0.74.81",
33
+ "@react-native/community-cli-plugin": "0.74.81",
34
+ "@react-native/gradle-plugin": "0.74.81",
35
+ "@react-native/js-polyfills": "0.74.81",
36
+ "@react-native/normalize-colors": "0.74.81",
37
+ "@react-native/virtualized-lists": "0.74.81",
38
38
  "abort-controller": "^3.0.0",
39
39
  "anser": "^1.4.9",
40
40
  "ansi-regex": "^5.0.0",
@@ -64,8 +64,8 @@
64
64
  "yargs": "^17.6.2"
65
65
  },
66
66
  "devDependencies": {
67
- "@react-native-windows/codegen": "0.74.0-preview.1",
68
- "@react-native/metro-config": "0.74.80",
67
+ "@react-native-windows/codegen": "0.74.0",
68
+ "@react-native/metro-config": "0.74.81",
69
69
  "@rnw-scripts/babel-react-native-config": "0.0.0",
70
70
  "@rnw-scripts/eslint-config": "1.2.9",
71
71
  "@rnw-scripts/jest-out-of-tree-snapshot-resolver": "^1.1.13",
@@ -81,7 +81,7 @@
81
81
  "just-scripts": "^1.3.3",
82
82
  "prettier": "2.8.8",
83
83
  "react": "18.2.0",
84
- "react-native": "0.74.0-rc.9",
84
+ "react-native": "0.74.0",
85
85
  "react-native-platform-override": "^1.9.25",
86
86
  "react-refresh": "^0.14.0",
87
87
  "typescript": "5.0.4"
@@ -89,14 +89,17 @@
89
89
  "peerDependencies": {
90
90
  "@types/react": "^18.2.6",
91
91
  "react": "18.2.0",
92
- "react-native": "0.74.0-rc.9"
92
+ "react-native": "^0.74.0"
93
93
  },
94
94
  "beachball": {
95
- "defaultNpmTag": "preview",
95
+ "defaultNpmTag": "latest",
96
96
  "disallowedChangeTypes": [
97
97
  "major",
98
98
  "minor",
99
- "patch"
99
+ "prerelease",
100
+ "premajor",
101
+ "preminor",
102
+ "prepatch"
100
103
  ],
101
104
  "gitTags": true
102
105
  },