1

我在资产文件夹中有文件,这些文件是在 Xcode 中的 my_project/assets 下创建的

我通常可以通过以下方式访问模板 WebView 中的文件:

source={{uri: './assets/myfolder/index.html'}}

但我无法使用 react-native-fs 将此文件复制到 DocumentsDirectory:

RNFS.copyFile('./assets/myfolder/index.html', RNFS.DocumentDirectoryPath + '/index.html').then((result) => console.log('DONE')).catch((error) => console.log(error, 'ERROR'));

错误:文件“index.html”无法打开,因为没有这样的文件。

在 android copyFileAssets 上工作正常。

4

0 回答 0