stripe / stripe-android

Stripe Android SDK
https://stripe.com/docs/mobile/android
MIT License
1.3k stars 649 forks source link

[BUG] Cursor color not updated with PaymentSheet.Appearance #8021

Open david-tixr opened 9 months ago

david-tixr commented 9 months ago

Summary

I am forcing light theme in my PaymentSheet, regardless of the device's Dark mode settings, using the method recommended by the docs:

appearance = PaymentSheet.Appearance(
    colorsDark = PaymentSheet.Colors.defaultLight,
    colorsLight = PaymentSheet.Colors.defaultLight,
)

All the colors are correctly updated, EXCEPT the cursor color in the input fields: it remains either white or black, following the device's Dark mode rather than the PaymentSheet.Appearance I've set. My expectation is that: either the cursor color should be directly customizable in PaymentSheet.Colors, or it should use the onComponent color.

Code to reproduce

I've forked this repo: https://github.com/david-tixr/stripe-android and added only the few lines mentioned above (commit: https://github.com/david-tixr/stripe-android/commit/30b1faa793a76043e8f387ff158df1fdd35a24f8).

  1. Checkout branch bug/cursor-color
  2. Set your device to Dark mode
  3. Run paymentsheet-example
  4. Select the first option (PaymentSheet)
  5. Click Buy

Android version

Android 14, possibly lower versions too

Installation method

Gradle dependency: com.stripe:stripe-android:20.38.0

Dependency Versions

kotlin: 1.9.22 stripe-android: 20.38.0 Android Gradle Plugin: 8.2.2 Gradle: 8.2

Screenshots

:x: Device in Dark mode -- cursor is white on white, barely visible

✅ Device in Light mode -- cursor is black on white

david-tixr commented 9 months ago

Note: adding AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO) in my Application class solves it. But it feels like a workaround: I shouldn't have to set this globally and affect my whole app just to solve the cursor in Stripe activities.

somesh-mesh commented 8 months ago

Hi, I Wanted to fix this bug.

ningkanggithub commented 1 day ago

This bug affects the user experience and wants to expose an method to change the cursor color