React native 图像选择器无法在计算机上找到驱动器

React native 图像选择器无法在计算机上找到驱动器,react-native,photo,imagepicker,React Native,Photo,Imagepicker,我开始使用Imagepicker。 因此,我使用图像选择器控件并设法对其进行配置,而不是在上传时显示选定的图像,它显示“设备文件夹”,并且非常空 像这样 我的代码如下所示: import React, { Component } from 'react'; import { Platform, StyleSheet, Text, View , Image, TextInput, TouchableOpacity, Alert, Linking, AsyncStorage} from 'reac

我开始使用Imagepicker。 因此,我使用图像选择器控件并设法对其进行配置,而不是在上传时显示选定的图像,它显示“设备文件夹”,并且非常空

像这样

我的代码如下所示:

import React, { Component } from 'react';
import { Platform, StyleSheet, Text, View , Image, TextInput, TouchableOpacity, Alert, Linking, AsyncStorage} from 'react-native';
import {ScrollView} from 'react-native-gesture-handler';
import * as ImagePicker from "react-native-image-picker";

export default class UploadPhoto extends Component {
  constructor(props) {
    super(props);
    this.state = {
        photo :null,
    };
  }

  ChoosePhoto = () =>{
      const options ={
          nodata : true
      };
    ImagePicker.launchImageLibrary(options, response =>{
        if(response.uri){
            this.setState({photo: response});
        }
    });
  }

  render() {
      const {photo} = this.state;
    return (
      <View styles={styles.container}>
        <ScrollView contentContainerStyle={{ justifyContent: 'space-between',alignItems:'center' }}>
            <View>
                <Text>
                {"\n"}
                {"\n"}
                {"\n"}
                {"\n"}
                {"\n"}
                {"\n"}
                {photo &&(
                    <Image source={{uri: photo.uri}}
                    style={{width :300, height: 300}}
                    />
                )}
                </Text>
            </View>
        <TouchableOpacity onPress={() => {this.ChoosePhoto();}} style={styles.button}>
        <Text style={styles.loginbtn}> Choose Photo </Text>
         </TouchableOpacity>
        </ScrollView>
      </View>
    );
  }
}


const styles = StyleSheet.create({
    container:{
        flex: 1,
        flexDirection:'row',
        justifyContent: 'space-between'
    },

    input:{
        width:300,
        height:55,
        margin:10,
        fontSize : 19,
        fontWeight : 'bold',
        borderBottomColor:'#030303',
        borderBottomWidth: 1,
        marginBottom: 30,
    },

    button:{
        width:300,
        height:52,
        padding:10,
        borderRadius:10,
        backgroundColor:'#030303',
        alignItems: 'center'
    },

    Regbutton:{
        width:300,
        height:52,
        padding:10,
        borderRadius:10,
        backgroundColor:'#ffffff',
        alignItems: 'center',
        borderWidth : 2,
        borderColor: '#030303'
    },

    loginbtn:{
        color:'#ffff',
        fontSize : 20,
        fontWeight : 'bold'
    },

    AccountBalance:
    {
        fontSize : 13,
        fontWeight : 'bold',
        textAlign : 'left'
    },

    loginbtn2:{
        color:'#030303',
        fontSize : 20,
        fontWeight : 'bold'
    },

    logo:{
    width:150,
    height:150
    },

    space: {
        width: 10, 
        height: 20,
      },

    space2:{
        width: 10, 
        height: 10,
    },

      imageStyle: {
        flexDirection:'row',
        justifyContent:'center',
        padding: 5,
        margin: 2,
        height: 15,
        width: 15,
        resizeMode: 'stretch',
        marginBottom: 8,
        marginTop : 8,
        alignItems: 'center',
      },
});
import React,{Component}来自'React';
从“react native”导入{平台、样式表、文本、视图、图像、文本输入、TouchableOpacity、警报、链接、异步存储};
从“反应本机手势处理程序”导入{ScrollView};
从“react native image picker”导入*作为ImagePicker;
导出默认类UploadPhoto扩展组件{
建造师(道具){
超级(道具);
此.state={
照片:空,
};
}
选择照片=()=>{
常量选项={
野田:是的
};
ImagePicker.launchImageLibrary(选项,响应=>{
if(response.uri){
this.setState({photo:response});
}
});
}
render(){
const{photo}=this.state;
返回(
{“\n”}
{“\n”}
{“\n”}
{“\n”}
{“\n”}
{“\n”}
{照片&&(
)}
{this.ChoosePhoto();}}}style={styles.button}>
选择照片
);
}
}
const styles=StyleSheet.create({
容器:{
弹性:1,
flexDirection:“行”,
justifyContent:“间距”
},
输入:{
宽度:300,
身高:55,
差额:10,
尺码:19,
fontWeight:'粗体',
borderBottomColor:“#030303”,
边界宽度:1,
marginBottom:30,
},
按钮:{
宽度:300,
身高:52,
填充:10,
边界半径:10,
背景颜色:“#030303”,
对齐项目:“中心”
},
注册表按钮:{
宽度:300,
身高:52,
填充:10,
边界半径:10,
背景颜色:“#ffffff”,
对齐项目:“居中”,
边界宽度:2,
边框颜色:“#030303”
},
登录名:{
颜色:“#ffff”,
尺寸:20,
fontWeight:“粗体”
},
账户余额:
{
尺寸:13,
fontWeight:'粗体',
textAlign:'左'
},
loginbtn2:{
颜色:“#030303”,
尺寸:20,
fontWeight:“粗体”
},
标志:{
宽度:150,
身高:150
},
空间:{
宽度:10,
身高:20,
},
空间2:{
宽度:10,
身高:10,
},
图像样式:{
flexDirection:“行”,
辩护内容:'中心',
填充:5,
差额:2,
身高:15,
宽度:15,
resizeMode:'拉伸',
marginBottom:8,
玛金托普:8,
对齐项目:“居中”,
},
});
我有什么遗漏吗?这对我来说是很新鲜的。我不知道从哪里开始