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

Fix PaymentCardTextField bugs #692

Closed
Closed
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
8 changes: 6 additions & 2 deletions src/components/PaymentCardTextField.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -130,7 +131,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))
Expand Down