Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/472.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 对CameraRoll getPhotos回调响应本机无效密钥_Javascript_Reactjs_React Native - Fatal编程技术网

Javascript 对CameraRoll getPhotos回调响应本机无效密钥

Javascript 对CameraRoll getPhotos回调响应本机无效密钥,javascript,reactjs,react-native,Javascript,Reactjs,React Native,我对React比较陌生,我正在尝试让我的React本机应用程序访问来自相机卷的图像,但我不断收到一个错误,该错误表示,“CameraRoll.getPhotos回调”提供的props.image键'filename'无效,,无法找到修复方法 这是我的密码: 导出默认类App扩展React.Component{ 建造师(道具){ 超级(道具); 此.state={ 图像:[], }; } storeImages(数据){ const assets=data.edges; const images

我对React比较陌生,我正在尝试让我的React本机应用程序访问来自相机卷的图像,但我不断收到一个错误,该错误表示,“CameraRoll.getPhotos回调”提供的props.image键'filename'无效,,无法找到修复方法

这是我的密码:

导出默认类App扩展React.Component{
建造师(道具){
超级(道具);
此.state={
图像:[],
};
}
storeImages(数据){
const assets=data.edges;
const images=assets.map(asset=>asset.node.image);
这是我的国家({
图像:图像,
});
}
logImageError(错误){
控制台日志(err);
}
onButtonPress(){
常量fetchParams={
第一:3,,
};
CameraRoll.getPhotos(fetchParams、this.storeImages、this.logImageError);

}
那篇文章已经有2年的历史了,从那时起,相机镜头已经改变了。我还没有真正使用过它,但我相信你必须这样设置它:

export default class App extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      images: [],
    };
  }

  onButtonPress = () => {
    const fetchParams = {
      first: 3,
    };

    CameraRoll.getPhotos(fetchParams) //Use promises instead of callbacks
      .then((data) => {
        const assets = data.edges;
        const images = assets.map( asset => asset.node.image );
        this.setState({
          images: images,
        });
      })
      .catch(err => console.log(err));
  }