onError 方法没走 只console.warn了 怎么处理啊
import {Image, StyleSheet, View, NativeModules} from 'react-native';
import Logo from '@assets/images/ETH.png';
const ImageDemo = () => {
return (
<View style={styles.root}>
{/* <Image
style={styles.img}
source={{
uri: 'xxxx.xx.x.jpg',
// uri: 'https://p3-passport.byteimg.com/img/user-avatar/170a015bb855cc1b161ea34097870caf~180x180.awebp',
}}
// blurRadius={3}
defaultSource={Logo}
// fadeDuration={10000}
onLoad={() => {
console.log('onLoadssss...');
}}
onError={() => {
console.log('onError...');
}}
/> */}
<Image
style={styles.img}
source={{
uri: 'https://example.com/invalid-image.png',
}}
onError={() => {
console.log('Image load failed');
}}
/>
<Image source={Logo} fadeDuration={10000} />
{/* <Image source={require('@assets/images/ETH.png')} /> */}
</View>
);
};
const styles = StyleSheet.create({
root: {
width: '100%',
height: '100%',
backgroundColor: '#eee',
},
img: {
width: 300,
height: 400,
backgroundColor: '#ddd',
resizeMode: 'contain',
},
});
export default ImageDemo;