Skip to content
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

Fix STPPaymentCardTextField touch handling bugs for small devices on iOS 11 #883

Merged
merged 2 commits into from
Jan 12, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Stripe/STPPaymentCardTextField.m
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,11 @@ - (void)commonInit {
}

[self addSubview:brandImageView];
// On small screens, the number field fits ~4 numbers, and the brandImage is just as large.
// Previously, taps on the brand image would *dismiss* the keyboard. Make it move to the numberField instead
brandImageView.userInteractionEnabled = YES;
[brandImageView addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:numberField
action:@selector(becomeFirstResponder)]];

self.focusedTextFieldForLayout = @(STPCardFieldTypeNumber);
[self updateCVCPlaceholder];
Expand Down Expand Up @@ -1070,6 +1075,7 @@ must be visible so they can be tapped over to (although
fieldsHeight)];
maskView.backgroundColor = [UIColor blackColor];
maskView.opaque = YES;
maskView.userInteractionEnabled = NO;
[UIView performWithoutAnimation:^{
self.numberField.maskView = maskView;
}];
Expand Down