简体   繁体   English

无法使用 react-native android 从内部存储读取图像

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

I can't read image file when i pass "file://" in uri当我在 uri 中传递“file://”时,我无法读取图像文件

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

Have a try by adding the below tag inside the application tag in the AndroidManifest file:尝试在AndroidManifest文件的应用程序标签内添加以下标签:

android:requestLegacyExternalStorage="true"

For Example:例如:

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

Also, make sure that you are asking the users for storage permissions .此外,请确保您正在向用户询问存储权限

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM