react-native-thumbnail
react-native-thumbnail copied to clipboard
Return resized thumbnail (only Android)
Added getResized(String filePath, Integer maxSize, Promise promise)
This will return the thumbnail resized to size that will not exceed (width or height) the maxSize parameter.
For our case-use we needed an way to optimise the loading of the thumbnails in an FlatList. And one of the steps was to resize theme to a smaller one based on the device screen and not load an 1080 thumbnail when we just need an 400.
The usage will be similar to the other function with the exception of an additional parameter which will define the size of the thumbnail.
import RNThumbnail from 'react-native-thumbnail';
RNThumbnail.getResized(filepath, 400).then((result) => {
console.log(result.path); // thumbnail path
})
This will work only for Android!