import ImagePicker from 'react-native-image-picker';
const options = {
title: 'Select Image',
takePhotoButtonTitle:'take a photo',
chooseFromlibraryButtonTitle:'choose from gallery',
quality:1
};
class Upload extends Component <{}>{
static navigationOptions = { header: null }
constructor(){
super()
this.state ={
ImageSource:null
}
}
selectPhoto(){
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 = { uri: response.uri };
this.setState({
ImageSource: source,
});
}
});
}
- 如何在本机反应中显示带有图像的视频并使用 video soucr uri 状态仍然只显示图像 2.and 如果使用媒体类型仍然显示图像如何解决这个问题