question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

alwaysDark style for PaymentSheet not functional in Android apps - system theme always applied

See original GitHub issue

Describe the bug When trying to force dark theme using style='alwaysDark' in initPaymentSheet, Payment Sheet in Android apps do not actually always use dark theme. Instead, they end up getting the system light vs dark theme applied, you can toggle it via system settings to see it switch.

To Reproduce Steps to reproduce the behavior:

  1. Run the example app included in this repository. Note that PaymentsUICompleteScreen and PaymentsUICustomScreen both include style='alwaysDark'.
  2. In the example app, go to Accept a Payment > Prebuilt UI (either version). Press the button (top on custom/multi-step).
  3. Notice on Android that the PaymentSheet theme matches the system theme, alwaysDark is not honoured. iOS PaymentSheet adheres to provided theme.

Expected behavior Android PaymentSheet should always be dark when style='alwaysDark' is set.

Screenshots In all examples, style='alwaysDark' is set.

Android with light system theme alwaysDark-system-override

Android with dark system theme alwaysdark-system-override-dark

iOS iphone-alwaysdark-correct

Smartphone (please complete the following information):

  • Device: Pixel 4 AVD
  • OS: Android 10
  • Browser N/A
  • Version SDK 29 on virtual device per RN instructions

Additional context Add any other context about the problem here.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
skyler-stripecommented, Sep 24, 2021

Thanks for the responses!

We’re 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.

1reaction
michelleb-stripecommented, Sep 17, 2021

@brendanm-stripe This is not something that the android currently supports, but we do have it in our backlog. I will post an update when we have it complete.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Dark theme - Android Developers
Dark theme applies to both the Android system UI and apps running on the device. ... Your themes and styles should avoid hard-coded...
Read more >
Use Dark theme in your apps - Google Play Help
Dark theme can be easier to see, and it can save battery on some screens. Not all apps offer multiple color schemes. Turn...
Read more >
How to Enable the New Full Dark Mode in Google Maps on ...
Then, the dark mode comes with three different settings: always light, always dark, and following the system mode. While switching it to always...
Read more >
How to Enable Dark Mode in Snapchat - Alphr
Scroll Down and choose “App Appearance.” Choose “Always Dark.” How to Use Dark Mode in Snapchat on Android. Unfortunately, Snapchat hasn't ...
Read more >
How to disable night mode in my application even if night ...
Android -Q will out any time soon and all the app will get affected from the system settings . You can look for...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found