Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Padding on the Google Icon in the button wrong #666

Closed
TaylorDale opened this issue May 14, 2019 · 11 comments
Closed

Padding on the Google Icon in the button wrong #666

TaylorDale opened this issue May 14, 2019 · 11 comments

Comments

@TaylorDale
Copy link

The padding in the left hand side of the Google Icon is wrong for me on all button sizes apart from purely 'Icon' which works fine.
image

Steps to Reproduce

Copy the code for the button on the front page into the layout.

Expected Behavior

Icon should be evenly padded.

Actual Behavior

It isn't. See above picture

Environment

Android, real device.

@mscolari
Copy link

mscolari commented Jul 2, 2019

I'm having the same issue. I tried adding padding manually and centering the button, but was not able to fix the issue

@jozan
Copy link
Collaborator

jozan commented Jul 7, 2019

These native buttons are provided by the underneath library we have built our wrapper which in this case is (https://developers.google.com/identity/sign-in/android/).

Has anyone tried to debug or tried more recent google sign in library version?

@nshaposhnik
Copy link

nshaposhnik commented Jul 22, 2019

I have this problem as well even with example project. I have Galaxy S8, and if I lower it's resolution from default WQHD+ to FHD, bug disappears.

@nshaposhnik
Copy link

Also I have tried upgrading to googlePlayServicesAuthVersion = "17.0.0" (and thus support 28 with androidx stuff), but problem is not fixed

@mscolari
Copy link

After I have not used the library for about 2 weeks, it seems the problem has gone away for me for some reason. I know this isn't particularly helpful for anyone still facing the issue, but I wanted to update my success with it.
Screenshot_20190723-094548_taste

@tholder
Copy link

tholder commented Sep 2, 2019

I am receiving this with latest version on RN 0.59.10

button

Seems like a minor issue but I expect Google will reject this as a valid button when validating apps.

@nshaposhnik
Copy link

nshaposhnik commented Sep 5, 2019

I've tried to create Android native project with this button, and still have this issue. Thus, it's an issue with Android SDK. Solution can be to draw the button on your own, or use code similar to this, and alter layout's properties in runtime:

        for (int i = 0; i < signInButton.getChildCount(); i++) {
            View v = signInButton.getChildAt(i);

            if (v instanceof ImageView) {
                ImageView iv = (ImageView) v;
                FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) iv.getLayoutParams();
                params.gravity = Gravity.CENTER;
                iv.setLayoutParams(params);
                return;
            }
        }

@nshaposhnik
Copy link

I've resolved it with my fork: https://github.com/nshaposhnik/react-native-google-signin/tree/padding_fix , although as you can see it's a hack, and it hardcodes button to SIZE_STANDARD/COLOR_AUTO. Also I've changed it to not use AndroidX stuff, so pls make sure to revert that commit for RN 0.60 and newer.

@itsmistad
Copy link

I'm still having trouble with this. Has anyone found a solution beyond the hack that @nshaposhnik mentioned?

@yzeng12
Copy link

yzeng12 commented May 5, 2021

Same issue when use it in android, showing me padding in android studio preview, but in real device, padding gone, any solution yet? I end up cutomized an button to replace it

@vonovak
Copy link
Member

vonovak commented Oct 2, 2021

hello, I just tested on v7 and the padding seems okay to me. If anything, having your custom sign in button seems like a good idea too.

Please open a new issue if the problem persists.

@vonovak vonovak closed this as completed Oct 2, 2021
@react-native-google-signin react-native-google-signin locked and limited conversation to collaborators Oct 2, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

8 participants