Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React Native: how to get the names of all the albums

I would like the user to select an Album and then display the photos of it in react-native. There is the CameraRoll and it has the ability to filter by groupName, but I did not find a way of how to retrieve these groupNames. Does anybody know how to do this, or do I need to write a native plugin?

like image 429
Patrick Klitzke Avatar asked Sep 27 '16 22:09

Patrick Klitzke


1 Answers

well, at least you can select a lot of items and group...

import R from 'ramda';
import { CameraRoll } from 'react-native';
let groupNames;
CameraRoll.getPhotos({
    first:20000
}).then(
    (result) => {
        const groupNamesAr = R.map(
            (item) => {
                return item.node.group_name;
            }
        )(result.edges)
        groupNames = R.countBy((i)=>i)(groupNamesAr);
    }
)
like image 167
Bruno Reis Avatar answered Oct 15 '22 00:10

Bruno Reis