gpt4 book ai didi

ios - 无法在 native iOS 中读取未定义的属性 showImagePicker

转载 作者:行者123 更新时间:2023-11-28 20:54:28 26 4
gpt4 key购买 nike

我已经厌倦了这个问题

  1. npm install react-native-image-picker@latest --save
  2. react-native 链接 react-native-image-picker

从“react-native-image-picker”导入 ImagePicker;

const options = {
quality: 1.0,
maxWidth: 500,
maxHeight: 500,
storageOptions: {
skipBackup: 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 if (response.customButton) {
console.log('User tapped custom button: ', response.customButton);
} else {
const source = { uri: response.uri };

// You can also display the image using data:
// const source = { uri: 'data:image/jpeg;base64,' + response.data };

this.setState({
avatarSource: source,
});
}
});[enter image description here][1]

最佳答案

每次运行 link 命令都需要重启 packager 才能生效。只需取消正在运行的 packager 并再次运行 react-native run-ios

关于ios - 无法在 native iOS 中读取未定义的属性 showImagePicker,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54022160/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com