Log image load errors (#47419)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47419

Minor improvements to `ImageExample` so we log when images fail to load. Also replaces a `Text` component with `RNTesterText` so it's legible.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D65363864

fbshipit-source-id: 6c7ce8d5af6aabfed21479c784911bdcffe4684e
This commit is contained in:
Peter Abbondanzo
2024-11-07 07:53:01 -08:00
committed by Facebook GitHub Bot
parent 7817ab5de2
commit 425093863c
@@ -131,6 +131,11 @@ class NetworkImageCallbackExample extends React.Component<
<Image
source={this.props.source}
style={[styles.base, styles.visibleOverflow]}
onError={event => {
this._loadEventFired(
`✘ onError "${event.nativeEvent.error}" (+${Date.now() - mountTime}ms)`,
);
}}
onLoadStart={() =>
this._loadEventFired(`✔ onLoadStart (+${Date.now() - mountTime}ms)`)
}
@@ -465,7 +470,9 @@ class FadeDurationExample extends React.Component<
</Text>
</View>
<Image fadeDuration={1500} source={loadingImage} style={styles.base} />
<Text>This image will fade in over the time of 1.5s.</Text>
<RNTesterText>
This image will fade in over the time of 1.5s.
</RNTesterText>
</View>
);
}