I get this error "TypeError: null is not an object (evaluating '_nativeInterface.default.getPhotos')" when trying to get photos from cameraroll. I made sure all the permission are there for android and ios. installed necessary pods for ios and library is linked as well. Tried bunch of suggestions on git and StackOverflow and still no luck.
import {
View,
Text,
StyleSheet,
TouchableOpacity,
ActivityIndicator,
Image,
FlatList,
Dimensions,
} from 'react-native';
import CameraRoll from '@react-native-community/cameraroll';
class AvatarBioScreen extends PureComponent {
state = {
images: [],
loading: false,
selected: null,
hasNextPage: false,
endCursor: '',
firstQuery: true,
};
componentDidMount() {
this._getPhotos();
}
_getPhotos = async after => {
if (this.state.firstQuery) {
this.setState({loading: true});
}
const res = await CameraRoll.getPhotos({
first: 20,
after,
});
this.setState({
images: [...this.state.images, ...res.edges],
loading: false,
hasNextPage: res.page_info.has_next_page,
endCursor: res.page_info.end_cursor,
firstQuery: false,
});
console.log('====================================');
console.log('res', res);
console.log('====================================');
};
}```
Your code is good. Make sure you run pod install because this error occurs in the module when it cannot find this component