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

Not able to set style for paymentsheet on Android

Open remonh87 opened this issue 3 years ago • 5 comments

Describe the bug You expose the property style on the SetupParams of the paymentsheet. I found out that this only works on iOS but not on Android. I also dit check the Stripe Android sdk and cannot find an API that sets the style. Is this something that needs to be implemented? Else it would be more clear we would call it iosStyle to prevent consumers from getting wrong expectations.

To Reproduce Steps to reproduce the behavior:

  1. On android create a paymentsheet and define the style to light in the setup params.
  2. Present the sheet and noticed the paymentsheet is still dark.

Expected behavior I would expect the sheet to be light like on iOS.

Smartphone (please complete the following information):

  • Device: Pixel4a
  • OS: Android11

Additional context My android theme is of the app is: Theme.AppCompat.Light.NoActionBar https://stripe.dev/stripe-react-native/api-reference/modules/paymentsheet.html#setupparams

remonh87 avatar May 29 '21 06:05 remonh87

@michelleb-stripe @yuki-stripe remind me, are we planning to allow to override of style on Android? IIRC currently it's based on system settings, right?

thorsten-stripe avatar May 31 '21 16:05 thorsten-stripe

@thorsten-stripe Android will get this feature in an upcoming release!

yuki-stripe avatar Jun 02 '21 23:06 yuki-stripe

I wonder if it's possible to change button colour or something like the pre-built UI for web element, I can customize the theme directly through my dashboard. thanks!

flora8984461 avatar Jun 19 '21 19:06 flora8984461

The Android SDK team looking into customization changes and will keep dark mode toggling in mind. In the mean time, it does seem possible that forcing dark mode at an application level is a solution for those that want to match. According to this you can put this line in your launcher activity's onCreate and force darkmode.

AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);

I'm hoping that is a good solution/bandaid while we work on more sophisticated customization.

michelleb-stripe avatar Feb 11 '22 13:02 michelleb-stripe

This is blocked on https://github.com/stripe/stripe-android/issues/4229

charliecruzan-stripe avatar Mar 18 '22 20:03 charliecruzan-stripe

I think this is better addressed by the appearance param, which allows you to specify both light and dark mode colors, so I'm going to close this issue.

Here are the docs for payment sheet appearance: https://stripe.com/docs/elements/appearance-api?platform=react-native

charliecruzan-stripe avatar Aug 12 '22 22:08 charliecruzan-stripe