react-native-windows 0.74.1 → 0.74.2

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 (26) 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 +82 -0
  11. package/Microsoft.ReactNative/Fabric/Composition/UriImageManager.h +39 -0
  12. package/Microsoft.ReactNative/Fabric/Composition/UriImageManager_emptyimpl.cpp +16 -0
  13. package/Microsoft.ReactNative/Fabric/FabricUIManagerModule.cpp +3 -0
  14. package/Microsoft.ReactNative/Fabric/FabricUIManagerModule.h +2 -0
  15. package/Microsoft.ReactNative/Fabric/ImageManager.cpp +3 -2
  16. package/Microsoft.ReactNative/Fabric/WindowsImageManager.cpp +102 -35
  17. package/Microsoft.ReactNative/Fabric/WindowsImageManager.h +6 -1
  18. package/Microsoft.ReactNative/UriImageManager.idl +85 -0
  19. package/PropertySheets/Generated/PackageVersion.g.props +3 -3
  20. package/Shared/Shared.vcxitems +11 -0
  21. package/codegen/NativeReactNativeFeatureFlagsSpec.g.h +33 -21
  22. package/codegen/rnwcoreJSI-generated.cpp +18 -6
  23. package/codegen/rnwcoreJSI.h +27 -9
  24. package/package.json +13 -13
  25. package/src/private/featureflags/NativeReactNativeFeatureFlags.js +4 -2
  26. package/src/private/featureflags/ReactNativeFeatureFlags.js +16 -6
@@ -209,6 +209,7 @@ class TouchableBounce extends React.Component<Props, State> {
209
209
 
210
210
  componentWillUnmount(): void {
211
211
  this.state.pressability.reset();
212
+ this.state.scale.resetAnimation();
212
213
  }
213
214
  }
214
215
 
@@ -320,6 +320,7 @@ class TouchableOpacity extends React.Component<Props, State> {
320
320
 
321
321
  componentWillUnmount(): void {
322
322
  this.state.pressability.reset();
323
+ this.state.anim.resetAnimation();
323
324
  }
324
325
  }
325
326
 
@@ -335,6 +335,7 @@ class TouchableOpacity extends React.Component<Props, State> {
335
335
 
336
336
  componentWillUnmount(): void {
337
337
  this.state.pressability.reset();
338
+ this.state.anim.resetAnimation();
338
339
  }
339
340
  }
340
341
 
@@ -16,7 +16,7 @@ const version: $ReadOnly<{
16
16
  }> = {
17
17
  major: 0,
18
18
  minor: 74,
19
- patch: 0,
19
+ patch: 1,
20
20
  prerelease: null,
21
21
  };
22
22
 
@@ -1966,6 +1966,12 @@ winrt::Microsoft::UI::Composition::ICompositionSurface MicrosoftCompositionConte
1966
1966
  surface.try_as(s);
1967
1967
  return s ? s->Inner() : nullptr;
1968
1968
  }
1969
+
1970
+ winrt::Microsoft::ReactNative::Composition::Experimental::IBrush MicrosoftCompositionContextHelper::WrapBrush(
1971
+ const winrt::Microsoft::UI::Composition::CompositionBrush &brush) noexcept {
1972
+ return winrt::make<::Microsoft::ReactNative::Composition::Experimental::MicrosoftCompBrush>(brush);
1973
+ }
1974
+
1969
1975
  #endif
1970
1976
 
1971
1977
  } // namespace winrt::Microsoft::ReactNative::Composition::Experimental::implementation
@@ -45,6 +45,8 @@ struct MicrosoftCompositionContextHelper : MicrosoftCompositionContextHelperT<Mi
45
45
  static winrt::Microsoft::UI::Composition::DropShadow InnerDropShadow(IDropShadow shadow) noexcept;
46
46
  static winrt::Microsoft::UI::Composition::CompositionBrush InnerBrush(IBrush brush) noexcept;
47
47
  static winrt::Microsoft::UI::Composition::ICompositionSurface InnerSurface(IDrawingSurfaceBrush surface) noexcept;
48
+
49
+ static IBrush WrapBrush(const winrt::Microsoft::UI::Composition::CompositionBrush &brush) noexcept;
48
50
  };
49
51
  #endif
50
52
 
