Image displayed as white in react native

614 Views Asked by At

I am using react-native-image-crop-picker to upload images from my device to the backend server. I am able to upload and save images to the server successfully. But If I sign out from my application and sign in back, the image filed is showing as white color instead of uploaded image.

Image has been saved to the backend with the path as file:///data/user/0/com.project/cache/react-native-image-crop-picker/IMG_20201209_230314.jpg.

My code


<ImageBackground resizeMode={'contain'}
    source={this.state.loadingImage ?
    { uri:`${this.state.filePath}` }
    :
    { uri: 'data:image/jpeg;base64,' + this.state.filePath.data }}
    style={styles.previewImage} >
</ImageBackground>

styles

 previewImage: {
    width: 450,
    height: 350,
    alignItems: 'baseline',
  },

The image container is marked as a red box. Inside that red box, image should be displayed

enter image description here

0

There are 0 best solutions below