Skip to content

Unable to get property RNFSFileTypeRegular of undefined or null reference. #1039

@sungsong88

Description

@sungsong88

I followed the latest react-native-windows get started(https://microsoft.github.io/react-native-windows/docs/getting-started) and npm install react-native-fs. Just a pure boilerplate react-native 0.65 app.

However npx react-native run-windows which supposed to autolink react-native-fs seemed not working so I did manual linking:

Capture

"dependencies": {
  "react": "17.0.2",
  "react-native": "0.65.1",
  "react-native-fs": "^2.18.0",
  "react-native-windows": "0.65.2"
},

Super simple set up, but I'm getting this Unable to get property RNFSFileTypeRegular of undefined or null reference. Error when I try to use RNFS like this:

/**
 * Sample React Native App
 * https://github.com/facebook/react-native
 *
 * @format
 * @flow strict-local
 */

import React from 'react';
import type {Node} from 'react';
var RNFS = require('react-native-fs');

...

const App: () => Node = () => {
    console.log(RNFS?.DocumentDirectoryPath);
    ...
};

Anyone has similar problem? Any ideas??

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions