itinance / itinance/react-native-fs

undefined is not an object(evaluating 'RNFS.writeFile')

Open
#1,094 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
5k
Forks
1k
PR merge metrics
No merged PRs in 30d

Description

I am trying to create a mobile app with react native which checks does the user have an id or no in the start of the app, and if the user doesn't have an id then it gives the user an id and updates a json file. I am trying to do it like
```js
const RNFS = require("react-native-fs");
console.log(RNFS);
const settingsFile = require("./app.json");
if (settingsFile.userid == null) {
const newUserid = Date.now().toString(36) + Math.random().toString(36).substr(2);
settingsFile.userid = newUserid;
RNFS.writeFile("./app.json", settingsFile, "utf-8")
.then((success) => {
console.log('FILE WRITTEN!');
})
.catch((err) => {
console.log(err.message);
});
}
```
But I am getting the errror `undefined is not an object(evaluating 'RNFS.writeFile')`

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.