react-native-windows 0.74.1 → 0.74.3

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 (32) hide show
  1. package/Libraries/Components/Touchable/TouchableBounce.js +1 -0
  2. package/Libraries/Components/Touchable/TouchableOpacity.js +1 -0
  3. package/Libraries/Components/Touchable/TouchableOpacity.windows.js +1 -0
  4. package/Libraries/Core/ReactNativeVersion.js +1 -1
  5. package/Microsoft.ReactNative/Fabric/Composition/CompositionContextHelper.cpp +6 -0
  6. package/Microsoft.ReactNative/Fabric/Composition/CompositionContextHelper.h +2 -0
  7. package/Microsoft.ReactNative/Fabric/Composition/ImageComponentView.cpp +26 -13
  8. package/Microsoft.ReactNative/Fabric/Composition/ImageComponentView.h +3 -2
  9. package/Microsoft.ReactNative/Fabric/Composition/ImageResponseImage.h +17 -0
  10. package/Microsoft.ReactNative/Fabric/Composition/UriImageManager.cpp +230 -0
  11. package/Microsoft.ReactNative/Fabric/Composition/UriImageManager.h +36 -0
  12. package/Microsoft.ReactNative/Fabric/FabricUIManagerModule.cpp +3 -0
  13. package/Microsoft.ReactNative/Fabric/FabricUIManagerModule.h +2 -0
  14. package/Microsoft.ReactNative/Fabric/ImageManager.cpp +3 -2
  15. package/Microsoft.ReactNative/Fabric/WindowsImageManager.cpp +102 -35
  16. package/Microsoft.ReactNative/Fabric/WindowsImageManager.h +6 -1
  17. package/Microsoft.ReactNative/IReactPackageBuilderFabric.idl +5 -0
  18. package/Microsoft.ReactNative/ReactHost/React.h +7 -0
  19. package/Microsoft.ReactNative/ReactHost/ReactInstanceWin.cpp +7 -0
  20. package/Microsoft.ReactNative/ReactNativeHost.cpp +8 -0
  21. package/Microsoft.ReactNative/ReactPackageBuilder.cpp +8 -0
  22. package/Microsoft.ReactNative/ReactPackageBuilder.h +6 -0
  23. package/Microsoft.ReactNative/UriImageManager.idl +75 -0
  24. package/Microsoft.ReactNative.Cxx/AutoDraw.h +1 -0
  25. package/PropertySheets/Generated/PackageVersion.g.props +3 -3
  26. package/Shared/Shared.vcxitems +6 -0
  27. package/codegen/NativeReactNativeFeatureFlagsSpec.g.h +33 -21
  28. package/codegen/rnwcoreJSI-generated.cpp +18 -6
  29. package/codegen/rnwcoreJSI.h +27 -9
  30. package/package.json +13 -13
  31. package/src/private/featureflags/NativeReactNativeFeatureFlags.js +4 -2
  32. package/src/private/featureflags/ReactNativeFeatureFlags.js +16 -6
@@ -5,7 +5,11 @@
5
5
 
6
6
  #include "WindowsImageManager.h"
7
7
 
8
+ #include <Fabric/Composition/CompositionContextHelper.h>
9
+ #include <Fabric/Composition/ImageResponseImage.h>
10
+ #include <Fabric/Composition/UriImageManager.h>
8
11
  #include <Utils/ImageUtils.h>
12
+ #include <functional/functor.h>
9
13
  #include <shcore.h>
10
14
  #include <wincodec.h>
11
15
 
