From 1f907ec5cb6064c57950ab6447b282ff0b3263d2 Mon Sep 17 00:00:00 2001 From: Kirill Pinchuk Date: Fri, 2 Oct 2020 12:11:14 +0300 Subject: [PATCH 1/5] 8.0.0-beta.11 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 05e8fda85..cc88a8b0d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "tipsi-stripe", - "version": "8.0.0-beta.10", + "version": "8.0.0-beta.11", "description": "React Native Stripe binding for iOS/Android platforms", "main": "src/index.js", "scripts": { From 23783de9751f833feefb5a83a039797f84be0322 Mon Sep 17 00:00:00 2001 From: Ryan Krueger Date: Thu, 15 Oct 2020 14:39:27 -0400 Subject: [PATCH 2/5] Fix currentlyFocusField deprecation --- src/components/PaymentCardTextField.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/components/PaymentCardTextField.js b/src/components/PaymentCardTextField.js index 2cab26bba..f58eb55ab 100644 --- a/src/components/PaymentCardTextField.js +++ b/src/components/PaymentCardTextField.js @@ -130,7 +130,10 @@ export default class PaymentCardTextField extends Component { } } - isFocused = () => TextInputState.currentlyFocusedField() === findNodeHandle(this.cardTextFieldRef) + isFocused = () => + (TextInputState.currentlyFocusedInput + ? TextInputState.currentlyFocusedInput() + : TextInputState.currentlyFocusedField()) === findNodeHandle(this.cardTextFieldRef) focus = () => { TextInputState.focusTextInput(findNodeHandle(this.cardTextFieldRef)) From 0e8b21e50b64b4fdb019338dfd8113a943476585 Mon Sep 17 00:00:00 2001 From: Ryan Krueger Date: Thu, 15 Oct 2020 15:08:42 -0400 Subject: [PATCH 3/5] Fix blur and focus methods --- src/components/PaymentCardTextField.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/components/PaymentCardTextField.js b/src/components/PaymentCardTextField.js index f58eb55ab..63cba229b 100644 --- a/src/components/PaymentCardTextField.js +++ b/src/components/PaymentCardTextField.js @@ -7,9 +7,10 @@ import { TouchableWithoutFeedback, ViewPropTypes, Platform, + TextInput } from 'react-native' import PropTypes from 'prop-types' -import TextInputState from 'react-native/Libraries/Components/TextInput/TextInputState' +const { State: TextInputState } = TextInput; const FieldStylePropType = PropTypes.shape({ ...ViewPropTypes.style, @@ -136,11 +137,12 @@ export default class PaymentCardTextField extends Component { : TextInputState.currentlyFocusedField()) === findNodeHandle(this.cardTextFieldRef) focus = () => { - TextInputState.focusTextInput(findNodeHandle(this.cardTextFieldRef)) + // TextInputState.focusTextInput(findNodeHandle(this.cardTextFieldRef)) + findNodeHandle(this.cardTextFieldRef).focus() } blur = () => { - TextInputState.blurTextInput(findNodeHandle(this.cardTextFieldRef)) + findNodeHandle(this.cardTextFieldRef).focus() } handlePress = () => { From df023046dcfba7e1f081004a9b409d2c01ad132b Mon Sep 17 00:00:00 2001 From: Ryan Krueger Date: Thu, 15 Oct 2020 15:46:56 -0400 Subject: [PATCH 4/5] Don't autofocus credit card form on android --- .../com/gettipsi/stripe/CustomCardInputReactManager.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/android/src/main/java/com/gettipsi/stripe/CustomCardInputReactManager.java b/android/src/main/java/com/gettipsi/stripe/CustomCardInputReactManager.java index d2e300a4d..e72d201a0 100644 --- a/android/src/main/java/com/gettipsi/stripe/CustomCardInputReactManager.java +++ b/android/src/main/java/com/gettipsi/stripe/CustomCardInputReactManager.java @@ -61,9 +61,9 @@ protected CreditCardForm createViewInstance(final ThemedReactContext reactContex creditCardForm.post(new Runnable() { @Override public void run() { - InputMethodManager inputMethodManager = (InputMethodManager) reactContext.getSystemService(reactContext.INPUT_METHOD_SERVICE); - inputMethodManager.toggleSoftInputFromWindow(creditCardForm.getApplicationWindowToken(), InputMethodManager.SHOW_IMPLICIT, 0); - creditCardForm.focusCreditCard(); + // InputMethodManager inputMethodManager = (InputMethodManager) reactContext.getSystemService(reactContext.INPUT_METHOD_SERVICE); + // inputMethodManager.toggleSoftInputFromWindow(creditCardForm.getApplicationWindowToken(), InputMethodManager.SHOW_IMPLICIT, 0); + // creditCardForm.focusCreditCard(); } }); return creditCardForm; From e3a84599e39b1ddeddf258549fd4a50dd6d5a309 Mon Sep 17 00:00:00 2001 From: Ryan Krueger Date: Thu, 15 Oct 2020 15:47:39 -0400 Subject: [PATCH 5/5] Revert focus and blur changes --- src/components/PaymentCardTextField.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/components/PaymentCardTextField.js b/src/components/PaymentCardTextField.js index 63cba229b..b981ab808 100644 --- a/src/components/PaymentCardTextField.js +++ b/src/components/PaymentCardTextField.js @@ -137,12 +137,11 @@ export default class PaymentCardTextField extends Component { : TextInputState.currentlyFocusedField()) === findNodeHandle(this.cardTextFieldRef) focus = () => { - // TextInputState.focusTextInput(findNodeHandle(this.cardTextFieldRef)) - findNodeHandle(this.cardTextFieldRef).focus() + TextInputState.focusTextInput(findNodeHandle(this.cardTextFieldRef)) } blur = () => { - findNodeHandle(this.cardTextFieldRef).focus() + TextInputState.blurTextInput(findNodeHandle(this.cardTextFieldRef)) } handlePress = () => {