Ваш файл успешно обновляется, и если вы хотите его проверить, запустите следующий код после того, как ваш файл будет записан. Вы увидите путь к файлу и данные вашего сохраненного файла.
// get a list of files and directories in the main bundle
RNFS.readDir(RNFS.DocumentDirectoryPath)
.then((result) => {
console.log('GOT RESULT', result);
// stat the first file
return Promise.all([RNFS.stat(result[0].path), result[0].path]);
})
.then((statResult) => {
if (statResult[0].isFile()) {
// if we have a file, read it
return RNFS.readFile(statResult[1], 'utf8');
}
return 'no file';
})
.then((contents) => {
// log the file contents
console.log("contents");
console.log(contents); // You will see the updated content here which is "{name:hello}"
})
.catch((err) => {
console.log(err.message, err.code);
});