小编Dha*_*ngh的帖子

React Native - Is there any way to find/search all images (.jpg/.png) from the external/internal storage?

I am new to react-native development and using RNFetchBlob to work with files in internal storage, I wanted to create a gallery application and for that I need to fetch all the images present in the phone.

What i was able to do is fetch all files from a particular directory and search for images in it.

RNFetchBlob.fs.ls(RNFetchBlob.fs.dirs.DCIMDir).then((files) => {
        //Returns all files present in the directory
        console.log(files);
        //Returns files with .png or .jpg extension.            
        console.log(files.find((element) => {return element.match('/(.png)$|(.jpg)$|(.jpeg)$/g')}));

    }).catch((err) …
Run Code Online (Sandbox Code Playgroud)

javascript react-native

5
推荐指数
1
解决办法
311
查看次数

标签 统计

javascript ×1

react-native ×1