Google-signin: Padding on the Google Icon in the button wrong

Created on 15 May 2019  路  10Comments  路  Source: react-native-google-signin/google-signin

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.

馃敠 Help Wanted

Most helpful comment

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

All 10 comments

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

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?

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.

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

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

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.

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;
            }
        }

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.

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

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

Was this page helpful?
0 / 5 - 0 ratings