Google signin Using latest implementation
npm install react-native-google-signin-latestGoogle signin Using latest implementation (Credential Manager).
__NOTE:__ It's still Android** only package. Any contribution will be welcomed :)
``sh`
npm install react-native-google-signin-latest
If you are using Yarn:
`sh`
yarn add react-native-google-signin-latest
`js
import { GoogleSignin } from 'react-native-google-signin-latest';
import { WEB_CLIENT_ID } from '@env';
// ...
useEffect(() => {
// WEB_CLIENT_ID ==> Add this value to your .env in the example folder
GoogleSignin.configure({ webClientId: WEB_CLIENT_ID })
}, []);
const handleSignIn = async () => {
await GoogleSignin.signIn().then((res) => {
console.log('GoogleSignin.signIn_res ', res);
}).catch((err) => {
console.error('GoogleSignin.signIn_err ', err);
})
}
const handleSignInWithGoogleButton = async () => {
await GoogleSignin.signInWithGoogleButton().then((res) => {
console.log('GoogleSignin.signInWithGoogleButton_res ', res);
}).catch((err) => {
console.error('GoogleSignin.signInWithGoogleButton_err ', err);
})
}
const handleSignOut = async () => {
await GoogleSignin.signOut().then((res) => {
console.log('GoogleSignin.signOut_res ', res);
}).catch((err) => {
console.error('GoogleSignin.signOut_err ', err);
})
}
return (
);
``
See the contributing guide to learn how to contribute to the repository and the development workflow.
MIT
---
Made with create-react-native-library