微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

将项目内的图像保存到设备本地

如何解决将项目内的图像保存到设备本地

enter image description here

这是我保存的代码,不能在发布模式下运行,而是在调试模式下运行,在转换后,我的uri似乎无效。

 if (result['android.permission.WRITE_EXTERNAL_STORAGE']) {
    const exampleImageUri = 
    Image.resolveAssetSource(this.props.images[this.props.currIndex].uriBK).uri;
    RNFS.downloadFile({
      fromUrl: exampleImageUri,toFile: imagePath,})
      .promise.then(() => {
        this.setState({ source: { uri: imagePath } });
        showMessage({
          message: 'Đã lưu',type: 'success',animated: true,backgroundColor: '#015cd0',textStyle: {
            fontFamily: 'OpenSans-Regular',textAlign: 'center',},});
      })
      .catch(e => console.log('e: ',e));

这是uri在转换调试后找到但释放后找不到 http:// localhost:8081 / assets / assets / images / 22.png?platform = android&hash = c94e41e671e252c60449ebd5d490ba74

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。