null不是本机中Cameraroll中的对象(正在评估'_nativeInterface.default.getPhotos')

问题描述 投票:3回答:1

使用来自本地社区的相机胶卷库并导入正确命名的相机。下面是使用expo目录初始化项目的相同代码]

import { ActionSheetIOS, ListView, StyleSheet, Text, TouchableOpacity, View, Platform} from 'react-native';
import { Navigator } from 'react-native-deprecated-custom-components';
import PhotoBrowser from 'react-native-photo-browser';
import CameraRoll from "@react-native-community/cameraroll";


const Photos= [
  {
    title: 'A',
    description: 'Photo to display',
    enableGrid: false,
    media: [{
      photo: 'A',
      title: 'A',
    }],
  }
];


CameraRoll.getPhotos({
  first: 30,
  assetType: 'Photos',
}).then((data) => {
  const media = [];
  data.edges.forEach(d => media.push({
    photo: d.node.image.uri,
  }));
  Photos[2].media = media;
}).catch();

请建议解决以上问题,谢谢

react-native react-redux react-native-navigation react-native-camera react-native-community-netinfo
1个回答
0
投票

对我来说,手动链接模块可以完成这项工作。 react-native link @react-native-community/cameraroll

© www.soinside.com 2019 - 2024. All rights reserved.