TypeError: null is not an object (evaluating 'RNFetchBlob.DocumentDir'). After importing RNFetchBlob this error is coming can anyone please help me

Viewed 934

TypeError: null is not an object (evaluating 'RNFetchBlob.DocumentDir') Anyone can help me out with this error please RNFetchblob i have installed and imported successfully also.

import RNFetchBlob from 'rn-fetch-blob';
const downloadImage = () => {
        let date = new Date()
        let image_URL = IMAGE_PATH
        let ext = getExtention(image_URL)
        ext = '.' + ext[0]
        const { config, fs } = RNFetchBlob
        let PictureDir = fs.dirs.PictureDir
        let options = {
            fileCache: true,
            addAndroidDownloads: {
                useDownloadManager: true,
                notification: true,
                path: PictureDir + '/image_' +
                    Math.floor(date.getTime() + date.getSeconds() / 2) + ext,
                description: 'Image'
            }
        }
        config(options)
            .fetch('GET', image_URL)
            .then(res => {
                console.log('res -> ', JSON.stringify(res))
                alert('Image Donwload Successfully')
            })
    }
1 Answers

This issue is solved here in the component documentation [https://github.com/joltup/rn-fetch-blob/issues/422][1]

Related