RNCameraRoll is a replacement CameraRoll module for React Native that offers consistent behaviour across iOS and Android
npm i react-native-cameraroll --save
import RNCameraRoll from 'react-native-cameraroll';
Retrieve image and/or video assets from the device's Camera Roll.
RNCameraRoll.getAssets({ assetType: 'image', limit: 20 })
.then(response => console.log(response))
.catch(err => console.error(err));
params
takes the following shape:
{
assetType: 'image' | 'video' | 'all';
limit: number; // How many assets to return
start?: string | number; // The start cursor (use end_cursor from previous request)
}
The response takes the following shape:
{
assets: [{
filename: string;
height: number;
location: {
altitude?: number;
heading?: number;
latitude: number;
longitude: number;
speed?: number;
};
timestamp: number;
type: 'image' | 'video';
uri: string;
width: number;
}],
page_info: {
end_cursor: string | number;
has_next_page: boolean;
start_cursor: string | number;
};
}
We welcome any contribution to the repository. Please ensure your changes to the JavaScript code follow the styling guides controlled by ESlint. Changes to native code should be kept clean and follow the standard of existing code.
- MIT