Skip to content

feat: Add loading and custom loader support to GooglePayButton#90

Open
hanumanteshvar07-design wants to merge 2 commits intogoogle-pay:mainfrom
hanumanteshvar07-design:feat/loading-indicator
Open

feat: Add loading and custom loader support to GooglePayButton#90
hanumanteshvar07-design wants to merge 2 commits intogoogle-pay:mainfrom
hanumanteshvar07-design:feat/loading-indicator

Conversation

@hanumanteshvar07-design
Copy link
Copy Markdown
Contributor

Problem
Currently, the GooglePayButton component lacks built-in support for a loading state. This results in poor UX during the payment initiation process, as users often tap the button multiple times when there is no immediate visual feedback. Developers are forced to manually overlay spinners or wrap the button in parent views to handle loading states.

Solution
This PR introduces native support for a loading state directly in the GooglePayButton component.

Key Changes
New loading Prop: A boolean that, when true, automatically disables the button and displays a centered loader overlay.
New loader Prop: Allows developers to pass a custom React component to be used as the loading indicator.
Custom Loader Component: Added a brand-aligned, high-fidelity rotating arc spinner as the default loading indicator. This matches Google Pay's modern design language.
Modularity: Moved the loading logic into a dedicated src/Loader.tsx component and exported it via the main index, making it available for reuse throughout the application.
Theme Support: The default loader is theme-aware, automatically switching between white and black based on the button's theme (Dark/Light).
Improved UX: The native button content is hidden during the loading phase (opacity: 0) to focus user attention on the progress indicator.

@google-cla
Copy link
Copy Markdown

google-cla Bot commented Apr 23, 2026

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

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.

2 participants