-
Notifications
You must be signed in to change notification settings - Fork 263
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Android] fix: card field focus jumps back to the card number field #630
Conversation
onValidCardChange() | ||
} else { | ||
cardParams = null | ||
cardAddress = null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this else case where it is not vali do you still need to sendCardDetailsEvent
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@michelleb-stripe yes and I do this, you can find the calls in the particulars text fields listeners
stripe-react-native/android/src/main/java/com/reactnativestripesdk/StripeSdkCardView.kt
Line 238 in 06e48d4
sendCardDetailsEvent() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that would mean that the CardValidCallback would always need to be followed by a TextWatcher. I am not sure this is a guarantee we can make.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @michelleb-stripe I'm taking this over from Arek but I'm not sure I get this properly. Can you please help me understanding the problem?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@souhe Let me try to explain more. The setExpiryDateTextWatcher and setPostalCodeTextWatchedr called onCardChanged, which will get the paymentMethodCreateParams without first checking to see if they are valid. Because of how a query on the paymentMethodCreateParams works it will change the focus on the widget, to the first field that is invalid.
paymentMethodCreateParams should only be called from the CardValidCallback.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@michelleb-stripe I'm afraid I'm still confused :D Are you describing your previous comment or this whole issues?
If the first one then I'm not getting why calling sendCardDetailsEvent
from setExpiryDateTextWatcher
or setPostalCodeTextWatcher
would call paymentMethodCreateParams
.
If the second one I'm still not sure what this means - I think that would mean that the CardValidCallback would always need to be followed by a TextWatcher. I am not sure this is a guarantee we can make
. Why is that true? If I understand the code created by Arek properly we are sending sendCardDetailsEvent
on every change from each watcher so that is why there is no need to send this even once again from cardValidCallback (when card is invalid)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the delay. Looking at it again it looks good to me.
Any updates on this issue? |
@arekkubaczkowski @michelleb-stripe Any updates on when can this be shipped? |
android/src/main/java/com/reactnativestripesdk/StripeSdkCardView.kt
Outdated
Show resolved
Hide resolved
…StripeSdkCardView.kt
closes #121
cardParams
,paymentMethodCreateParams
andpaymentMethodCard
properties have the side effect that when called it will shift the focus to an invalid field. In order to avoid this, we need to call it only when the card details are valid.