如何获取rct-image-store的图像URL以通过api上传图像

Aak*_*del 13 react-native

如何从rct-image-store获取图片网址?我使用ImageEditingManager裁剪图像,它返回rct-image-store:// 0.现在我需要将此图像上传到服务器.如何获取图像的URL以便我可以上传它?

这是我使用的代码

  ImageEditingManager.cropImage(
        photoURI,
        transformData,
        (croppedImageURI) => {
          console.log('crop success', croppedImageURI);
        },
        (cropError) => console.log('cropMyError', cropError)
      );
    },
    (error) => undefined,
  );
Run Code Online (Sandbox Code Playgroud)

croppedImageURI被记录为

RCT-图像店内:// 0

如何获取此图像的URL以便将其上传到api服务器?

小智 -5

var testDemo = React.createClass({
    getInitialState() {
            return {
                imageURISource: {
                    uri: 'http://facebook.github.io/react/img/logo_og.png'
                }
            }
        },

        render: function() {
            return (
                <View style={styles.container}>
                <Image
                    style={{height:250,width:300, borderColor: '#f099f0',borderRadius:3}}
                    source= {this.state.imageURISource}
                    />

                ImageEditingManager.cropImage(
                        photoURI,
                        transformData,
                        (croppedImageURI) => {
                                console.log('crop success', croppedImageURI);
              
                                //get croppedImageURI and set, it will update Image
                                this.setState({imageURISource: {uri:croppedImageURI}})
                                
                        },
                        (cropError) => console.log('cropMyError', cropError)
                );
                    
            </View>
            );
        },

});
Run Code Online (Sandbox Code Playgroud)