@@ -13,7 +17,11 @@ extern "C" HRESULT WINAPI WICCreateImagingFactory_Proxy(UINT SDKVersion, IWICIma
13
17
 
14
18
  namespace Microsoft::ReactNative {
15
19
 
16
- WindowsImageManager::WindowsImageManager() {}
20
+ WindowsImageManager::WindowsImageManager(winrt::Microsoft::ReactNative::ReactContext reactContext)
21
+ : m_reactContext(reactContext) {
22
+ m_uriImageManager =
23
+ winrt::Microsoft::ReactNative::Composition::implementation::UriImageManager::Get(reactContext.Properties());
24
+ }
17
25
 
18
26
  winrt::com_ptr<IWICBitmapSource> wicBitmapSourceFromStream(
19
27
  const winrt::Windows::Storage::Streams::IRandomAccessStream &results) noexcept {
@@ -39,19 +47,12 @@ winrt::com_ptr<IWICBitmapSource> wicBitmapSourceFromStream(
39
47
  return decodedFrame;
40
48
  }
41
49
 
42
- void generateBitmap(
43
- std::weak_ptr<const facebook::react::ImageResponseObserverCoordinator> weakObserverCoordinator,
50
+ std::shared_ptr<winrt::Microsoft::ReactNative::Composition::implementation::ImageResponseImage> generateBitmap(
44
51
  const winrt::Windows::Storage::Streams::IRandomAccessStream &results) noexcept {
45
- auto observerCoordinator = weakObserverCoordinator.lock();
46
- if (!observerCoordinator) {
47
- return;
48
- }
49
-
50
52
  winrt::com_ptr<IWICBitmapSource> decodedFrame = wicBitmapSourceFromStream(results);
51
53
 
52
54
  if (!decodedFrame) {
53
- observerCoordinator->nativeImageResponseFailed();
54
- return;
55
+ return nullptr;
55
56
  }
56
57
 
57
58
  winrt::com_ptr<IWICImagingFactory> imagingFactory;
@@ -70,32 +71,18 @@ void generateBitmap(
70
71
  winrt::com_ptr<IWICBitmap> wicbmp;
71
72
  winrt::check_hresult(imagingFactory->CreateBitmapFromSource(converter.get(), WICBitmapCacheOnLoad, wicbmp.put()));
72
73
 
73
- // ImageResponse saves a shared_ptr<void> for its data, so we need to wrap the com_ptr in a shared_ptr...
74
- auto sharedwicbmp = std::make_shared<winrt::com_ptr<IWICBitmap>>(wicbmp);
75
-
76
- observerCoordinator->nativeImageResponseComplete(facebook::react::ImageResponse(sharedwicbmp, nullptr /*metadata*/));
74
+ auto image = std::make_shared<winrt::Microsoft::ReactNative::Composition::implementation::ImageResponseImage>();
75
+ image->m_wicbmp = wicbmp;
76
+ return image;
77
77
  }
78
78
 
79
- facebook::react::ImageRequest WindowsImageManager::requestImage(
80
- const facebook::react::ImageSource &imageSource,
81
- facebook::react::SurfaceId surfaceId) const {
82
- auto imageRequest = facebook::react::ImageRequest(imageSource, nullptr, {});
83
-
84
- auto weakObserverCoordinator = (std::weak_ptr<const facebook::react::ImageResponseObserverCoordinator>)
85
- imageRequest.getSharedObserverCoordinator();
86
-
87
- ReactImageSource source;
88
- source.uri = imageSource.uri;
89
- source.height = imageSource.size.height;
90
- source.width = imageSource.size.width;
91
- source.sourceType = ImageSourceType::Download;
92
-
93
- auto task = GetImageStreamAsync(source);
94
-
95
- // TODO progress? - Can we register for progress off the download task?
96
- // observerCoordinator->nativeImageResponseProgress((float)progress / (float)total);
97
-
98
- task.Completed([weakObserverCoordinator](auto asyncOp, auto status) {
79
+ template <typename T>
80
+ void ProcessImageRequestTask(
81
+ std::weak_ptr<const facebook::react::ImageResponseObserverCoordinator> &weakObserverCoordinator,
82
+ const winrt::Windows::Foundation::IAsyncOperation<T> &task,
83
+ Mso::Functor<std::shared_ptr<winrt::Microsoft::ReactNative::Composition::implementation::ImageResponseImage>(
84
+ const T &result)> &&onSuccess) {
85
+ task.Completed([weakObserverCoordinator, onSuccess = std::move(onSuccess)](auto asyncOp, auto status) {
99
86
  auto observerCoordinator = weakObserverCoordinator.lock();
100
87
  if (!observerCoordinator) {
101
88
  return;
@@ -103,7 +90,12 @@ facebook::react::ImageRequest WindowsImageManager::requestImage(
103
90
 
104
91
  switch (status) {
105
92
  case winrt::Windows::Foundation::AsyncStatus::Completed: {
106
- generateBitmap(weakObserverCoordinator, asyncOp.GetResults());
93
+ auto imageResponseImage = onSuccess(asyncOp.GetResults());
94
+ if (imageResponseImage)
95
+ observerCoordinator->nativeImageResponseComplete(
96
+ facebook::react::ImageResponse(imageResponseImage, nullptr /*metadata*/));
97
+ else
98
+ observerCoordinator->nativeImageResponseFailed();
107
99
  break;
108
100
  }
109
101
  case winrt::Windows::Foundation::AsyncStatus::Canceled: {
@@ -118,6 +110,81 @@ facebook::react::ImageRequest WindowsImageManager::requestImage(
118
110
  }
119
111
  }
120
112
  });
113
+ }
114
+
115
+ facebook::react::ImageRequest WindowsImageManager::requestImage(
116
+ const facebook::react::ImageSource &imageSource,
117
+ facebook::react::SurfaceId surfaceId) const {
118
+ auto imageRequest = facebook::react::ImageRequest(imageSource, nullptr, {});
119
+
120
+ auto weakObserverCoordinator = (std::weak_ptr<const facebook::react::ImageResponseObserverCoordinator>)
121
+ imageRequest.getSharedObserverCoordinator();
122
+
123
+ auto rnImageSource = winrt::Microsoft::ReactNative::Composition::implementation::MakeImageSource(imageSource);
124
+ auto provider = m_uriImageManager->TryGetUriImageProvider(m_reactContext.Handle(), rnImageSource);
125
+
126
+ if (auto bProvider = provider.try_as<winrt::Microsoft::ReactNative::Composition::IUriBrushProvider>()) {
127
+ ProcessImageRequestTask<winrt::Microsoft::ReactNative::Composition::UriBrushFactory>(
128
+ weakObserverCoordinator,
129
+ bProvider.GetSourceAsync(m_reactContext.Handle(), rnImageSource),
130
+ [](const winrt::Microsoft::ReactNative::Composition::UriBrushFactory &factory) noexcept {
131
+ auto image =
132
+ std::make_shared<winrt::Microsoft::ReactNative::Composition::implementation::ImageResponseImage>();
133
+
134
+ // Wrap the UriBrushFactory to provide the internal CompositionContext types
135
+ image->m_brushFactory =
136
+ [factory](
137
+ const winrt::Microsoft::ReactNative::IReactContext &context,
138
+ const winrt::Microsoft::ReactNative::Composition::Experimental::ICompositionContext
139
+ &compositionContext) {
140
+ auto compositor = winrt::Microsoft::ReactNative::Composition::Experimental::
141
+ MicrosoftCompositionContextHelper::InnerCompositor(compositionContext);
142
+ auto brush = factory(context, compositor);
143
+ return winrt::Microsoft::ReactNative::Composition::Experimental::implementation::
144
+ MicrosoftCompositionContextHelper::WrapBrush(brush);
145
+ };
146
+ return image;
147
+ });
148
+
149
+ return imageRequest;
150
+ }
151
+
152
+ if (auto brushProvider =
153
+ provider.try_as<winrt::Microsoft::ReactNative::Composition::Experimental::IUriBrushProvider>()) {
154
+ ProcessImageRequestTask<winrt::Microsoft::ReactNative::Composition::Experimental::UriBrushFactory>(
155
+ weakObserverCoordinator,
156
+ brushProvider.GetSourceAsync(m_reactContext.Handle(), rnImageSource),
157
+ [](const winrt::Microsoft::ReactNative::Composition::Experimental::UriBrushFactory &factory) noexcept {
158
+ auto image =
159
+ std::make_shared<winrt::Microsoft::ReactNative::Composition::implementation::ImageResponseImage>();
160
+ image->m_brushFactory = factory;
161
+ return image;
162
+ });
163
+
164
+ return imageRequest;
165
+ };
166
+
167
+ winrt::Windows::Foundation::IAsyncOperation<winrt::Windows::Storage::Streams::IRandomAccessStream> task;
168
+ if (auto imageStreamProvider =
169
+ provider.try_as<winrt::Microsoft::ReactNative::Composition::IUriImageStreamProvider>()) {
170
+ task = imageStreamProvider.GetSourceAsync(m_reactContext.Handle(), rnImageSource);
171
+ } else {
172
+ ReactImageSource source;
173
+ source.uri = imageSource.uri;
174
+ source.height = imageSource.size.height;
175
+ source.width = imageSource.size.width;
176
+ source.sourceType = ImageSourceType::Download;
177
+
178
+ task = GetImageStreamAsync(source);
179
+ }
180
+
181
+ // TODO progress? - Can we register for progress off the download task?
182
+ // observerCoordinator->nativeImageResponseProgress((float)progress / (float)total);
183
+
184
+ ProcessImageRequestTask<winrt::Windows::Storage::Streams::IRandomAccessStream>(
185
+ weakObserverCoordinator, task, [](const winrt::Windows::Storage::Streams::IRandomAccessStream &stream) {
186
+ return generateBitmap(stream);
187
+ });
121
188
 
122
189
  return imageRequest;
123
190
  }
@@ -5,16 +5,21 @@
5
5
 
6
6
  #include <react/renderer/imagemanager/ImageRequest.h>
7
7
 
8
+ #include <Fabric/Composition/UriImageManager.h>
8
9
  #include <ReactContext.h>
9
10
 
10
11
  namespace Microsoft::ReactNative {
11
12
 
12
13
  struct WindowsImageManager {
13
- WindowsImageManager();
14
+ WindowsImageManager(winrt::Microsoft::ReactNative::ReactContext reactContext);
14
15
 
15
16
  facebook::react::ImageRequest requestImage(
16
17
  const facebook::react::ImageSource &imageSource,
17
18
  facebook::react::SurfaceId surfaceId) const;
19
+
20
+ private:
21
+ winrt::Microsoft::ReactNative::ReactContext m_reactContext;
22
+ std::shared_ptr<winrt::Microsoft::ReactNative::Composition::implementation::UriImageManager> m_uriImageManager;
18
23
  };
19
24
 
20
25
  } // namespace Microsoft::ReactNative
@@ -2,6 +2,7 @@
2
2
  // Licensed under the MIT License.
3
3
 
4
4
  import "IReactViewComponentBuilder.idl";
5
+ import "UriImageManager.idl";
5
6
 
6
7
  #include "DocString.h"
7
8
 
@@ -18,6 +19,10 @@ namespace Microsoft.ReactNative
18
19
  {
19
20
  DOC_STRING("Registers a custom native view component.")
20
21
  void AddViewComponent(String componentName, ReactViewComponentProvider componentProvider);
22
+
23
+ DOC_STRING(
24
+ "Ability to load images using custom Uri protocol handlers. The provider should implement @Composition.IUriImageStreamProvider or @Composition.Experimental.IUriBrushProvider.")
25
+ void AddUriImageProvider(Microsoft.ReactNative.Composition.IUriImageProvider provider);
21
26
  };
22
27
 
23
28
  } // namespace Microsoft.ReactNative
@@ -32,6 +32,10 @@
32
32
  #include <ViewManagerProvider.h>
33
33
  #include <winrt/Microsoft.ReactNative.h>
34
34
 
35
+ #ifdef USE_FABRIC
36
+ #include <Fabric/Composition/UriImageManager.h>
37
+ #endif
38
+
35
39
  namespace Mso::React {
36
40
 
37
41
  // Forward declarations
@@ -182,6 +186,9 @@ struct ReactOptions {
182
186
  std::shared_ptr<NativeModuleProvider2> ModuleProvider;
183
187
  std::shared_ptr<ViewManagerProvider2> ViewManagerProvider;
184
188
  std::shared_ptr<winrt::Microsoft::ReactNative::TurboModulesProvider> TurboModuleProvider;
189
+ #ifdef USE_FABRIC
190
+ std::shared_ptr<winrt::Microsoft::ReactNative::Composition::implementation::UriImageManager> UriImageManager;
191
+ #endif
185
192
 
186
193
  //! Identity of the SDX. Must uniquely describe the SDX across the installed product.
187
194
  std::string Identity;
@@ -52,6 +52,7 @@
52
52
  #include "Unicode.h"
53
53
 
54
54
  #ifdef USE_FABRIC
55
+ #include <Fabric/Composition/UriImageManager.h>
55
56
  #include <Fabric/FabricUIManagerModule.h>
56
57
  #include <Fabric/ReactNativeConfigProperties.h>
57
58
  #include <Fabric/WindowsComponentDescriptorRegistry.h>
@@ -570,6 +571,8 @@ void ReactInstanceWin::InitializeBridgeless() noexcept {
570
571
  });
571
572
 
572
573
  InitDevMenu();
574
+ winrt::Microsoft::ReactNative::Composition::implementation::UriImageManager::Install(
575
+ ReactPropertyBag(m_reactContext->Properties()), m_options.UriImageManager);
573
576
 
574
577
  m_uiQueue->Post([this, weakThis = Mso::WeakPtr{this}]() noexcept {
575
578
  // Objects that must be created on the UI thread
@@ -726,6 +729,10 @@ void ReactInstanceWin::InitializeWithBridge() noexcept {
726
729
  #endif
727
730
 
728
731
  InitDevMenu();
732
+ #ifdef USE_FABRIC
733
+ winrt::Microsoft::ReactNative::Composition::implementation::UriImageManager::Install(
734
+ ReactPropertyBag(m_reactContext->Properties()), m_options.UriImageManager);
735
+ #endif
729
736
 
730
737
  m_uiQueue->Post([this, weakThis = Mso::WeakPtr{this}]() noexcept {
731
738
  // Objects that must be created on the UI thread
@@ -16,6 +16,7 @@
16
16
 
17
17
  #ifdef USE_FABRIC
18
18
  #include <Fabric/WindowsComponentDescriptorRegistry.h>
19
+ #include <ReactPackageBuilder.h>
19
20
  #include <react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h>
20
21
  #endif
21
22
 
@@ -93,6 +94,8 @@ IAsyncAction ReactNativeHost::ReloadInstance() noexcept {
93
94
  auto turboModulesProvider = std::make_shared<TurboModulesProvider>();
94
95
 
95
96
  #ifdef USE_FABRIC
97
+ auto uriImageManager =
98
+ std::make_shared<winrt::Microsoft::ReactNative::Composition::implementation::UriImageManager>();
96
99
  auto componentregistry = std::make_shared<::Microsoft::ReactNative::WindowsComponentDescriptorRegistry>();
97
100
  auto componentDescriptorRegistry = std::make_shared<facebook::react::ComponentDescriptorProviderRegistry>();
98
101
 
@@ -108,6 +111,7 @@ IAsyncAction ReactNativeHost::ReloadInstance() noexcept {
108
111
  turboModulesProvider,
109
112
  #ifdef USE_FABRIC
110
113
  componentregistry,
114
+ uriImageManager,
111
115
  #endif
112
116
  m_instanceSettings.UseWebDebugger());
113
117
 
@@ -164,6 +168,10 @@ IAsyncAction ReactNativeHost::ReloadInstance() noexcept {
164
168
  #endif
165
169
  reactOptions.TurboModuleProvider = turboModulesProvider;
166
170
 
171
+ #ifdef USE_FABRIC
172
+ reactOptions.UriImageManager = uriImageManager;
173
+ #endif
174
+
167
175
  reactOptions.OnInstanceCreated = [](Mso::CntPtr<Mso::React::IReactContext> &&context) {
168
176
  auto notifications = context->Notifications();
169
177
  ReactInstanceSettings::RaiseInstanceCreated(
@@ -22,6 +22,7 @@ ReactPackageBuilder::ReactPackageBuilder(
22
22
  std::shared_ptr<TurboModulesProvider> const &turboModulesProvider,
23
23
  #ifdef USE_FABRIC
24
24
  std::shared_ptr<::Microsoft::ReactNative::WindowsComponentDescriptorRegistry> const &componentRegistry,
25
+ std::shared_ptr<winrt::Microsoft::ReactNative::Composition::implementation::UriImageManager> const &uriImageManager,
25
26
  #endif
26
27
  bool isWebDebugging) noexcept
27
28
  : m_modulesProvider{modulesProvider},
@@ -31,6 +32,7 @@ ReactPackageBuilder::ReactPackageBuilder(
31
32
  m_turboModulesProvider{turboModulesProvider},
32
33
  #ifdef USE_FABRIC
33
34
  m_componentRegistry{componentRegistry},
35
+ m_uriImageManager{uriImageManager},
34
36
  #endif
35
37
 
36
38
  m_isWebDebugging{isWebDebugging} {
@@ -63,5 +65,11 @@ void ReactPackageBuilder::AddViewComponent(
63
65
  ReactViewComponentProvider const &viewComponentProvider) noexcept {
64
66
  m_componentRegistry->Add(componentName, viewComponentProvider);
65
67
  }
68
+
69
+ void ReactPackageBuilder::AddUriImageProvider(
70
+ const winrt::Microsoft::ReactNative::Composition::IUriImageProvider &provider) noexcept {
71
+ m_uriImageManager->AddUriImageProvider(provider);
72
+ }
73
+
66
74
  #endif
67
75
  } // namespace winrt::Microsoft::ReactNative
@@ -9,7 +9,9 @@
9
9
  #endif
10
10
  #include "winrt/Microsoft.ReactNative.h"
11
11
  #ifdef USE_FABRIC
12
+ #include <Fabric/Composition/UriImageManager.h>
12
13
  #include <Fabric/WindowsComponentDescriptorRegistry.h>
14
+ #include "winrt/Microsoft.ReactNative.Composition.h"
13
15
  #endif
14
16
 
15
17
  namespace winrt::Microsoft::ReactNative {
@@ -30,6 +32,8 @@ struct ReactPackageBuilder : winrt::implements<
30
32
  std::shared_ptr<TurboModulesProvider> const &turboModulesProvider,
31
33
  #ifdef USE_FABRIC
32
34
  std::shared_ptr<::Microsoft::ReactNative::WindowsComponentDescriptorRegistry> const &componentRegistry,
35
+ std::shared_ptr<winrt::Microsoft::ReactNative::Composition::implementation::UriImageManager> const
36
+ &uriImageManager,
33
37
  #endif
34
38
  bool isWebDebugging) noexcept;
35
39
 
@@ -43,6 +47,7 @@ struct ReactPackageBuilder : winrt::implements<
43
47
  #ifdef USE_FABRIC
44
48
  // IReactPackageBuilderFabric
45
49
  void AddViewComponent(winrt::hstring componentName, ReactViewComponentProvider const &viewComponentProvider) noexcept;
50
+ void AddUriImageProvider(const winrt::Microsoft::ReactNative::Composition::IUriImageProvider &provider) noexcept;
46
51
  #endif // USE_FABRIC
47
52
 
48
53
  private:
@@ -54,6 +59,7 @@ struct ReactPackageBuilder : winrt::implements<
54
59
 
55
60
  #ifdef USE_FABRIC
56
61
  std::shared_ptr<::Microsoft::ReactNative::WindowsComponentDescriptorRegistry> m_componentRegistry;
62
+ std::shared_ptr<winrt::Microsoft::ReactNative::Composition::implementation::UriImageManager> m_uriImageManager;
57
63
  #endif
58
64
 
59
65
  const bool m_isWebDebugging;
@@ -0,0 +1,75 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT License.
3
+
4
+ import "IReactContext.idl";
5
+ import "CompositionSwitcher.idl";
6
+
7
+ #include "DocString.h"
8
+
9
+ namespace Microsoft.ReactNative.Composition
10
+ {
11
+ [default_interface]
12
+ [webhosthidden]
13
+ [experimental]
14
+ DOC_STRING(
15
+ "Provides information about an image source requested by the application.")
16
+ runtimeclass ImageSource
17
+ {
18
+ Windows.Foundation.Uri Uri { get; };
19
+ Windows.Foundation.Size Size { get; };
20
+ Single Scale { get; };
21
+ };
22
+
23
+
24
+ [webhosthidden]
25
+ [experimental]
26
+ interface IUriImageProvider
27
+ {
28
+ DOC_STRING(
29
+ "This should return true if this provider will provide an image for the provided uri.")
30
+ Boolean CanLoadImageUri(Microsoft.ReactNative.IReactContext context, Windows.Foundation.Uri uri);
31
+ }
32
+
33
+ [webhosthidden]
34
+ [experimental]
35
+ DOC_STRING(
36
+ "This allows applications to provide their own image caching / storage pipelines. Or to generate images on the fly based on uri.")
37
+ interface IUriImageStreamProvider requires IUriImageProvider
38
+ {
39
+ DOC_STRING(
40
+ "Returns a stream of an image file that can be decoded by Windows Imaging Component - https://learn.microsoft.com/en-us/windows/win32/api/_wic/ ")
41
+ Windows.Foundation.IAsyncOperation<Windows.Storage.Streams.IRandomAccessStream> GetSourceAsync(Microsoft.ReactNative.IReactContext context, ImageSource imageSource);
42
+ }
43
+
44
+
45
+ [webhosthidden]
46
+ [experimental]
47
+ delegate Microsoft.UI.Composition.CompositionBrush UriBrushFactory(Microsoft.ReactNative.IReactContext reactContext, Microsoft.UI.Composition.Compositor compositor);
48
+
49
+ [webhosthidden]
50
+ [experimental]
51
+ DOC_STRING(
52
+ "This allows applications to provide their own image rendering pipeline. Or to generate graphics on the fly based on uri.")
53
+ interface IUriBrushProvider requires IUriImageProvider
54
+ {
55
+ DOC_STRING(
56
+ "This allows applications to provide their own image rendering pipeline. Or to generate graphics on the fly based on uri.")
57
+ Windows.Foundation.IAsyncOperation<UriBrushFactory> GetSourceAsync(Microsoft.ReactNative.IReactContext context, Microsoft.ReactNative.Composition.ImageSource imageSource);
58
+ }
59
+
60
+ namespace Experimental {
61
+
62
+ [webhosthidden]
63
+ [experimental]
64
+ delegate Microsoft.ReactNative.Composition.Experimental.IBrush UriBrushFactory(Microsoft.ReactNative.IReactContext reactContext, Microsoft.ReactNative.Composition.Experimental.ICompositionContext compositionContext);
65
+
66
+ [webhosthidden]
67
+ [experimental]
68
+ DOC_STRING(
69
+ "This allows applications to provide their own image rendering pipeline. Or to generate graphics on the fly based on uri.")
70
+ interface IUriBrushProvider requires Microsoft.ReactNative.Composition.IUriImageProvider
71
+ {
72
+ Windows.Foundation.IAsyncOperation<UriBrushFactory> GetSourceAsync(Microsoft.ReactNative.IReactContext context, Microsoft.ReactNative.Composition.ImageSource imageSource);
73
+ }
74
+ }
75
+ } // namespace Microsoft.ReactNative.Composition
@@ -1,6 +1,7 @@
1
1
  // Copyright (c) Microsoft Corporation.
2
2
  // Licensed under the MIT License.
3
3
 
4
+ #include <winrt/Microsoft.ReactNative.Composition.Experimental.h>
4
5
  #include <winrt/Microsoft.ReactNative.Composition.h>
5
6
 
6
7
  #include <CompositionSwitcher.Experimental.interop.h>
@@ -10,11 +10,11 @@
10
10
  -->
11
11
  <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
12
12
  <PropertyGroup>
13
- <ReactNativeWindowsVersion>0.74.1</ReactNativeWindowsVersion>
13
+ <ReactNativeWindowsVersion>0.74.3</ReactNativeWindowsVersion>
14
14
  <ReactNativeWindowsMajor>0</ReactNativeWindowsMajor>
15
15
  <ReactNativeWindowsMinor>74</ReactNativeWindowsMinor>
16
- <ReactNativeWindowsPatch>1</ReactNativeWindowsPatch>
16
+ <ReactNativeWindowsPatch>3</ReactNativeWindowsPatch>
17
17
  <ReactNativeWindowsCanary>false</ReactNativeWindowsCanary>
18
- <ReactNativeWindowsCommitId>7fd1f4439e2e1f109d4d2b20a97073f14bcbf504</ReactNativeWindowsCommitId>
18
+ <ReactNativeWindowsCommitId>6e935c2cf39436706361e0e612454fafe20f6d66</ReactNativeWindowsCommitId>
19
19
  </PropertyGroup>
20
20
  </Project>
@@ -84,6 +84,11 @@
84
84
  <DependentUpon>$(ReactNativeWindowsDir)Microsoft.ReactNative\CompositionUIService.idl</DependentUpon>
85
85
  <SubType>Code</SubType>
86
86
  </ClCompile>
87
+ <ClCompile Include="$(MSBuildThisFileDirectory)..\Microsoft.ReactNative\Fabric\Composition\UriImageManager.cpp">
88
+ <ExcludedFromBuild Condition="'$(UseFabric)' != 'true'">true</ExcludedFromBuild>
89
+ <DependentUpon>$(ReactNativeWindowsDir)Microsoft.ReactNative\UriImageManager.idl</DependentUpon>
90
+ <SubType>Code</SubType>
91
+ </ClCompile>
87
92
  <ClCompile Include="$(MSBuildThisFileDirectory)..\Microsoft.ReactNative\Fabric\Composition\CompositionViewComponentView.cpp">
88
93
  <ExcludedFromBuild Condition="'$(UseFabric)' != 'true'">true</ExcludedFromBuild>
89
94
  </ClCompile>
@@ -639,6 +644,7 @@
639
644
  <Midl Condition="'$(UseFabric)' == 'true' OR '$(IncludeFabricInterface)' == 'true'" Include="$(ReactNativeWindowsDir)Microsoft.ReactNative\IReactPackageBuilderFabric.idl" />
640
645
  <Midl Condition="'$(UseFabric)' == 'true' OR '$(IncludeFabricInterface)' == 'true'" Include="$(ReactNativeWindowsDir)Microsoft.ReactNative\IReactViewComponentBuilder.idl" />
641
646
  <Midl Condition="'$(UseFabric)' == 'true' OR '$(IncludeFabricInterface)' == 'true'" Include="$(ReactNativeWindowsDir)Microsoft.ReactNative\Theme.idl" />
647
+ <Midl Condition="'$(UseFabric)' == 'true' OR '$(IncludeFabricInterface)' == 'true'" Include="$(ReactNativeWindowsDir)Microsoft.ReactNative\UriImageManager.idl" />
642
648
  <Midl Condition="'$(UseFabric)' == 'true' OR '$(IncludeFabricInterface)' == 'true'" Include="$(ReactNativeWindowsDir)Microsoft.ReactNative\ViewProps.idl" />
643
649
  </ItemGroup>
644
650
  <ItemGroup>
@@ -17,15 +17,17 @@ namespace Microsoft::ReactNativeSpecs {
17
17
  struct ReactNativeFeatureFlagsSpec : winrt::Microsoft::ReactNative::TurboModuleSpec {
18
18
  static constexpr auto methods = std::tuple{
19
19
  SyncMethod<bool() noexcept>{0, L"commonTestFlag"},
20
- SyncMethod<bool() noexcept>{1, L"enableBackgroundExecutor"},
21
- SyncMethod<bool() noexcept>{2, L"useModernRuntimeScheduler"},
22
- SyncMethod<bool() noexcept>{3, L"enableMicrotasks"},
23
- SyncMethod<bool() noexcept>{4, L"batchRenderingUpdatesInEventLoop"},
24
- SyncMethod<bool() noexcept>{5, L"enableSpannableBuildingUnification"},
25
- SyncMethod<bool() noexcept>{6, L"enableCustomDrawOrderFabric"},
26
- SyncMethod<bool() noexcept>{7, L"enableFixForClippedSubviewsCrash"},
27
- SyncMethod<bool() noexcept>{8, L"inspectorEnableCxxInspectorPackagerConnection"},
28
- SyncMethod<bool() noexcept>{9, L"inspectorEnableModernCDPRegistry"},
20
+ SyncMethod<bool() noexcept>{1, L"androidEnablePendingFabricTransactions"},
21
+ SyncMethod<bool() noexcept>{2, L"batchRenderingUpdatesInEventLoop"},
22
+ SyncMethod<bool() noexcept>{3, L"destroyFabricSurfacesInReactInstanceManager"},
23
+ SyncMethod<bool() noexcept>{4, L"enableBackgroundExecutor"},
24
+ SyncMethod<bool() noexcept>{5, L"useModernRuntimeScheduler"},
25
+ SyncMethod<bool() noexcept>{6, L"enableMicrotasks"},
26
+ SyncMethod<bool() noexcept>{7, L"enableSpannableBuildingUnification"},
27
+ SyncMethod<bool() noexcept>{8, L"enableCustomDrawOrderFabric"},
28
+ SyncMethod<bool() noexcept>{9, L"enableFixForClippedSubviewsCrash"},
29
+ SyncMethod<bool() noexcept>{10, L"inspectorEnableCxxInspectorPackagerConnection"},
30
+ SyncMethod<bool() noexcept>{11, L"inspectorEnableModernCDPRegistry"},
29
31
  };
30
32
 
31
33
  template <class TModule>
@@ -39,46 +41,56 @@ struct ReactNativeFeatureFlagsSpec : winrt::Microsoft::ReactNative::TurboModuleS
39
41
  " REACT_SYNC_METHOD(commonTestFlag) static bool commonTestFlag() noexcept { /* implementation */ }\n");
40
42
  REACT_SHOW_METHOD_SPEC_ERRORS(
41
43
  1,
44
+ "androidEnablePendingFabricTransactions",
45
+ " REACT_SYNC_METHOD(androidEnablePendingFabricTransactions) bool androidEnablePendingFabricTransactions() noexcept { /* implementation */ }\n"
46
+ " REACT_SYNC_METHOD(androidEnablePendingFabricTransactions) static bool androidEnablePendingFabricTransactions() noexcept { /* implementation */ }\n");
47
+ REACT_SHOW_METHOD_SPEC_ERRORS(
48
+ 2,
49
+ "batchRenderingUpdatesInEventLoop",
50
+ " REACT_SYNC_METHOD(batchRenderingUpdatesInEventLoop) bool batchRenderingUpdatesInEventLoop() noexcept { /* implementation */ }\n"
51
+ " REACT_SYNC_METHOD(batchRenderingUpdatesInEventLoop) static bool batchRenderingUpdatesInEventLoop() noexcept { /* implementation */ }\n");
52
+ REACT_SHOW_METHOD_SPEC_ERRORS(
53
+ 3,
54
+ "destroyFabricSurfacesInReactInstanceManager",
55
+ " REACT_SYNC_METHOD(destroyFabricSurfacesInReactInstanceManager) bool destroyFabricSurfacesInReactInstanceManager() noexcept { /* implementation */ }\n"
56
+ " REACT_SYNC_METHOD(destroyFabricSurfacesInReactInstanceManager) static bool destroyFabricSurfacesInReactInstanceManager() noexcept { /* implementation */ }\n");
57
+ REACT_SHOW_METHOD_SPEC_ERRORS(
58
+ 4,
42
59
  "enableBackgroundExecutor",
43
60
  " REACT_SYNC_METHOD(enableBackgroundExecutor) bool enableBackgroundExecutor() noexcept { /* implementation */ }\n"
44
61
  " REACT_SYNC_METHOD(enableBackgroundExecutor) static bool enableBackgroundExecutor() noexcept { /* implementation */ }\n");
45
62
  REACT_SHOW_METHOD_SPEC_ERRORS(
46
- 2,
63
+ 5,
47
64
  "useModernRuntimeScheduler",
48
65
  " REACT_SYNC_METHOD(useModernRuntimeScheduler) bool useModernRuntimeScheduler() noexcept { /* implementation */ }\n"
49
66
  " REACT_SYNC_METHOD(useModernRuntimeScheduler) static bool useModernRuntimeScheduler() noexcept { /* implementation */ }\n");
50
67
  REACT_SHOW_METHOD_SPEC_ERRORS(
51
- 3,
68
+ 6,
52
69
  "enableMicrotasks",
53
70
  " REACT_SYNC_METHOD(enableMicrotasks) bool enableMicrotasks() noexcept { /* implementation */ }\n"
54
71
  " REACT_SYNC_METHOD(enableMicrotasks) static bool enableMicrotasks() noexcept { /* implementation */ }\n");
55
72
  REACT_SHOW_METHOD_SPEC_ERRORS(
56
- 4,
57
- "batchRenderingUpdatesInEventLoop",
58
- " REACT_SYNC_METHOD(batchRenderingUpdatesInEventLoop) bool batchRenderingUpdatesInEventLoop() noexcept { /* implementation */ }\n"
59
- " REACT_SYNC_METHOD(batchRenderingUpdatesInEventLoop) static bool batchRenderingUpdatesInEventLoop() noexcept { /* implementation */ }\n");
60
- REACT_SHOW_METHOD_SPEC_ERRORS(
61
- 5,
73
+ 7,
62
74
  "enableSpannableBuildingUnification",
63
75
  " REACT_SYNC_METHOD(enableSpannableBuildingUnification) bool enableSpannableBuildingUnification() noexcept { /* implementation */ }\n"
64
76
  " REACT_SYNC_METHOD(enableSpannableBuildingUnification) static bool enableSpannableBuildingUnification() noexcept { /* implementation */ }\n");
65
77
  REACT_SHOW_METHOD_SPEC_ERRORS(
66
- 6,
78
+ 8,
67
79
  "enableCustomDrawOrderFabric",
68
80
  " REACT_SYNC_METHOD(enableCustomDrawOrderFabric) bool enableCustomDrawOrderFabric() noexcept { /* implementation */ }\n"
69
81
  " REACT_SYNC_METHOD(enableCustomDrawOrderFabric) static bool enableCustomDrawOrderFabric() noexcept { /* implementation */ }\n");
70
82
  REACT_SHOW_METHOD_SPEC_ERRORS(
71
- 7,
83
+ 9,
72
84
  "enableFixForClippedSubviewsCrash",
73
85
  " REACT_SYNC_METHOD(enableFixForClippedSubviewsCrash) bool enableFixForClippedSubviewsCrash() noexcept { /* implementation */ }\n"
74
86
  " REACT_SYNC_METHOD(enableFixForClippedSubviewsCrash) static bool enableFixForClippedSubviewsCrash() noexcept { /* implementation */ }\n");
75
87
  REACT_SHOW_METHOD_SPEC_ERRORS(
76
- 8,
88
+ 10,
77
89
  "inspectorEnableCxxInspectorPackagerConnection",
78
90
  " REACT_SYNC_METHOD(inspectorEnableCxxInspectorPackagerConnection) bool inspectorEnableCxxInspectorPackagerConnection() noexcept { /* implementation */ }\n"
79
91
  " REACT_SYNC_METHOD(inspectorEnableCxxInspectorPackagerConnection) static bool inspectorEnableCxxInspectorPackagerConnection() noexcept { /* implementation */ }\n");
80
92
  REACT_SHOW_METHOD_SPEC_ERRORS(
81
- 9,
93
+ 11,
82
94
  "inspectorEnableModernCDPRegistry",
83
95
  " REACT_SYNC_METHOD(inspectorEnableModernCDPRegistry) bool inspectorEnableModernCDPRegistry() noexcept { /* implementation */ }\n"
84
96
  " REACT_SYNC_METHOD(inspectorEnableModernCDPRegistry) static bool inspectorEnableModernCDPRegistry() noexcept { /* implementation */ }\n");
@@ -16,6 +16,21 @@ static jsi::Value __hostFunction_NativeReactNativeFeatureFlagsCxxSpecJSI_commonT
16
16
  rt
17
17
  );
18
18
  }
19
+ static jsi::Value __hostFunction_NativeReactNativeFeatureFlagsCxxSpecJSI_androidEnablePendingFabricTransactions(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
20
+ return static_cast<NativeReactNativeFeatureFlagsCxxSpecJSI *>(&turboModule)->androidEnablePendingFabricTransactions(
21
+ rt
22
+ );
23
+ }
24
+ static jsi::Value __hostFunction_NativeReactNativeFeatureFlagsCxxSpecJSI_batchRenderingUpdatesInEventLoop(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
25
+ return static_cast<NativeReactNativeFeatureFlagsCxxSpecJSI *>(&turboModule)->batchRenderingUpdatesInEventLoop(
26
+ rt
27
+ );
28
+ }
29
+ static jsi::Value __hostFunction_NativeReactNativeFeatureFlagsCxxSpecJSI_destroyFabricSurfacesInReactInstanceManager(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
30
+ return static_cast<NativeReactNativeFeatureFlagsCxxSpecJSI *>(&turboModule)->destroyFabricSurfacesInReactInstanceManager(
31
+ rt
32
+ );
33
+ }
19
34
  static jsi::Value __hostFunction_NativeReactNativeFeatureFlagsCxxSpecJSI_enableBackgroundExecutor(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
20
35
  return static_cast<NativeReactNativeFeatureFlagsCxxSpecJSI *>(&turboModule)->enableBackgroundExecutor(
21
36
  rt
@@ -31,11 +46,6 @@ static jsi::Value __hostFunction_NativeReactNativeFeatureFlagsCxxSpecJSI_enableM
31
46
  rt
32
47
  );
33
48
  }
34
- static jsi::Value __hostFunction_NativeReactNativeFeatureFlagsCxxSpecJSI_batchRenderingUpdatesInEventLoop(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
35
- return static_cast<NativeReactNativeFeatureFlagsCxxSpecJSI *>(&turboModule)->batchRenderingUpdatesInEventLoop(
36
- rt
37
- );
38
- }
39
49
  static jsi::Value __hostFunction_NativeReactNativeFeatureFlagsCxxSpecJSI_enableSpannableBuildingUnification(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
40
50
  return static_cast<NativeReactNativeFeatureFlagsCxxSpecJSI *>(&turboModule)->enableSpannableBuildingUnification(
41
51
  rt
@@ -65,10 +75,12 @@ static jsi::Value __hostFunction_NativeReactNativeFeatureFlagsCxxSpecJSI_inspect
65
75
  NativeReactNativeFeatureFlagsCxxSpecJSI::NativeReactNativeFeatureFlagsCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker)
66
76
  : TurboModule("NativeReactNativeFeatureFlagsCxx", jsInvoker) {
67
77
  methodMap_["commonTestFlag"] = MethodMetadata {0, __hostFunction_NativeReactNativeFeatureFlagsCxxSpecJSI_commonTestFlag};
78
+ methodMap_["androidEnablePendingFabricTransactions"] = MethodMetadata {0, __hostFunction_NativeReactNativeFeatureFlagsCxxSpecJSI_androidEnablePendingFabricTransactions};
79
+ methodMap_["batchRenderingUpdatesInEventLoop"] = MethodMetadata {0, __hostFunction_NativeReactNativeFeatureFlagsCxxSpecJSI_batchRenderingUpdatesInEventLoop};
80
+ methodMap_["destroyFabricSurfacesInReactInstanceManager"] = MethodMetadata {0, __hostFunction_NativeReactNativeFeatureFlagsCxxSpecJSI_destroyFabricSurfacesInReactInstanceManager};
68
81
  methodMap_["enableBackgroundExecutor"] = MethodMetadata {0, __hostFunction_NativeReactNativeFeatureFlagsCxxSpecJSI_enableBackgroundExecutor};
69
82
  methodMap_["useModernRuntimeScheduler"] = MethodMetadata {0, __hostFunction_NativeReactNativeFeatureFlagsCxxSpecJSI_useModernRuntimeScheduler};
70
83
  methodMap_["enableMicrotasks"] = MethodMetadata {0, __hostFunction_NativeReactNativeFeatureFlagsCxxSpecJSI_enableMicrotasks};
71
- methodMap_["batchRenderingUpdatesInEventLoop"] = MethodMetadata {0, __hostFunction_NativeReactNativeFeatureFlagsCxxSpecJSI_batchRenderingUpdatesInEventLoop};
72
84
  methodMap_["enableSpannableBuildingUnification"] = MethodMetadata {0, __hostFunction_NativeReactNativeFeatureFlagsCxxSpecJSI_enableSpannableBuildingUnification};
73
85
  methodMap_["enableCustomDrawOrderFabric"] = MethodMetadata {0, __hostFunction_NativeReactNativeFeatureFlagsCxxSpecJSI_enableCustomDrawOrderFabric};
74
86
  methodMap_["enableFixForClippedSubviewsCrash"] = MethodMetadata {0, __hostFunction_NativeReactNativeFeatureFlagsCxxSpecJSI_enableFixForClippedSubviewsCrash};