-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Fabric] Support blob: images, and provide better image.onError callbacks #13285
Conversation
vnext/Microsoft.ReactNative/Fabric/Composition/UriImageManager.h
Outdated
Show resolved
Hide resolved
-> winrt::Microsoft::ReactNative::Composition::Experimental::IBrush { | ||
auto compositor = winrt::Microsoft::ReactNative::Composition::Experimental:: | ||
MicrosoftCompositionContextHelper::InnerCompositor(compositionContext); | ||
auto drawingBrush = compositionContext.CreateDrawingSurfaceBrush( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: {} - brace initialization to avoid any type conversion happening and ensuring uniform initialization? https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#es23-prefer-the--initializer-syntax
winrt::Windows::Graphics::DirectX::DirectXAlphaMode::Premultiplied); | ||
POINT pt; | ||
Microsoft::ReactNative::Composition::AutoDrawDrawingSurface autoDraw(drawingBrush, scale, &pt); | ||
auto renderTarget = autoDraw.GetRenderTarget(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: uniform initialization?
size, | ||
winrt::Windows::Graphics::DirectX::DirectXPixelFormat::B8G8R8A8UIntNormalized, | ||
winrt::Windows::Graphics::DirectX::DirectXAlphaMode::Premultiplied); | ||
POINT pt; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
POINT pt{}?
const winrt::Microsoft::ReactNative::IReactContext &reactContext, | ||
const winrt::Microsoft::ReactNative::Composition::Experimental::ICompositionContext &compositionContext) | ||
-> winrt::Microsoft::ReactNative::Composition::Experimental::IBrush { | ||
auto compositor = winrt::Microsoft::ReactNative::Composition::Experimental:: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
uniform initialization?
packages/@react-native-windows/tester/src/js/examples/Image/ImageExample.windows.js
Show resolved
Hide resolved
…acks (microsoft#13285) * [Fabric] Support blob: images, and provide better image.onError callbacks * Change files * Remove some test code * Add user-agent * Add public API to set default User-Agent header * various fixes * fix snapshots * Rename Networking -> HttpSettings * Change files * fix * Http.UserAgent RuntimeOption needs to be set before the HttpResource is created
* [Fabric] Support blob: images, and provide better image.onError callbacks (#13285) * [Fabric] Support blob: images, and provide better image.onError callbacks * Change files * Remove some test code * Add user-agent * Add public API to set default User-Agent header * various fixes * fix snapshots * Rename Networking -> HttpSettings * Change files * fix * Http.UserAgent RuntimeOption needs to be set before the HttpResource is created * fixups for ImageErrorInfo not existing in 0.74 * fix
Description
In a recent integration ImageLoader started taking more detailed error information. This change provides better error handling for image loading.
I also went ahead and hooked up an ImageLoader for
blob:
images.Recent changes to the ImageExample RNTester test page added uses of an Image uri which requires a user-agent header be included in the request to successfully download the image. This PR adds a new API
Microsoft.ReactNative.Networking.SetDefaultUserAgent(ReactInstanceSettings, string)
which applications can use to set the a default user-agent header for network requests.The new ImageExample images also needed work to get to work in paper. In particular piping through the new DefaultUserAgent, and forcing a custom download step if its set.
Fixes #13262.
Microsoft Reviewers: Open in CodeFlow