Code Monkey home page Code Monkey logo

Comments (4)

sudowoodo200 avatar sudowoodo200 commented on July 18, 2024 1

This blog helped: https://hackernoon.com/google-sign-in-and-expo-go-a-guide-to-help-you-fix-any-issues-that-arise
Don't think it's a sponsorship issue, at least now

@vonovak, if you need proper sponsorship, I might be able to help. This is an important library that should be supported by a corporate partner. Will be sad if you have to gate critical features for it

from google-signin.

ladyshaitan avatar ladyshaitan commented on July 18, 2024

I'm experiencing this exact same issue with the same dependencies. Did you figure this out OP?

Like here in this guide: https://react-native-google-signin.github.io/docs/one-tap#web-support

This functionality is only available to sponsors️. It takes just a few clicks to get access ❤️.

What is "this"? Web? Is that why it's crashing? I'm all for seizing your opportunity for income, but pretty irritated if this is causing my web app to crash.

from google-signin.

ladyshaitan avatar ladyshaitan commented on July 18, 2024

I figured this out! This was not very clear to me upfront. Web is incompatible with (at least the free version of) react-native-google-signin/google-signin because it's a "react native" package for mobile. Those of us who are using true react-native in a mono-repo to support mobile and web will get a crasher.

How to fix:

  1. Locate all references to '@react-native-google-signin/google-signin' and make a list of the functions used in your code
  2. Start going down the list and making platform specific files / functions for web. You can use react native's platform specific file extensions to make a file for mobile and a file for web.

Example, please note that this works for me because of my specific setup where I can assume that google signin will always be an option in web.

isGooglePlayAvailableAsync.ts

import { GoogleSignin } from '@react-native-google-signin/google-signin';

export default async () => GoogleSignin.hasPlayServices();

isGooglePlayAvailableAsync.web.ts

export default async () => true;
  1. In your code import the file: import isGooglePlayAvailableAsync from './isGooglePlayAvailableAsync' and use this to replace all instances of GoogleSignin.hasPlayServices

Example:

import isGooglePlayAvailableAsync from './isGooglePlayAvailableAsync'

const Button = () => 
    <TouchableOpacity onPress={() 
        => isGooglePlayAvailableAsync().then(() => {
          // do something
        })}>
    </TouchableOpacity>
  1. This works because the native code can't actually be compiled properly for web, so even if you're not invoking a method, your app will crash if the native package is imported into a file that is used at runtime.

from google-signin.

vonovak avatar vonovak commented on July 18, 2024

Hello and thanks for asking,
The reason you're getting this issue is that you're importing the package on the web. Importing on the web, even if not directly calling the package, leads to the error.

The free package was made to work on Android and iOS. The package was always native-first and web support was never considered. This is, to my knowledge, the first issue that reports this problem in this way.

I agree that a hard-crash is not the right behavior and I will implement a change that will log a warning, but won't crash. However, I'm vacationing now and I'll get to it at the end of May.

@sudowoodo200 I'll be very happy if you can find a partner that would be willing to support the maintenance. You can reach out to me to discuss this using the contact information listed in my profile.

Thank you 🙂

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.