Raiyan Khalil Shuvo
Raiyan Khalil Shuvo

Reputation: 17

Can't read image from internal storage using react-native android

I can't read image file when i pass "file://" in uri

<View>
  <Text>
    YOLO
  </Text>
  <Image
    style={styles.tinyLogo}
    source={{
      uri: "file:///storage/emulated/0/DCIM/Screenshots/Fun.jpg",
    }}
  />
</View>

Upvotes: 0

Views: 2158

Answers (1)

Jignesh Mayani
Jignesh Mayani

Reputation: 7193

Have a try by adding the below tag inside the application tag in the AndroidManifest file:

android:requestLegacyExternalStorage="true"

For Example:

<application
    // ...
    android:requestLegacyExternalStorage="true"
>
//...
</application>

Also, make sure that you are asking the users for storage permissions.

Upvotes: 1

Related Questions