feat: Add loading and custom loader support to GooglePayButton#90
Open
hanumanteshvar07-design wants to merge 2 commits intogoogle-pay:mainfrom
Open
feat: Add loading and custom loader support to GooglePayButton#90hanumanteshvar07-design wants to merge 2 commits intogoogle-pay:mainfrom
hanumanteshvar07-design wants to merge 2 commits intogoogle-pay:mainfrom
Conversation
…' to 'type'" This reverts commit 2633c46.
|
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. |
fd54c92 to
98a2013
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.