mockingbot / react-native-zip-archive

Zip archive utility for react-native
MIT License
425 stars 155 forks source link

react-native-zip-archive TypeError: Cannot read property 'zipFolder' of null #308

Closed Arif-Shahriar028 closed 2 months ago

Arif-Shahriar028 commented 3 months ago

I am trying to zip a folder in react-native using react-native-zip-archive. But there is an error: TypeError: Cannot read property 'zipFolder' of null. I have no idea whats going wrong.

This is my code snippet:

      const targetPath = `${RNFS.DownloadDirectoryPath}/myFile.zip`
      const sourcePath = RNFS.DownloadDirectoryPath

      console.log("targetpath: ", targetPath)
      console.log("Sourcepath: ", sourcePath)

      try {
        zip(sourcePath, targetPath)
          .then((path) => {
            console.log(`zip completed at ${path}`)
          })
          .catch((error) => {
            console.error(error)
          })
      } catch (error) {
        console.error(`Error in zip: ${error}`);
      }

I am getting an error like this:

image

Can anyone give any idea whats going wrong?

plrthink commented 2 months ago

Can you confirm you're linking correctly? Or maybe you're forgetting to run pod install in the ios folder of your app? Or you're using expo?

Arif-Shahriar028 commented 2 months ago

@plrthink thanks for your response!

I opened this issue one month ago, that time I was failed to solve this issue. I was using expo. I couldn't figure out what I did wrong. By the way, then I wrote a basic java module for zip and unzip for android and used this java module by NativeModule of react-native.

plrthink commented 2 months ago

@plrthink thanks for your response!

I opened this issue one month ago, that time I was failed to solve this issue. I was using expo. I couldn't figure out what I did wrong. By the way, then I wrote a basic java module for zip and unzip for android and used this java module by NativeModule of react-native.

I wish I could reply early.😔