react-native-paper icon indicating copy to clipboard operation
react-native-paper copied to clipboard

Disabled button with padding

Open wilav-dev opened this issue 2 years ago • 14 comments

I have a form that while is sending data I set disabled and loading for button. I don't know why, I'm getting a strange padding. I cannot reproduce is a simple example. Any idea?

WhatsApp Image 2023-10-23 at 23 46 22 WhatsApp Image 2023-10-23 at 23 47 28

wilav-dev avatar Oct 24 '23 03:10 wilav-dev

Hey @wilav-dev, the label in Button component, in MD3, by default have the following styles:

  md3Label: {
    marginVertical: 10,
    marginHorizontal: 24,
  },

You can override them using labelStyle prop.

lukewalczak avatar Oct 24 '23 07:10 lukewalczak

Thank you but actually i'm forcing to v2 theme. I had tried to replace margins and paddings but still having same issue.

wilav-dev avatar Oct 24 '23 07:10 wilav-dev

Which library version are you using?

lukewalczak avatar Oct 24 '23 07:10 lukewalczak

5.10.6

wilav-dev avatar Oct 24 '23 17:10 wilav-dev

Isn't it an issue with the elevation prop when the elevated container has a semitransparent background?

cicerotcv avatar Nov 07 '23 04:11 cicerotcv

@cicerotcv yes it is that combination. I use v2 theme.

If I remove alpha from this lines Captura de pantalla 2023-11-19 a la(s) 01 02 26 or elevation from this lines Captura de pantalla 2023-11-19 a la(s) 01 02 55 then it works fine. I'm not sure why elevation is 2 when button is being disabled for a moment while making a post.

Do you know the fix for this issue?

wilav-dev avatar Nov 19 '23 04:11 wilav-dev

Could you please present how the Button is used in your code in order to reproduce the issue, since I'm not able to observe the problem which you're facing?

lukewalczak avatar Nov 19 '23 08:11 lukewalczak

@lukewalczak @cicerotcv Here is an example, the bug occurs only in Android. I'm not sure, I can reproduce it sometimes, for example after editing code and tap button again.

https://snack.expo.dev/@yamifr07/react-native-paper-example_v5?platform=android

Captura de pantalla 2023-11-19 a la(s) 09 17 35

wilav-dev avatar Nov 19 '23 11:11 wilav-dev

Actually, I was not able even once to observe the issue, so maybe you can investigate the issue and suggest the solution 🤔

lukewalczak avatar Nov 23 '23 13:11 lukewalczak

https://snack.expo.dev/@yamifr07/react-native-paper-example_v5?platform=android

I was able to reproduce using this link here

cicerotcv avatar Nov 23 '23 21:11 cicerotcv

@cicerotcv Thank you for your message. I'm not able to find the fix. Any idea?

wilav-dev avatar Nov 23 '23 22:11 wilav-dev

@cicerotcv Thank you for your message. I'm not able to find the fix. Any idea?

Sorry for the late reply. I'll take a look as soon as I can. I have never experienced it myself with react-native-paper. My guess is that elevation is not being set to zero when disabled is true

cicerotcv avatar Nov 27 '23 10:11 cicerotcv

Any resolution for this problem?

felipeemoreno avatar Jan 09 '24 21:01 felipeemoreno

Enabled button also behave like this. If you add padding to the button itself, the padding part can't be clicked.

A workaround is use labelStyle={{ padding: ButtonLabelPadding }}, and remove padding from button itself, which is not convenient.

linonetwo avatar Mar 19 '24 10:03 linonetwo