Skip to content
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

Merged
merged 13 commits into from
Jun 4, 2024
Merged
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "prerelease",
"comment": "[Fabric] Support blob: images, and provide better image.onError callbacks",
"packageName": "react-native-windows",
"email": "30809111+acoates-ms@users.noreply.github.com",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ function removeGuidsFromImageSourcesHelper(node: ComponentNode) {
source.Uri = source.Uri.replace(/size=\d{5}/, 'size=<size>');
} else if (source.Uri.startsWith('https://www.facebook.com/assets/fb_lite_messaging/E2EE-settings@3x.png?r=1&t=')) {
source.Uri = 'https://www.facebook.com/assets/fb_lite_messaging/E2EE-settings@3x.png?r=1&t=<some_hash_here>';
} else if (source.Uri.startsWith('https://www.facebook.com/ar_effect/external_textures/648609739826677.png?hash=')) {
source.Uri = 'https://www.facebook.com/ar_effect/external_textures/648609739826677.png?hash=<some_hash_here>';
} else if (source.Uri.startsWith('https://www.facebook.com/ads/pics/successstories.png?hash=')) {
source.Uri = 'https://www.facebook.com/ads/pics/successstories.png?hash=<some_hash_here>';
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,8 @@ const {

const IMAGE1 =
'https://www.facebook.com/assets/fb_lite_messaging/E2EE-settings@3x.png';

const IMAGE2 =
// [Windows #13284 - this image crashes e2etests]
// 'https://www.facebook.com/ar_effect/external_textures/648609739826677.png';
'https://www.facebook.com/ads/pics/successstories.png';
'https://www.facebook.com/ar_effect/external_textures/648609739826677.png';
acoates-ms marked this conversation as resolved.
Show resolved Hide resolved

const base64Icon =
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEsAAABLCAQAAACSR7JhAAADtUlEQ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V1zh3hYkgyFGSTKPfRVbRqWWVReaxYeSLarYv1Qqsmh1s95S7G+eEWK0f3jYKTbV6bOwepjfhtafsvUsqrQvrGC8YhmnO9cSCk3yuY984F1vesdHYhWJ5FvASlacshUsajFt2mUM9pqzvKGcyNJW0arTKN1GGGzQlH0tXwLDgQTurS8eIQAAAABJRU5ErkJggg==';
Expand Down Expand Up @@ -1466,6 +1463,8 @@ exports.examples = [
return <MultipleSourcesExample />;
},
},
/*
// Windows doesn't support legacy image format.
{
title: 'Legacy local image',
description: ('Images shipped with the native bundle, but not managed ' +
Expand All @@ -1480,6 +1479,7 @@ exports.examples = [
);
},
},
*/
{
title: 'Bundled images',
description: 'Images shipped in a separate native bundle',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,6 @@ describe('Image Tests', () => {
const dump = await dumpVisualTree('image-resize-mode');
expect(dump).toMatchSnapshot();
});
test('A legacy local image can still render', async () => {
const component = await app.findElementByTestID('image-legacy');
await component.waitForDisplayed({timeout: 5000});
const dump = await dumpVisualTree('image-legacy');
expect(dump).toMatchSnapshot();
});
test('An Image can have a custom blur radius', async () => {
const component = await app.findElementByTestID('image-blur-radius');
await component.waitForDisplayed({timeout: 5000});
Expand Down