Code Monkey home page Code Monkey logo

Comments (11)

SorenJ89 avatar SorenJ89 commented on September 21, 2024 1

@muriukialex
I just got the ball rolling on my test app. Here is what seemed to make it work:

1
I removed the expo go app from the emulator entirely (i had used it previously, but it is not needed when running development builds).

2
Instead of using links like "npx uri-scheme open exp://192.168.0.10:8081/--/settings --android", i was now able to open with the link "npx uri-scheme open testlinking://settings" where testlinking is the project slug.

from google-signin.

vonovak avatar vonovak commented on September 21, 2024

Hello and thanks for reporting,
please follow the guide here https://github.com/react-native-google-signin/google-signin#expo-installation

namely, you need to build the app including the native files for this to work
Thank you 🙂

from google-signin.

SorenJ89 avatar SorenJ89 commented on September 21, 2024

Hi @vonovak. Thanks for the response, but already do this.
As mentioned in the end, i build my project using managed expo, so the command i use is
eas build --profile development --platform android

And when testing, i launch wit the dev-client flag.
npx expo start --dev-client

from google-signin.

vonovak avatar vonovak commented on September 21, 2024

can you try with the commands here? https://docs.expo.dev/workflow/customizing/#generate-native-projects-with-prebuild

If that does not work, I'm going to need a git repo that reproduces those issues

Thank you

from google-signin.

muriukialex avatar muriukialex commented on September 21, 2024

Hello @vonovak

I have the same issue here

Here' are my dependecies

{
  "dependencies": {
    "@react-native-google-signin/google-signin": "^10.1.0",
    "expo": "~49.0.15",
    "expo-status-bar": "~1.6.0",
    "react": "18.2.0",
    "react-native": "0.72.6",
    "expo-splash-screen": "~0.20.5",
    "expo-apple-authentication": "~6.1.0"
  },
}

Built the Android and iOS native files using npx expo run:android and npx expo run:ios respectively

Did the native app linking as explained here after building my iOS native code ie. ran pod install in ios/ directory to install the module

pod install

Here's the error I get

iOS Bundling complete 11288ms
 ERROR  RN GoogleSignin native module is not correctly linked. Please read the readme, setup and troubleshooting instructions carefully or try manual linking.
 ERROR  TypeError: Cannot read property 'SIGN_IN_CANCELLED' of null, js engine: hermes
 ERROR  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., js engine: hermes

Code that produces the error

import * as AppleAuthentication from 'expo-apple-authentication'
import { GoogleSignin, GoogleSigninButton, statusCodes } from '@react-native-google-signin/google-signin'
import { Platform, StyleSheet } from 'react-native'

export function Auth () {
	if (Platform.OS === 'ios') {
		return (
			<AppleAuthentication.AppleAuthenticationButton
				buttonType={AppleAuthentication.AppleAuthenticationButtonType.SIGN_IN}
				buttonStyle={AppleAuthentication.AppleAuthenticationButtonStyle.BLACK}
				cornerRadius={5}
				style={styles.button}
				onPress={async () => {
					try {
						const credential = await AppleAuthentication.signInAsync({
							requestedScopes: [
								AppleAuthentication.AppleAuthenticationScope.FULL_NAME,
								AppleAuthentication.AppleAuthenticationScope.EMAIL,
							],
						})
						console.log(JSON.stringify(credential, null, 2))
						// signed in
					} catch (e: any) {
						if (e.code === 'ERR_REQUEST_CANCELED') {
							// handle that the user canceled the sign-in flow
						} else {
							// handle other errors
						}
					}
				}}
			/>
		)
	}

	GoogleSignin.configure({
		scopes: ['https://www.googleapis.com/auth/drive.readonly'],
		webClientId: 'my client ID',
	})
	return (
		<GoogleSigninButton
			size={GoogleSigninButton.Size.Wide}
			color={GoogleSigninButton.Color.Dark}
			onPress={async () => {
				try {
					await GoogleSignin.hasPlayServices()
					const userInfo = await GoogleSignin.signIn()
					console.log(JSON.stringify(userInfo, null, 2))
				} catch (error: any) {
					if (error.code === statusCodes.SIGN_IN_CANCELLED) {
						// user cancelled the login flow
					} else if (error.code === statusCodes.IN_PROGRESS) {
						// operation (e.g. sign in) is in progress already
					} else if (error.code === statusCodes.PLAY_SERVICES_NOT_AVAILABLE) {
						// play services not available or outdated
					} else {
						// some other error happened
					}
				}
			}}
		/>
	)
}

const styles = StyleSheet.create({
	container: {
		flex: 1,
		alignItems: 'center',
		justifyContent: 'center',
	},
	button: {
		width: 200,
		height: 44,
	},
})

Did you manage to find a work around @SorenJ89?

from google-signin.

SorenJ89 avatar SorenJ89 commented on September 21, 2024

@muriukialex It is weird. I had my son's birthday this weekend, but i had time to upload a git repo this friday, but suddenly everything worked.
Now that I'm back to it again it doesn't work..

@vonovak Here is the repo with the steps to reproduce
https://github.com/SorenJ89/testlinking

from google-signin.

vonovak avatar vonovak commented on September 21, 2024

@SorenJ89 I checked your repro steps (I'm on the phone so I didn't clone your repro so there is a chance I missed something but it's very unlikely I think) and it appears the problem is that you're using expo go.

As explained in the readme, you need your own development build. Please follow the readme and read very very very carefully the linked expo docs.
That should fix your issue.

Hope this helps 🙂.

from google-signin.

nicholasas1 avatar nicholasas1 commented on September 21, 2024

Halo @vonovak I have the same problem, namely when running with expo start --dev-client, I still get an error
Error: RN GoogleSignin native module is not correctly linked. Please read the readme, setup and troubleshooting instructions carefully.
If you are using Expo, make sure you are using Custom dev client, not Expo go., js engine: hermes.

Screenshot 2024-03-07 at 17 05 17

What's the solution?
Where can I see the correct linking tutorial on iOS?

from google-signin.

vonovak avatar vonovak commented on September 21, 2024

@nicholasas1 sorry you have an issue,
I suggest you read the documentation and the comments above. I'm confident that you'll get it working.

Thank you

from google-signin.

nicholasas1 avatar nicholasas1 commented on September 21, 2024

@vonovak does it only apply to sponsors?

from google-signin.

vonovak avatar vonovak commented on September 21, 2024

this error is not related to being / not being a sponsor

from google-signin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.