when i use the api-imagepicker with expo , the bug is :can’t find variable :true. and i can’t get the picture
this is my code
import React , { Component } from “react”;
import { Text , div , Image } from ‘react-native’;
import { View , Button , WhiteSpace , List } from “antd-mobile”;
import { ImagePicker } from ‘expo’;
class Basicinfo extends Component
{
static navigationOptions = {
title:'基本资料'
};
state = {
files : [],
files1 : [],
multiple : false,
image : null
}
onChange = (files, type, index) => {
console.log(files, type, index);
this.setState({
files,
});
};
onChange1 = (files1, type, index) => {
console.log(files1, type, index);
this.setState({
files1,
});
};
_pickImage = async () =>
{
let result = await ImagePicker.launchImageLibrearyAsync({
allowsEditing : ture ,
aspect :[ 4 , 3 ],
});
console.log( result );
if( !result.cancelled )
{
this.setState( { image: result.url } );
}
};
render()
{
const { files } = this.state;
const { image } = this.state;
const { files1 } = this.state;
return (
<View style={{ flex: 1, alignItems: 'center' , }} >
<WhiteSpace/>
<Button
onClick={this._pickImage}
>pickImage</Button>
{image &&
<Image source={{ uri: image }} style={{ width: 200, height: 200 }} />}
</View>
);
}
}
“dependencies”: {
“antd-mobile”: “^2.1.6”,
“antd-mobile-demo-data”: “^0.2.0”,
“expo”: “^25.0.0”,
“react”: “16.2.0”,
“react-dom”: “^16.3.1”,
“react-native”: “0.52.0”,
“react-native-modal-dropdown”: “^0.6.2”,
“react-native-storage”: “^0.2.2”,
“react-navigation”: “1.5.9”,
“react-router-native”: “^4.2.0”
}
thinks for your help !