kuatsu / react-native-cloud-storage

☁️ Save to & read from iCloud and Google Drive using React Native
https://react-native-cloud-storage.oss.kuatsu.de/docs/intro
MIT License
141 stars 10 forks source link

'new NativeEventEmitter()' requires a non-null argument. #26

Closed mikelgarciaurbina closed 10 months ago

mikelgarciaurbina commented 10 months ago

Describe the bug As soon as I start importing the react-native-cloud-storage the app crashed

Steps to reproduce Steps to reproduce the behavior:

Expected behavior The import should work correctly

Screenshots

Screenshot 2024-01-21 at 12 50 57

Simulator Screenshot - iPhone 15 Pro Max - 2024-01-21 at 12 48 14

Environment:

mfkrause commented 10 months ago

This sounds like the library's native code isn't properly linked. Are you trying to run this in Expo Go? This won't work. This library contains native iOS code that isn't bundled in Expo Go. You'll therefore need to build the app natively. For development, that means you'll need to build a development client using Expo EAS. In production, you can also use Expo EAS to create app builds.

Otherwise, if it's not Expo Go, please let me know how exactly you run the app after importing the library. Because from those three steps you described, I'm unable to reproduce this (when I build a development client using EAS afterwards and use that to run the app).

mikelgarciaurbina commented 10 months ago

I am not creating the build locally. I will check the link to see if I can make it works, thanks. I just run npm start and open in the iOS simulator.

mfkrause commented 10 months ago

Yep, if you simply run npm start Expo will default to running Expo Go on the simulator. Expo Go doesn't include the native code required for running CloudStorage, so it won't work. Refer to the Expo documentation I linked above. You simply build the app using one command, install it on the simulator and will then be able to use CloudStorage (and any other libraries using native code not included in Expo Go).

Also make sure that react-native-cloud-storage is included in the plugins array in your app.json before building the app / development client. When you install the library using npx expo install [...], this should be done automatically for you, but better be safe.

Otherwise, the CloudStorage documentation also contains all of this information. I'll therefore close this for now, but let me know if you need further help.