natysoz / expo-images-picker

Multiple Asset Photos Videos selecting package for Expo SDK
MIT License
95 stars 35 forks source link

Add option to modify number of assets to load first #29

Closed minhna closed 3 years ago

minhna commented 3 years ago

Hi, Thank you for your useful library. I have a little issue with this current setup, on my android device which is running expo go, it takes more than 6 seconds to wait function loadAssets() finished. It's a little bit too long. I tried to test the first option. If I change the the first param to 60, it only took less than 2 seconds. Thank you.

const getAssets = () => {
    try {
        if (availableOptions.hasNextPage) {
        const params: AssetsOptions = {
            first: 200, // => could you add option to modify this?
            mediaType: assetsType,
            sortBy: ['creationTime'],
        }
        if (availableOptions.after)
            params.after = availableOptions.after
        if (!availableOptions.hasNextPage) return

        return permissions.hasMediaLibraryPermission
            ? loadAssets(params)
            : getMediaLibraryPermission()
        }
    } catch (err) {
        // need to add component that display where there is an error
        // show it when any error happen and wrap any place that can have
        // err with try and catch block
    }
}
natysoz commented 3 years ago

yes

natysoz commented 3 years ago

add on version 1.4.1 https://www.npmjs.com/package/expo-images-picker