Skip to content

Conversation

@meylis1998
Copy link
Contributor

Summary

The Google Pay PayButton uses AppCompatTextView internally, which requires a Theme.AppCompat theme. When the host app uses a non-AppCompat theme (e.g., Theme.MaterialComponents or other themes), this causes errors:

E/ThemeUtils: View class android.support.v7.widget.AppCompatTextView is an AppCompat 
widget that can only be used with a Theme.AppCompat theme (or descendant).

Root cause: ReactContext extended ContextWrapper(currentActivity) directly, which doesn't guarantee AppCompat theme attributes are available.

Fix: Changed ReactContext to extend ContextThemeWrapper with an explicit Theme_AppCompat_Light_NoActionBar theme, ensuring all platform views have access to AppCompat theme attributes regardless of the host app's theme.

Test plan

  • Build the example app and verify Google Pay button displays without AppCompat theme errors
  • Test on devices/emulators that were previously showing the error
  • Verify Google Pay button still functions correctly (onPressed callback works)

Fixes flutter-stripe#1907

The Google Pay PayButton uses AppCompatTextView internally, which
requires a Theme.AppCompat theme. When the host app uses a non-AppCompat
theme, this causes errors like:
"View class android.support.v7.widget.AppCompatTextView is an AppCompat
widget that can only be used with a Theme.AppCompat theme"

Changed ReactContext to extend ContextThemeWrapper with an explicit
AppCompat theme instead of plain ContextWrapper, ensuring all platform
views have access to AppCompat theme attributes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] PlatformPayButton for Google Pay

1 participant