【发布时间】:2020-01-17 21:10:30
【问题描述】:
不知道这是因为 react native 版本还是其他原因导致了这种情况发生。所以我刚刚将我的 android 应用程序与 React Native 集成并迁移到 AndroidX。在我进行集成和迁移之前,这段代码非常好,我得到了结果和一切。但是,整合和迁移后,我只能从图片列表中查看和点击照片,没有结果,console.log() 不起作用,甚至我在catch 块上也没有任何错误
我正在使用来自 https://github.com/Elyx0/react-native-document-picker 的 react-native-document-picker 和 React Native 0.60.5
我试过使用这个不同的库https://www.npmjs.com/package/react-native-file-picker,但问题是一样的
try {
const res = await DocumentPicker.pick({
type: [DocumentPicker.types.images],
});
console.log(res) //not showing anything
if (res.size <= 3145728) {// 3 MB
dispatch({
type: ACTION_TYPE_PICK_PHOTO_PROFILE_SUCCESS,
payload: res,
});
} else {
dispatch({
type: ACTION_TYPE_PICK_PHOTO_PROFILE_EXCEED,
payload: res
});
}
} catch (err) {
console.log(err) //not showing anything
if (DocumentPicker.isCancel(err)) {
// User cancelled the picker, exit any dialogs or menus and move on
}
}
任何帮助都会很棒!提前致谢。
【问题讨论】:
标签: javascript android react-native androidx