@@ -39,9 +39,9 @@ void ImageComponentView::WindowsImageResponseObserver::didReceiveProgress(float
39
39
 
40
40
  void ImageComponentView::WindowsImageResponseObserver::didReceiveImage(
41
41
  facebook::react::ImageResponse const &imageResponse) const {
42
- auto sharedwicbmp = std::static_pointer_cast<winrt::com_ptr<IWICBitmap>>(imageResponse.getImage());
42
+ auto imageResponseImage = std::static_pointer_cast<ImageResponseImage>(imageResponse.getImage());
43
43
  m_image->m_reactContext.UIDispatcher().Post(
44
- [wicbmp = *sharedwicbmp, image = m_image]() { image->didReceiveImage(wicbmp); });
44
+ [imageResponseImage, image = m_image]() { image->didReceiveImage(imageResponseImage); });
45
45
  }
46
46
 
47
47
  void ImageComponentView::WindowsImageResponseObserver::didReceiveFailure() const {
@@ -83,7 +83,7 @@ void ImageComponentView::ImageLoadStart() noexcept {
83
83
  }
84
84
  }
85
85
 
86
- void ImageComponentView::didReceiveImage(const winrt::com_ptr<IWICBitmap> &wicbmp) noexcept {
86
+ void ImageComponentView::didReceiveImage(const std::shared_ptr<ImageResponseImage> &imageResponseImage) noexcept {
87
87
  // TODO check for recycled?
88
88
 
89
89
  auto imageEventEmitter = std::static_pointer_cast<facebook::react::ImageEventEmitter const>(m_eventEmitter);
@@ -99,7 +99,7 @@ void ImageComponentView::didReceiveImage(const winrt::com_ptr<IWICBitmap> &wicbm
99
99
  assert(uiDispatcher.HasThreadAccess());
100
100
  #endif
101
101
 
102
- m_wicbmp = wicbmp;
102
+ m_imageResponseImage = imageResponseImage;
103
103
  ensureDrawingSurface();
104
104
  }
105
105
 
@@ -198,7 +198,8 @@ void ImageComponentView::updateLayoutMetrics(
198
198
  }
199
199
 
200
200
  void ImageComponentView::OnRenderingDeviceLost() noexcept {
201
- DrawImage();
201
+ m_drawingSurface = nullptr;
202
+ ensureDrawingSurface();
202
203
  }
203
204
 
204
205
  bool ImageComponentView::themeEffectsImage() const noexcept {
@@ -207,7 +208,8 @@ bool ImageComponentView::themeEffectsImage() const noexcept {
207
208
 
208
209
  void ImageComponentView::onThemeChanged() noexcept {
209
210
  if (themeEffectsImage()) {
210
- DrawImage();
211
+ m_drawingSurface = nullptr;
212
+ ensureDrawingSurface();
211
213
  }
212
214
  Super::onThemeChanged();
213
215
  }
@@ -215,10 +217,17 @@ void ImageComponentView::onThemeChanged() noexcept {
215
217
  void ImageComponentView::ensureDrawingSurface() noexcept {
216
218
  assert(m_reactContext.UIDispatcher().HasThreadAccess());
217
219
 
218
- UINT width, height;
219
- winrt::check_hresult(m_wicbmp->GetSize(&width, &height));
220
+ if (!m_imageResponseImage) {
221
+ m_visual.Brush(nullptr);
222
+ return;
223
+ }
224
+
225
+ UINT width = 0, height = 0;
226
+ if (m_imageResponseImage->m_wicbmp) {
227
+ winrt::check_hresult(m_imageResponseImage->m_wicbmp->GetSize(&width, &height));
228
+ }
220
229
 
221
- if (!m_drawingSurface && m_wicbmp) {
230
+ if (!m_drawingSurface && m_imageResponseImage->m_wicbmp) {
222
231
  winrt::Windows::Foundation::Size drawingSurfaceSize{static_cast<float>(width), static_cast<float>(height)};
223
232
 
224
233
  const auto imageProps = std::static_pointer_cast<const facebook::react::ImageProps>(m_props);
@@ -273,6 +282,8 @@ void ImageComponentView::ensureDrawingSurface() noexcept {
273
282
  }
274
283
 
275
284
  m_visual.Brush(m_drawingSurface);
285
+ } else if (m_imageResponseImage->m_brushFactory) {
286
+ m_visual.Brush(m_imageResponseImage->m_brushFactory(m_reactContext.Handle(), m_compContext));
276
287
  }
277
288
  }
278
289
 
@@ -286,7 +297,7 @@ void ImageComponentView::DrawImage() noexcept {
286
297
  return;
287
298
  }
288
299
 
289
- if (!m_wicbmp) {
300
+ if (!m_imageResponseImage->m_wicbmp) {
290
301
  return;
291
302
  }
292
303
 
@@ -295,7 +306,8 @@ void ImageComponentView::DrawImage() noexcept {
295
306
  ::Microsoft::ReactNative::Composition::AutoDrawDrawingSurface autoDraw(m_drawingSurface, 1.0f, &offset);
296
307
  if (auto d2dDeviceContext = autoDraw.GetRenderTarget()) {
297
308
  winrt::com_ptr<ID2D1Bitmap1> bitmap;
298
- winrt::check_hresult(d2dDeviceContext->CreateBitmapFromWicBitmap(m_wicbmp.get(), nullptr, bitmap.put()));
309
+ winrt::check_hresult(
310
+ d2dDeviceContext->CreateBitmapFromWicBitmap(m_imageResponseImage->m_wicbmp.get(), nullptr, bitmap.put()));
299
311
 
300
312
  d2dDeviceContext->Clear(D2D1::ColorF(D2D1::ColorF::Black, 0.0f));
301
313
  if (m_props->backgroundColor) {
@@ -311,7 +323,8 @@ void ImageComponentView::DrawImage() noexcept {
311
323
  if (useEffects) {
312
324
  winrt::com_ptr<ID2D1Effect> bitmapEffects;
313
325
  winrt::check_hresult(d2dDeviceContext->CreateEffect(CLSID_D2D1BitmapSource, bitmapEffects.put()));
314
- winrt::check_hresult(bitmapEffects->SetValue(D2D1_BITMAPSOURCE_PROP_WIC_BITMAP_SOURCE, m_wicbmp.get()));
326
+ winrt::check_hresult(
327
+ bitmapEffects->SetValue(D2D1_BITMAPSOURCE_PROP_WIC_BITMAP_SOURCE, m_imageResponseImage->m_wicbmp.get()));
315
328
 
316
329
  if (imageProps->blurRadius > 0) {
317
330
  winrt::com_ptr<ID2D1Effect> gaussianBlurEffect;
@@ -360,7 +373,7 @@ void ImageComponentView::DrawImage() noexcept {
360
373
  }
361
374
  } else {
362
375
  UINT width, height;
363
- winrt::check_hresult(m_wicbmp->GetSize(&width, &height));
376
+ winrt::check_hresult(m_imageResponseImage->m_wicbmp->GetSize(&width, &height));
364
377
 
365
378
  D2D1_RECT_F rect = D2D1::RectF(
366
379
  static_cast<float>(offset.x),
@@ -14,6 +14,7 @@
14
14
  #include <winrt/Windows.UI.Composition.h>
15
15
  #include "CompositionHelpers.h"
16
16
  #include "CompositionViewComponentView.h"
17
+ #include "ImageResponseImage.h"
17
18
 
18
19
  #pragma warning(push)
19
20
  #pragma warning(disable : 4244 4305)
@@ -83,7 +84,7 @@ struct ImageComponentView : ImageComponentViewT<ImageComponentView, ComponentVie
83
84
 
84
85
  void ImageLoadStart() noexcept;
85
86
  void ImageLoaded() noexcept;
86
- void didReceiveImage(const winrt::com_ptr<IWICBitmap> &wicbmp) noexcept;
87
+ void didReceiveImage(const std::shared_ptr<ImageResponseImage> &wicbmp) noexcept;
87
88
  void didReceiveFailureFromObserver() noexcept;
88
89
  void setStateAndResubscribeImageResponseObserver(
89
90
  facebook::react::ImageShadowNode::ConcreteState::Shared const &state) noexcept;
@@ -93,7 +94,7 @@ struct ImageComponentView : ImageComponentViewT<ImageComponentView, ComponentVie
93
94
 
94
95
  winrt::Microsoft::ReactNative::Composition::Experimental::ISpriteVisual m_visual{nullptr};
95
96
  winrt::Microsoft::ReactNative::Composition::Experimental::IDrawingSurfaceBrush m_drawingSurface;
96
- winrt::com_ptr<IWICBitmap> m_wicbmp;
97
+ std::shared_ptr<ImageResponseImage> m_imageResponseImage;
97
98
  std::shared_ptr<WindowsImageResponseObserver> m_imageResponseObserver;
98
99
  facebook::react::ImageShadowNode::ConcreteState::Shared m_state;
99
100
  };
@@ -0,0 +1,17 @@
1
+
2
+ // Copyright (c) Microsoft Corporation.
3
+ // Licensed under the MIT License.
4
+
5
+ #pragma once
6
+
7
+ #include <wincodec.h>
8
+ #include <winrt/Microsoft.ReactNative.Composition.Experimental.h>
9
+
10
+ namespace winrt::Microsoft::ReactNative::Composition::implementation {
11
+
12
+ struct ImageResponseImage {
13
+ winrt::com_ptr<IWICBitmap> m_wicbmp;
14
+ winrt::Microsoft::ReactNative::Composition::Experimental::UriBrushFactory m_brushFactory{nullptr};
15
+ };
16
+
17
+ } // namespace winrt::Microsoft::ReactNative::Composition::implementation
@@ -0,0 +1,82 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT License.
3
+
4
+ #include "pch.h"
5
+ #include "UriImageManager.h"
6
+
7
+ #include "Composition.ImageSource.g.h"
8
+ #include "Composition.UriImageManager.g.cpp"
9
+ #include <ReactPropertyBag.h>
10
+
11
+ namespace winrt::Microsoft::ReactNative::Composition::implementation {
12
+
13
+ struct ImageSource : ImageSourceT<ImageSource> {
14
+ ImageSource(const facebook::react::ImageSource &source)
15
+ : m_size({source.size.width, source.size.height}),
16
+ m_scale(source.scale),
17
+ m_uri(::Microsoft::ReactNative::UriTryCreate(winrt::to_hstring(source.uri))) {}
18
+
19
+ winrt::Windows::Foundation::Uri Uri() noexcept {
20
+ return m_uri;
21
+ }
22
+
23
+ winrt::Windows::Foundation::Size Size() noexcept {
24
+ return m_size;
25
+ }
26
+
27
+ float Scale() noexcept {
28
+ return m_scale;
29
+ }
30
+
31
+ private:
32
+ const winrt::Windows::Foundation::Uri m_uri;
33
+ const winrt::Windows::Foundation::Size m_size;
34
+ const float m_scale;
35
+ };
36
+
37
+ winrt::Microsoft::ReactNative::Composition::ImageSource MakeImageSource(
38
+ const facebook::react::ImageSource &source) noexcept {
39
+ return winrt::make<ImageSource>(source);
40
+ }
41
+
42
+ static const ReactPropertyId<ReactNonAbiValue<winrt::com_ptr<UriImageManager>>> &UriImageManagerPropertyId() noexcept {
43
+ static const ReactPropertyId<ReactNonAbiValue<winrt::com_ptr<UriImageManager>>> prop{
44
+ L"ReactNative", L"UriImageManager"};
45
+ return prop;
46
+ }
47
+
48
+ winrt::com_ptr<UriImageManager> UriImageManager::GetOrCreate(
49
+ const winrt::Microsoft::ReactNative::ReactPropertyBag &properties) noexcept {
50
+ auto uriImageManager =
51
+ winrt::Microsoft::ReactNative::ReactPropertyBag(properties).GetOrCreate(UriImageManagerPropertyId(), []() {
52
+ return winrt::make_self<UriImageManager>();
53
+ });
54
+ return uriImageManager.Value();
55
+ }
56
+
57
+ void UriImageManager::AddUriImageProvider(
58
+ const winrt::Microsoft::ReactNative::IReactPropertyBag &properties,
59
+ const IUriImageProvider &provider) {
60
+ if (!provider)
61
+ winrt::throw_hresult(E_INVALIDARG);
62
+ GetOrCreate(winrt::Microsoft::ReactNative::ReactPropertyBag(properties))->m_providers.push_back(provider);
63
+ }
64
+
65
+ IUriImageProvider UriImageManager::TryGetUriImageProvider(
66
+ const IReactContext &context,
67
+ winrt::Microsoft::ReactNative::Composition::ImageSource &source) noexcept {
68
+ auto uri = source.Uri();
69
+ if (!uri) {
70
+ return nullptr;
71
+ }
72
+
73
+ for (auto &provider : m_providers) {
74
+ if (provider.CanLoadImageUri(context, source.Uri())) {
75
+ return provider;
76
+ }
77
+ }
78
+
79
+ return nullptr;
80
+ }
81
+
82
+ } // namespace winrt::Microsoft::ReactNative::Composition::implementation
@@ -0,0 +1,39 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT License.
3
+
4
+ #pragma once
5
+ #include "Composition.UriImageManager.g.h"
6
+
7
+ #include <ReactPropertyBag.h>
8
+ #include <Utils/ImageUtils.h>
9
+ #include <react/renderer/imagemanager/primitives.h>
10
+ #include <winrt/Microsoft.ReactNative.Composition.h>
11
+
12
+ namespace winrt::Microsoft::ReactNative::Composition::implementation {
13
+
14
+ struct UriImageManager : UriImageManagerT<UriImageManager> {
15
+ UriImageManager() = default;
16
+
17
+ static void AddUriImageProvider(
18
+ const winrt::Microsoft::ReactNative::IReactPropertyBag &properties,
19
+ const IUriImageProvider &provider);
20
+
21
+ static winrt::com_ptr<UriImageManager> GetOrCreate(
22
+ const winrt::Microsoft::ReactNative::ReactPropertyBag &properties) noexcept;
23
+
24
+ IUriImageProvider TryGetUriImageProvider(
25
+ const IReactContext &context,
26
+ winrt::Microsoft::ReactNative::Composition::ImageSource &source) noexcept;
27
+
28
+ private:
29
+ std::vector<IUriImageProvider> m_providers;
30
+ };
31
+
32
+ winrt::Microsoft::ReactNative::Composition::ImageSource MakeImageSource(
33
+ const facebook::react::ImageSource &source) noexcept;
34
+
35
+ } // namespace winrt::Microsoft::ReactNative::Composition::implementation
36
+
37
+ namespace winrt::Microsoft::ReactNative::Composition::factory_implementation {
38
+ struct UriImageManager : UriImageManagerT<UriImageManager, implementation::UriImageManager> {};
39
+ } // namespace winrt::Microsoft::ReactNative::Composition::factory_implementation
@@ -0,0 +1,16 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT License.
3
+
4
+ #include "pch.h"
5
+
6
+ #include "UriImageManager.h"
7
+
8
+ #include "Composition.UriImageManager.g.cpp"
9
+
10
+ namespace winrt::Microsoft::ReactNative::Composition::implementation {
11
+
12
+ void UriImageManager::AddUriImageProvider(
13
+ const winrt::Microsoft::ReactNative::IReactPropertyBag &,
14
+ const IUriImageProvider &) {}
15
+
16
+ } // namespace winrt::Microsoft::ReactNative::Composition::implementation
@@ -330,6 +330,9 @@ void FabricUIManager::initiateTransaction(facebook::react::MountingCoordinator::
330
330
  }
331
331
 
332
332
  void FabricUIManager::schedulerDidFinishTransaction(
333
+ const facebook::react::MountingCoordinator::Shared &mountingCoordinator) {}
334
+
335
+ void FabricUIManager::schedulerShouldRenderTransactions(
333
336
  const facebook::react::MountingCoordinator::Shared &mountingCoordinator) {
334
337
  // Should cache this locally
335
338
 
@@ -78,6 +78,8 @@ struct FabricUIManager final : public std::enable_shared_from_this<FabricUIManag
78
78
  std::unordered_map<facebook::react::SurfaceId, SurfaceInfo> m_surfaceRegistry;
79
79
 
80
80
  // Inherited via SchedulerDelegate
81
+ virtual void schedulerShouldRenderTransactions(
82
+ const facebook::react::MountingCoordinator::Shared &mountingCoordinator) override;
81
83
  virtual void schedulerDidFinishTransaction(
82
84
  const facebook::react::MountingCoordinator::Shared &mountingCoordinator) override;
83
85
  virtual void schedulerDidRequestPreliminaryViewAllocation(
@@ -9,8 +9,9 @@
9
9
  namespace facebook {
10
10
  namespace react {
11
11
 
12
- ImageManager::ImageManager(ContextContainer::Shared const &) {
13
- self_ = new Microsoft::ReactNative::WindowsImageManager();
12
+ ImageManager::ImageManager(ContextContainer::Shared const &contextContainer) {
13
+ auto reactContext = *contextContainer->find<winrt::Microsoft::ReactNative::ReactContext>("MSRN.ReactContext");
14
+ self_ = new Microsoft::ReactNative::WindowsImageManager(reactContext);
14
15
  }
15
16
 
16
17
  ImageManager::~ImageManager() {
@@ -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 = winrt::Microsoft::ReactNative::Composition::implementation::UriImageManager::GetOrCreate(
23
+ 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
+ winrt::com_ptr<winrt::Microsoft::ReactNative::Composition::implementation::UriImageManager> m_uriImageManager;
18
23
  };
19
24
 
20
25
  } // namespace Microsoft::ReactNative
@@ -0,0 +1,85 @@
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
+
76
+ [default_interface]
77
+ [webhosthidden]
78
+ [experimental]
79
+ DOC_STRING(
80
+ "Ability to load images using custom Uri protocol handlers. The provider should implement @IUriImageStreamProvider or @Experimental.IUriBrushProvider")
81
+ runtimeclass UriImageManager
82
+ {
83
+ static void AddUriImageProvider(Microsoft.ReactNative.IReactPropertyBag properties, IUriImageProvider provider);
84
+ }
85
+ } // namespace Microsoft.ReactNative.Composition
@@ -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.2</ReactNativeWindowsVersion>
14
14
  <ReactNativeWindowsMajor>0</ReactNativeWindowsMajor>
15
15
  <ReactNativeWindowsMinor>74</ReactNativeWindowsMinor>
16
- <ReactNativeWindowsPatch>1</ReactNativeWindowsPatch>
16
+ <ReactNativeWindowsPatch>2</ReactNativeWindowsPatch>
17
17
  <ReactNativeWindowsCanary>false</ReactNativeWindowsCanary>
18
- <ReactNativeWindowsCommitId>7fd1f4439e2e1f109d4d2b20a97073f14bcbf504</ReactNativeWindowsCommitId>
18
+ <ReactNativeWindowsCommitId>b422f06e2b5ac1bd5fb7cffbc9f247024452120a</ReactNativeWindowsCommitId>
19
19
  </PropertyGroup>
20
20
  </Project>
@@ -84,6 +84,16 @@
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>
92
+ <ClCompile Include="$(MSBuildThisFileDirectory)..\Microsoft.ReactNative\Fabric\Composition\UriImageManager_emptyimpl.cpp">
93
+ <ExcludedFromBuild Condition="'$(UseFabric)' == 'true' OR '$(IncludeFabricInterface)' != 'true'">true</ExcludedFromBuild>
94
+ <DependentUpon>$(ReactNativeWindowsDir)Microsoft.ReactNative\UriImageManager.idl</DependentUpon>
95
+ <SubType>Code</SubType>
96
+ </ClCompile>
87
97
  <ClCompile Include="$(MSBuildThisFileDirectory)..\Microsoft.ReactNative\Fabric\Composition\CompositionViewComponentView.cpp">
88
98
  <ExcludedFromBuild Condition="'$(UseFabric)' != 'true'">true</ExcludedFromBuild>
89
99
  </ClCompile>
@@ -639,6 +649,7 @@
639
649
  <Midl Condition="'$(UseFabric)' == 'true' OR '$(IncludeFabricInterface)' == 'true'" Include="$(ReactNativeWindowsDir)Microsoft.ReactNative\IReactPackageBuilderFabric.idl" />
640
650
  <Midl Condition="'$(UseFabric)' == 'true' OR '$(IncludeFabricInterface)' == 'true'" Include="$(ReactNativeWindowsDir)Microsoft.ReactNative\IReactViewComponentBuilder.idl" />
641
651
  <Midl Condition="'$(UseFabric)' == 'true' OR '$(IncludeFabricInterface)' == 'true'" Include="$(ReactNativeWindowsDir)Microsoft.ReactNative\Theme.idl" />
652
+ <Midl Condition="'$(UseFabric)' == 'true' OR '$(IncludeFabricInterface)' == 'true'" Include="$(ReactNativeWindowsDir)Microsoft.ReactNative\UriImageManager.idl" />
642
653
  <Midl Condition="'$(UseFabric)' == 'true' OR '$(IncludeFabricInterface)' == 'true'" Include="$(ReactNativeWindowsDir)Microsoft.ReactNative\ViewProps.idl" />
643
654
  </ItemGroup>
644
655
  <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};
@@ -21,10 +21,12 @@ protected:
21
21
 
22
22
  public:
23
23
  virtual bool commonTestFlag(jsi::Runtime &rt) = 0;
24
+ virtual bool androidEnablePendingFabricTransactions(jsi::Runtime &rt) = 0;
25
+ virtual bool batchRenderingUpdatesInEventLoop(jsi::Runtime &rt) = 0;
26
+ virtual bool destroyFabricSurfacesInReactInstanceManager(jsi::Runtime &rt) = 0;
24
27
  virtual bool enableBackgroundExecutor(jsi::Runtime &rt) = 0;
25
28
  virtual bool useModernRuntimeScheduler(jsi::Runtime &rt) = 0;
26
29
  virtual bool enableMicrotasks(jsi::Runtime &rt) = 0;
27
- virtual bool batchRenderingUpdatesInEventLoop(jsi::Runtime &rt) = 0;
28
30
  virtual bool enableSpannableBuildingUnification(jsi::Runtime &rt) = 0;
29
31
  virtual bool enableCustomDrawOrderFabric(jsi::Runtime &rt) = 0;
30
32
  virtual bool enableFixForClippedSubviewsCrash(jsi::Runtime &rt) = 0;
@@ -61,6 +63,30 @@ private:
61
63
  return bridging::callFromJs<bool>(
62
64
  rt, &T::commonTestFlag, jsInvoker_, instance_);
63
65
  }
66
+ bool androidEnablePendingFabricTransactions(jsi::Runtime &rt) override {
67
+ static_assert(
68
+ bridging::getParameterCount(&T::androidEnablePendingFabricTransactions) == 1,
69
+ "Expected androidEnablePendingFabricTransactions(...) to have 1 parameters");
70
+
71
+ return bridging::callFromJs<bool>(
72
+ rt, &T::androidEnablePendingFabricTransactions, jsInvoker_, instance_);
73
+ }
74
+ bool batchRenderingUpdatesInEventLoop(jsi::Runtime &rt) override {
75
+ static_assert(
76
+ bridging::getParameterCount(&T::batchRenderingUpdatesInEventLoop) == 1,
77
+ "Expected batchRenderingUpdatesInEventLoop(...) to have 1 parameters");
78
+
79
+ return bridging::callFromJs<bool>(
80
+ rt, &T::batchRenderingUpdatesInEventLoop, jsInvoker_, instance_);
81
+ }
82
+ bool destroyFabricSurfacesInReactInstanceManager(jsi::Runtime &rt) override {
83
+ static_assert(
84
+ bridging::getParameterCount(&T::destroyFabricSurfacesInReactInstanceManager) == 1,
85
+ "Expected destroyFabricSurfacesInReactInstanceManager(...) to have 1 parameters");
86
+
87
+ return bridging::callFromJs<bool>(
88
+ rt, &T::destroyFabricSurfacesInReactInstanceManager, jsInvoker_, instance_);
89
+ }
64
90
  bool enableBackgroundExecutor(jsi::Runtime &rt) override {
65
91
  static_assert(
66
92
  bridging::getParameterCount(&T::enableBackgroundExecutor) == 1,
@@ -85,14 +111,6 @@ private:
85
111
  return bridging::callFromJs<bool>(
86
112
  rt, &T::enableMicrotasks, jsInvoker_, instance_);
87
113
  }
88
- bool batchRenderingUpdatesInEventLoop(jsi::Runtime &rt) override {
89
- static_assert(
90
- bridging::getParameterCount(&T::batchRenderingUpdatesInEventLoop) == 1,
91
- "Expected batchRenderingUpdatesInEventLoop(...) to have 1 parameters");
92
-
93
- return bridging::callFromJs<bool>(
94
- rt, &T::batchRenderingUpdatesInEventLoop, jsInvoker_, instance_);
95
- }
96
114
  bool enableSpannableBuildingUnification(jsi::Runtime &rt) override {
97
115
  static_assert(
98
116
  bridging::getParameterCount(&T::enableSpannableBuildingUnification) == 1,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-windows",
3
- "version": "0.74.1",
3
+ "version": "0.74.2",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -23,18 +23,18 @@
23
23
  "dependencies": {
24
24
  "@babel/runtime": "^7.0.0",
25
25
  "@jest/create-cache-key-function": "^29.6.3",
26
- "@react-native-community/cli": "13.6.4",
27
- "@react-native-community/cli-platform-android": "13.6.4",
28
- "@react-native-community/cli-platform-ios": "13.6.4",
26
+ "@react-native-community/cli": "13.6.6",
27
+ "@react-native-community/cli-platform-android": "13.6.6",
28
+ "@react-native-community/cli-platform-ios": "13.6.6",
29
29
  "@react-native-windows/cli": "0.74.0",
30
30
  "@react-native/assets": "1.0.0",
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",
31
+ "@react-native/assets-registry": "0.74.83",
32
+ "@react-native/codegen": "0.74.83",
33
+ "@react-native/community-cli-plugin": "0.74.83",
34
+ "@react-native/gradle-plugin": "0.74.83",
35
+ "@react-native/js-polyfills": "0.74.83",
36
+ "@react-native/normalize-colors": "0.74.83",
37
+ "@react-native/virtualized-lists": "0.74.83",
38
38
  "abort-controller": "^3.0.0",
39
39
  "anser": "^1.4.9",
40
40
  "ansi-regex": "^5.0.0",
@@ -65,7 +65,7 @@
65
65
  },
66
66
  "devDependencies": {
67
67
  "@react-native-windows/codegen": "0.74.0",
68
- "@react-native/metro-config": "0.74.81",
68
+ "@react-native/metro-config": "0.74.83",
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",
84
+ "react-native": "0.74.1",
85
85
  "react-native-platform-override": "^1.9.25",
86
86
  "react-refresh": "^0.14.0",
87
87
  "typescript": "5.0.4"
@@ -4,7 +4,7 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
- * @generated SignedSource<<8509d5ee87efb5aa8da7efcd2085d0a2>>
7
+ * @generated SignedSource<<8f82962343a5146622f36c2de071ff6a>>
8
8
  * @flow strict-local
9
9
  */
10
10
 
@@ -24,10 +24,12 @@ import * as TurboModuleRegistry from '../../../Libraries/TurboModule/TurboModule
24
24
 
25
25
  export interface Spec extends TurboModule {
26
26
  +commonTestFlag?: () => boolean;
27
+ +androidEnablePendingFabricTransactions?: () => boolean;
28
+ +batchRenderingUpdatesInEventLoop?: () => boolean;
29
+ +destroyFabricSurfacesInReactInstanceManager?: () => boolean;
27
30
  +enableBackgroundExecutor?: () => boolean;
28
31
  +useModernRuntimeScheduler?: () => boolean;
29
32
  +enableMicrotasks?: () => boolean;
30
- +batchRenderingUpdatesInEventLoop?: () => boolean;
31
33
  +enableSpannableBuildingUnification?: () => boolean;
32
34
  +enableCustomDrawOrderFabric?: () => boolean;
33
35
  +enableFixForClippedSubviewsCrash?: () => boolean;
@@ -4,7 +4,7 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
- * @generated SignedSource<<7c83d5613c3be517efe48378e6356e79>>
7
+ * @generated SignedSource<<b7ebc6e4360a4b7733335f283300a4bb>>
8
8
  * @flow strict-local
9
9
  */
10
10
 
@@ -41,10 +41,12 @@ export type ReactNativeFeatureFlagsJsOnlyOverrides = Partial<ReactNativeFeatureF
41
41
  export type ReactNativeFeatureFlags = {
42
42
  ...ReactNativeFeatureFlagsJsOnly,
43
43
  commonTestFlag: Getter<boolean>,
44
+ androidEnablePendingFabricTransactions: Getter<boolean>,
45
+ batchRenderingUpdatesInEventLoop: Getter<boolean>,
46
+ destroyFabricSurfacesInReactInstanceManager: Getter<boolean>,
44
47
  enableBackgroundExecutor: Getter<boolean>,
45
48
  useModernRuntimeScheduler: Getter<boolean>,
46
49
  enableMicrotasks: Getter<boolean>,
47
- batchRenderingUpdatesInEventLoop: Getter<boolean>,
48
50
  enableSpannableBuildingUnification: Getter<boolean>,
49
51
  enableCustomDrawOrderFabric: Getter<boolean>,
50
52
  enableFixForClippedSubviewsCrash: Getter<boolean>,
@@ -96,6 +98,18 @@ export const shouldUseRemoveClippedSubviewsAsDefaultOnIOS: Getter<boolean> = cre
96
98
  * Common flag for testing. Do NOT modify.
97
99
  */
98
100
  export const commonTestFlag: Getter<boolean> = createNativeFlagGetter('commonTestFlag', false);
101
+ /**
102
+ * To be used with batchRenderingUpdatesInEventLoop. When enbled, the Android mounting layer will concatenate pending transactions to ensure they're applied atomatically
103
+ */
104
+ export const androidEnablePendingFabricTransactions: Getter<boolean> = createNativeFlagGetter('androidEnablePendingFabricTransactions', false);
105
+ /**
106
+ * When enabled, the RuntimeScheduler processing the event loop will batch all rendering updates and dispatch them together at the end of each iteration of the loop.
107
+ */
108
+ export const batchRenderingUpdatesInEventLoop: Getter<boolean> = createNativeFlagGetter('batchRenderingUpdatesInEventLoop', false);
109
+ /**
110
+ * When enabled, ReactInstanceManager will clean up Fabric surfaces on destroy().
111
+ */
112
+ export const destroyFabricSurfacesInReactInstanceManager: Getter<boolean> = createNativeFlagGetter('destroyFabricSurfacesInReactInstanceManager', false);
99
113
  /**
100
114
  * Enables the use of a background executor to compute layout and commit updates on Fabric (this system is deprecated and should not be used).
101
115
  */
@@ -108,10 +122,6 @@ export const useModernRuntimeScheduler: Getter<boolean> = createNativeFlagGetter
108
122
  * Enables the use of microtasks in Hermes (scheduling) and RuntimeScheduler (execution).
109
123
  */
110
124
  export const enableMicrotasks: Getter<boolean> = createNativeFlagGetter('enableMicrotasks', false);
111
- /**
112
- * When enabled, the RuntimeScheduler processing the event loop will batch all rendering updates and dispatch them together at the end of each iteration of the loop.
113
- */
114
- export const batchRenderingUpdatesInEventLoop: Getter<boolean> = createNativeFlagGetter('batchRenderingUpdatesInEventLoop', false);
115
125
  /**
116
126
  * Uses new, deduplicated logic for constructing Android Spannables from text fragments
117
127
  */