achorein / expo-share-intent

๐Ÿš€ Simple share intent in an Expo Native Module
MIT License
119 stars 10 forks source link

Incompatibility with @react-native-google-signin/google-signin #35

Closed huhulacolle closed 3 months ago

huhulacolle commented 3 months ago

Describe the bug

Hello, there seems to be an incompatibility between the expo-share-intent package and @react-native-google-signin/google-signin, if both are installed, the expo-share-intent package works fine, but on iOS if you try to use the google sign in package, it crashes the app with the following error message: ERROR Your app just crashed. See the error below. NSInvalidArgumentException: You must specify |clientID| in |GIDConfiguration

To Reproduce

install both packages according to their respective docs

Environment give the output of the following command npx react-native info

System: OS: Windows 11 10.0.22631 CPU: "(16) x64 AMD Ryzen 7 5800H with Radeon Graphics " Memory: 5.76 GB / 15.34 GB Binaries: Node: version: 20.11.1 path: C:\Program Files\nodejs\node.EXE Yarn: Not Found npm: version: 10.2.4 path: C:\Program Files\nodejs\npm.CMD Watchman: Not Found SDKs: Android SDK: Not Found Windows SDK: Not Found IDEs: Android Studio: AI-232.10227.8.2321.11479570 Visual Studio: Not Found Languages: Java: Not Found Ruby: Not Found npmPackages: "@react-native-community/cli": Not Found react: installed: 18.2.0 wanted: 18.2.0 react-native: installed: 0.73.6 wanted: 0.73.6 react-native-windows: Not Found npmGlobalPackages: "react-native": Not Found Android: hermesEnabled: Not found newArchEnabled: Not found iOS: hermesEnabled: Not found newArchEnabled: Not found

Additional context Add any other context about the problem here.

achorein commented 3 months ago

this is a known issue in the previous demo https://github.com/achorein/expo-share-intent-demo/issues/19, there is some work to be done on the subject

achorein commented 3 months ago

@huhulacolle do you use firebase ? did you configure GoogleSignIn with iosClientId ?

GoogleSignin.configure({
  iosClientId:
    "xxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxxxx.apps.googleusercontent.com",
});
huhulacolle commented 3 months ago

@achorein I use Google API everything is well configured, I managed to fix the crash problem, I entered the iOS url schema in the infoplist rather than in the plugin config.

"ios": {
      "infoPlist": {
        "CFBundleURLTypes": [
          {
            "CFBundleURLSchemes": [
              "com.googleusercontent.apps.647537853682-0omdac08g4lsj26prhk1lal0l88jm7l9"
            ]
          }
        ]
      }
}

however, now that the google sign in package is working, when I try to share a text on the app, it no longer redirects to the app

achorein commented 3 months ago

The new PR aim to check this problem.

When we configure a custom scheme (CFBundleURLSchemes) the original app scheme is deleted and must be manually reassigned :

 "scheme": "exposhareintentexample",
 "ios": {
      "supportsTablet": true,
      "bundleIdentifier": "expo.modules.exposhareintent.example",
      "infoPlist": {
        "CFBundleURLTypes": [
          {
            "CFBundleURLSchemes": [
              "com.googleusercontent.apps.xxxxxxxx-xxxxxxxxx",
              "exposhareintentexample"
            ]
          }
        ]
      }
    },

expo show a warning on prebuild phase for that :

ยป ios: scheme: "ios.infoPlist.CFBundleURLTypes" is set in the config. Ignoring abstract property "scheme": exposhareintentexample
huhulacolle commented 3 months ago

Thanks, I can confirm that it works. ๐Ÿ‘Œ

achorein commented 3 months ago

compatibilty check added in v1.2.1 README updated