stripe-react-native
stripe-react-native copied to clipboard
Not able to set style for paymentsheet on Android
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:
- On android create a paymentsheet and define the style to
light
in the setup params. - 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
@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 Android will get this feature in an upcoming release!
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!
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.
This is blocked on https://github.com/stripe/stripe-android/issues/4229
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