gpt4 book ai didi

react-native - react native NativeModule.ImagePickermanager 为空

转载 作者:行者123 更新时间:2023-12-05 09:12:57 25 4
gpt4 key购买 nike

我正在尝试使用 react-native-image-picker,但出现错误:NativeModule.ImagePickermanager 为空。

import React, { Component } from 'react';
import { Text, View, StyleSheet, Alert, PixelRatio, Image } from 'react-native';
import ImagePicker from 'react-native-image-picker';
...
handleChoosePhoto = () => {
const options = {
noData: true,
};
ImagePicker.launchImageLibrary(options, response => {
if (response.uri) {
this.setState({ photo: response });
}
});
};

...

<View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
{this.state.photo && (
<Image
source={{ uri: this.state.photo.uri }}
style={{ width: 300, height: 300 }}
/>
)}
<Button title="Choose Photo" onPress={this.handleChoosePhoto} />
</View>

我尝试运行 react-native link react-native-image-picker。当我运行这个命令时,没有任何反应。它不会在终端中显示任何内容。我正在使用 IOS 模拟器。

最佳答案

过去 8 小时以来,我一直在尝试解决此错误,但未能成功。请使用 expo 的 ImagePicker,这是它的链接。 https://docs.expo.io/versions/latest/sdk/imagepicker/它将解决您的错误。

关于react-native - react native NativeModule.ImagePickermanager 为空,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57150681/

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