How to use reaction on own image onError to receive an error message?

I am using native v0.44 component for android, but the image cannot load, the code:

<View style={styles.slide1} key={index}> <Image style={styles.image} resizeMode = 'contain' onError = {(e)=>{ console.log(e) }} source={{uri:`http://i01.appmifile.com/webfile/globalimg/hk/cms/92247F5D-CC6E-273F-5710-841E891CB96F.jpg`}} /> </View> 

the image cannot show, the onError handler gets an error, but how do you know what error is in the loading image?

+5
source share
1 answer

Your onError function, as it should be.

But remember that when using a remote image, you need to determine the width and height of the image.

-1
source

Source: https://habr.com/ru/post/1268601/


All Articles