Currently i am fetching memory issue because i am loading direct image in Flatlist of React Native. Issue is that due to high resolutions images memory limit reached and app get crashed on iPhone. Is there any way i can fetch direct thumb url like image url (e.g. url: 'assets-library://asset/asset.JPG?id=5BECA80C-33B3-46A0-AE44-CF28A838CECF&ext=JPG',) ?
Currently i am using 'React-native-photo-framework'.
getAssets
takes a prepareForSizeDisplay
prop. This uses PHCachingImageManager
to request images of assets at a specified size.
Example:
RNPhotosFramework.getAssets({
startIndex: 0,
endIndex: 100,
prepareForSizeDisplay: Rect(100,100),
fetchOptions: {
sourceTypes: ['userLibrary'],
sortDescriptors: [{
key: 'creationDate',
ascending: true,
}]
}
}).then((response) => console.log(response.assets));
When the user taps the row in your FlatList
, you can then fetch the full-size asset. Don't fetch the full-size asset until you need to display it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With