Introduction
A React Native module that allows you to fetch and manage audios, images, vidoes.
🚫
This library does not support IOS as of now.
Basic Example
.then
import { getAssets } from 'rn-media-library';
// ...
// call the function inside the useEffect on mount and set the state
getAssets({ mediaType: 'audio' })
.then((res) => {
//parse and set the value in the state
setAssets(JSON.parse(res));
})
.catch((error) => {
console.log(error);
});
Async/Await
import { getAssets } from 'rn-media-library';
// call the function inside the useEffect on mount and set the state
const fetchAssets = async () => {
try {
const res = await getAssets({ mediaType: 'audio' });
//parse and set the value in the state
setAssets(JSON.parse(res));
} catch (error) {
console.log(error);
}
};