Skip to content
This repository has been archived by the owner on Jan 3, 2024. It is now read-only.

Commit

Permalink
Finish up fixing the PaymentCardTextField Component iOS Lockup
Browse files Browse the repository at this point in the history
Moots #508 #521
  • Loading branch information
fbartho committed Sep 4, 2019
1 parent 5ec9248 commit 18991e8
Showing 1 changed file with 1 addition and 20 deletions.
21 changes: 1 addition & 20 deletions ios/TPSStripe/TPSCardField.m
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,13 @@ @implementation TPSCardField {
STPPaymentCardTextField *_paymentCardTextField;
}

- (void)dealloc {
[[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardWillShowNotification object:self.window];
}

- (instancetype)initWithFrame:(CGRect)frame {
if ((self = [super initWithFrame:frame])) {
_isFirstResponder = NO;
_paymentCardTextField = [[STPPaymentCardTextField alloc] initWithFrame:self.bounds];
_paymentCardTextField.delegate = self;
[self addSubview:_paymentCardTextField];
self.backgroundColor = [UIColor clearColor];
[[NSNotificationCenter defaultCenter]
addObserver:self
selector:@selector(keyboardWillShow:)
name:UIKeyboardWillShowNotification
object:self.window];
}
return self;
}
Expand All @@ -60,24 +51,14 @@ - (void)reactBlur {
[self resignFirstResponder];
}

// Deprecated API -- removed in 2017, clean this up after RN 0.45 or lower support is dropped
- (void)reactWillMakeFirstResponder {
_jsRequestingFirstResponder = YES;
}

- (BOOL)canBecomeFirstResponder {
return _jsRequestingFirstResponder;
}

// Deprecated API -- removed in 2017, clean this up after RN 0.45 or lower support is dropped
- (void)reactDidMakeFirstResponder {
_jsRequestingFirstResponder = NO;
}

- (void)didMoveToWindow {
if (_jsRequestingFirstResponder) {
[_paymentCardTextField becomeFirstResponder];
[self reactDidMakeFirstResponder];
_jsRequestingFirstResponder = NO;
}
}

Expand Down

0 comments on commit 18991e8

Please sign in to comment.