how to get notified in react native if specific folder have file created or deleted

Viewed 25

hello i am new in React-Native i have application that Download Multyple Files from URL and Store in aplication storage and Display it in FlatList

i use StackNavigator for display two tab

first Tab for Display Running/progress Download Files List

and Second Tab for Display Finished downloaded Files List

i used react-native-fs for download files from url

and get files list from download path for display in list

const [fileList, setFileList] = useState([{}]);

RNFS.readDir(appFolderPath)
  .then(files => {
      setFileList(files);
  })
  .catch(err => {
    console.log(err.message, err.code);
  });

this called infinite because everytime setFileList(files); set files and its refresh screen

how to get notyfied only and only if any download is finish or folder have new file ?

0 Answers
Related