react-native-cameraroll: CameraRoll.getPhotos with 'after' not working on Android sdk version 30
CameraRoll.getPhotos with ‘after’ not working on Android sdk version 30
const params = {
first: 10,
assetType: 'Photos'
}
if (endCursor) {
params.after = endCursor;
}
const response = await CameraRoll.getPhotos(params);
It’s always return 10 first photos
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 19
- Comments: 26 (1 by maintainers)
As a quick solution try installing my fork which does resolve issue on sdk 30 pagination for my purposes. I’m not sure about sorting, I do use only newest to oldest one, which also works. Edit: I’m not going to edit the fork till the package itself will fix the issue, so don’t worry about it.
https://github.com/react-native-cameraroll/react-native-cameraroll/issues/359#issuecomment-982648571
That fork work well. Someone merge please.
Same issue 😦
We had some issues with this as well on SDK 30. What seem to work: we moved the sorting of the query in to a bundle property
QUERY_ARG_SQL_SORT_ORDER
which is passed along with the content resolver query.Example:
Well, You need to increment the
first
param byendCursor
, and this getPhotos function will fetch you more photos. You will need to check for duplicates of these photos. I have made a function to solve the problem temporarily:@jaspermeijaard its work correctly only if i get photos from specific album. If i try to get “All” photos, they sorting randomly(
Same issue here, sdk 30 android.