React-native-fs: undefined is not an object (evaluating 'RNFSManager.RNFSFileTypeRegular')

Created on 22 Mar 2017  路  9Comments  路  Source: itinance/react-native-fs

I get the following error in RN 0.41.2: undefined is not an object (evaluating 'RNFSManager.RNFSFileTypeRegular')

I'm trying to use the library in iOS only!

I have linked react-native-fs:
rnpm-install info Android module react-native-fs is already linked rnpm-install info iOS module react-native-fs is already linked

Can you help with that?

Thanks!

Most helpful comment

You should rebuild app.

All 9 comments

You should rebuild app.

I have same issue with JEST testing.

Any news on this? Could you solve in the meanwhile, @barzev?

I'm sorry, I solved my problem by going a completely different route.

I have this issue, too. Anyone can help me?

+1

I have this issue, too. Anyone can help me?

I want to convert image to base64 by using react-native-fs this is my code :

var RNFS = require('react-native-fs')

export default class Converter {

    constructor(img) {
        this.img = img;
    }

    convertToBas64() {
        return awaitRNFS.readFile(this.img, 'base64').then();
    }

}

But the error: _undefined is not an object (evaluating 'RNFSManager.RNFSFileTypeRegular')_ was appeared.

Pls retry the full setup from scratch. This error is mostly caused with a not-linking of native modules.

Also don't forget to recompile and restart your whole project. Just a refresh is not sufficient.

@zGuindouGit in ypur code is also a space missing between await and RNFS:

return awaitRNFS.readFile(this.img, 'base64').then();
return await RNFS.readFile(this.img, 'base64').then();

Hi,

I've recreated the whole android and ios directories (ejected) but it does not work and return this:

 TypeError: Cannot read property 'RNFSFileTypeRegular' of undefined
Was this page helpful?
0 / 5 - 0 ratings

Related issues

npomfret picture npomfret  路  4Comments

zaheerahmad92001 picture zaheerahmad92001  路  3Comments

wangfpp picture wangfpp  路  3Comments

PimDeWitte picture PimDeWitte  路  4Comments

JohnRyanTsai picture JohnRyanTsai  路  3Comments