Reactjs 即使在导航之后,react本机图像选择器也应保持其图像

Reactjs 即使在导航之后,react本机图像选择器也应保持其图像,reactjs,react-native,react-native-android,react-native-image-picker,react-native-image,Reactjs,React Native,React Native Android,React Native Image Picker,React Native Image,实际上,我使用的是react原生图像选择器,有不同的页面。因此,当我在react native image picker中加载一个图像并导航到不同的页面并返回到相同的页面时,该图像不再存在。我希望在图像选择器中加载的图像应该得到维护 //这就是我设置照片状态的方式 handleChoosePhoto = () => { const options = { noData: true, } ImagePicker.showImagePicker(options, response =>

实际上,我使用的是react原生图像选择器,有不同的页面。因此,当我在react native image picker中加载一个图像并导航到不同的页面并返回到相同的页面时,该图像不再存在。我希望在图像选择器中加载的图像应该得到维护

//这就是我设置照片状态的方式

handleChoosePhoto = () => {
const options = {
  noData: true,
}
ImagePicker.showImagePicker(options, response => {
  console.log('Response = ', response);
  if (response.didCancel) {
    console.log('User cancelled image picker');
  } else if (response.error) {
    console.log('ImagePicker Error: ', response.error);
  } else {
    //let source = response;
    if (response.uri) {
      this.setState({ photo: response})
    }
  }

});
}


<Image
source={{ uri:this.state.photo.uri }}
style={styles.ImageIconStyle}/>
handleChoosePhoto=()=>{
常量选项={
野田:是的,
}
ImagePicker.showImagePicker(选项,响应=>{
log('Response=',Response);
if(response.didconcel){
log('User cancelled image picker');
}else if(response.error){
log('ImagePicker错误:',response.Error);
}否则{
//让源=响应;
if(response.uri){
this.setState({photo:response})
}
}
});
}

请在问题中添加相关代码添加代码。。。我希望图像应该得到维护,或者在导航到不同页面时,您可以说“持久化”。如何导航?使用
反应导航
?是书堆还是抽屉?您可以将所有这些添加到您的问题中,以及如何设置
state.photo
,否则,几乎无法帮助您更新问题,其次,我正在使用堆栈导航器进行导航请将相关代码添加到您的问题中添加代码。。。我希望图像应该得到维护,或者在导航到不同页面时,您可以说“持久化”。如何导航?使用
反应导航
?是书堆还是抽屉?您可以将所有这些添加到您的问题中,以及如何设置
state.photo
,否则,几乎无法帮助您更新问题,其次,我使用堆栈导航器进行导航