wodin / RNShare

Expo/RN Share test app
2 stars 1 forks source link

how to fix NativeModules.RNShare.FACEBOOK #2

Open putu-eka-mulyana opened 1 year ago

putu-eka-mulyana commented 1 year ago

Hi,

do you know how to fix this error ?

TypeError: null is not an object (evaluating '_reactNative.NativeModules.RNShare.FACEBOOK')
wodin commented 1 year ago

Make sure you are not using Expo Go. You will need to create a development build with eas build --profile development and then use that instead of Expo Go.

putu-eka-mulyana commented 1 year ago

error when yarn start

wodin commented 1 year ago

I can't help if you don't give me the details

putu-eka-mulyana commented 1 year ago

Thank you for answering,

i run eas build --profile development --platform android

image

wodin commented 1 year ago

OK. It seems you have added something like this to app.json:

"plugins": ["react-native-share"]

But react-native-share does not require a config plugin. So you should remove that from app.json.

Also, you might want to upgrade eas-cli and add the version to eas.json like this:

{
  "cli": {
    "version": ">= 2.9.0"
  },
  "build": {
    "development": {
...
wodin commented 1 year ago

Oh, and remove eas-cli from your project dependencies. It should just be installed globally.

putu-eka-mulyana commented 1 year ago

Can't it run on the local computer? i run npx expo start --tunnel

image

wodin commented 1 year ago

What did you run on the phone/emulator/simulator to get this error?

putu-eka-mulyana commented 1 year ago

oh my phone

wodin commented 1 year ago

No, I mean which app did you run on your phone, exactly?

putu-eka-mulyana commented 1 year ago

I run the application from your repository

wodin commented 1 year ago

OK, there's something weird going on. I got the same error now when I tried npx expo start --tunnel, but npx expo start works fine. I'm not sure yet what's going wrong with --tunnel.

Can you try without --tunnel?

I decided to upgrade to Expo SDK 47 before giving it a try. You can download my development build from here if you like (available for the next 29 days): https://expo.dev/accounts/wodin/projects/RNShare/builds/54a920d4-2948-4575-be9d-4a6ead4b0e91

I build it with eas build -p android --profile development

You'd need to make sure your git clone of this repository is up to date (currently commit ID b7dc6bfa3da754be0a53058f1db65a314d9f2a50)

putu-eka-mulyana commented 1 year ago

thanks for helping me in using react native share in expo. but the problem now is when I click the "share to IG story" button it doesn't open instagram.

wodin commented 1 year ago

Hi. It seems that for some apps you need to list them in Info.plist.

https://react-native-share.github.io/react-native-share/docs/share-open/#lsapplicationqueriesschemes-ios-only

https://github.com/react-native-share/react-native-share/blob/fd94ea54f74dd17d054b760256023ece351f9296/example/ios/example/Info.plist#L27-L36

Try adding this to app.json:

{
  "expo": {
// [...]
    "ios": {
// [...]
      "infoPlist": {
        "LSApplicationQueriesSchemes": [
          "instagram-stories",
          "instagram"
        ]
      }
    },
// [...]
  }
}