stripe / stripe-android

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

Stop CardFormView from automatically change to dark view mode #5678

Closed Angelia-Gong closed 2 years ago

Angelia-Gong commented 2 years ago

My app currently does not support dark mode, so the background always stays as white. I have integrated CardFormView to my app and noticed that when the phone setting is set to dark mode, the border lines and text colors become white, which means invisible in my app.

I tried setting isForceDarkAllowed = false but it doesn't work.

I can't seem to find a way to stop the component from switching into dark mode. Please help! Thanks!

tillh-stripe commented 2 years ago

Hi @Angelia-Gong 👋 Happy to help here!

Are you using CardFormView in an AppCompatActivity? If that’s the case, you can call the following in your Application.onCreate() to use light mode throughout your app even if dark mode is turned on:

AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO)

Let me know if that works for you 🙂