Skip to content

Commit 4e6cf2c

Browse files
cipolleschifacebook-github-bot
authored andcommitted
Wait for images before box-shadow screenshots
Summary: Changelog: [Internal] Expose the box-shadow example test identifier only after all three images have loaded. The E2E navigation helper now waits for stable image content before capturing the screenshot, and the Nougat golden reflects the complete example. Differential Revision: D115740465
1 parent ebe758b commit 4e6cf2c

1 file changed

Lines changed: 36 additions & 28 deletions

File tree

packages/rn-tester/js/examples/Image/ImageExample.js

Lines changed: 36 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1258,6 +1258,41 @@ exports.category = 'Basic';
12581258
exports.description =
12591259
'Base component for displaying different types of images.';
12601260
1261+
component BoxShadowExample() {
1262+
const [loadedImageCount, setLoadedImageCount] = useState(0);
1263+
const onLoad = () => setLoadedImageCount(count => count + 1);
1264+
1265+
return (
1266+
<View
1267+
style={styles.horizontal}
1268+
testID={loadedImageCount >= 3 ? 'box-shadow-example' : undefined}>
1269+
<Image
1270+
onLoad={onLoad}
1271+
style={[styles.base, styles.boxShadow, styles.boxShadowWithBackground]}
1272+
source={smallImage}
1273+
/>
1274+
<Image
1275+
onLoad={onLoad}
1276+
style={[
1277+
styles.base,
1278+
styles.boxShadow,
1279+
styles.boxShadowMultiOutsetInset,
1280+
]}
1281+
source={smallImage}
1282+
/>
1283+
<Image
1284+
onLoad={onLoad}
1285+
style={[
1286+
styles.base,
1287+
styles.boxShadow,
1288+
styles.boxShadowAsymetricallyRounded,
1289+
]}
1290+
source={fullImage}
1291+
/>
1292+
</View>
1293+
);
1294+
}
1295+
12611296
exports.examples = [
12621297
{
12631298
title: 'Plain Network Image with `source` prop.',
@@ -1488,34 +1523,7 @@ exports.examples = [
14881523
title: 'Box Shadow',
14891524
name: 'box-shadow',
14901525
render: function (): React.Node {
1491-
return (
1492-
<View style={styles.horizontal} testID="box-shadow-example">
1493-
<Image
1494-
style={[
1495-
styles.base,
1496-
styles.boxShadow,
1497-
styles.boxShadowWithBackground,
1498-
]}
1499-
source={smallImage}
1500-
/>
1501-
<Image
1502-
style={[
1503-
styles.base,
1504-
styles.boxShadow,
1505-
styles.boxShadowMultiOutsetInset,
1506-
]}
1507-
source={smallImage}
1508-
/>
1509-
<Image
1510-
style={[
1511-
styles.base,
1512-
styles.boxShadow,
1513-
styles.boxShadowAsymetricallyRounded,
1514-
]}
1515-
source={fullImage}
1516-
/>
1517-
</View>
1518-
);
1526+
return <BoxShadowExample />;
15191527
},
15201528
},
15211529
{

0 commit comments

Comments
 (0)