Closed BPich closed 2 years ago
This library contains native code which must be compiled. In order to use with expo, you will need to use bare workflow/eject your project. https://docs.expo.dev/introduction/managed-vs-bare/
Hello,
Thank you for your answer. Sorry I should have specified : I'm using bare workflow.
Am I missing a step for this native code compilation ? Or is there some configuration to be done in the android/
folder that are not described in the readme ?
Native code should automatically be detected. The process I tested on a mac:
expo init --template bare-minimum
cd my-app
yarn add react-native-file-access@1
# Copy in your provided 'App.js'
yarn android
In metro, I get:
[Thu Oct 07 2021 15:29:35.816] BUNDLE ./index.js
[Thu Oct 07 2021 15:29:39.147] LOG Running "main" with {"rootTag":1}
[Thu Oct 07 2021 15:29:39.148] LOG /data/user/0/com.myapp/cache
How does this compare to your process?
Hello,
Reproducing your steps :
expo init --template bare-minimum
cd my-app
npm install --save react-native-file-access@1
#adding in App.js :
# _import { Dirs, FileSystem } from 'react-native-file-access';_
# _console.log(Dirs.CacheDir)_
expo start
# _open expo go on my android device SM-J250F_
TypeError: undefined is not an object (evaluating '_reactNativeFileAccess.Dirs.CacheDir')
Invariant Violation: "main" has not been registered. This can happen if:
* Metro (the local dev server) is run from the wrong folder. Check if Metro is running, stop it and restart it in the current project.
* A module failed to load due to an error and `AppRegistry.registerComponent` wasn't called.
Full terminal log and App.js attached. Note that I also tried setting 'react-native@0.63.4' to avoid the Warning: Invalid version of react-native for sdkVersion 42.0.0. Use react-native@0.63.4
but in the end got the same errors.
Note : my android version is very old (7.1.1), unfortunately can't update it. I'll try to use an emulator to check if that's the cause of the problem. Sorry for opening this issue if it's the case 😥
expo start
I think that is the issue. The expo
utility does not compile the native code. Try npm run android
, yarn android
, or npx react-native run-android
.
https://docs.expo.dev/bare/exploring-bare-workflow/#build-and-open-the-project
Hello,
I'm trying to integrate this repo into my app, but can't make it work even on basic instruction of the readme
const text = await FileSystem.readFile(Dirs.CacheDir + '/test.txt');
nor on a simpleconsole.log(Dirs.CacheDir)
after importing as stated :import { Dirs, FileSystem } from 'react-native-file-access';
.I get the following error :
[Unhandled promise rejection: TypeError: undefined is not an object (evaluating '_reactNativeFileAccess.Dirs.CacheDir')]
Guess there must be something wrong in my configuration ? Developping on Windows using npm and expo-cli (4.12.0). Using react-native v0.63.4 hence set react-native-file-access to v1.7.1 as required by the readme.
App and package.zip
Thanks for your help