Keyboard cannot be dismissed for CardForm component
Describe the bug Keyboard cannot be closed by tapping away from the screen. I've programmatically called Keyboard.dismiss() however this works for other inputs but not for the CardForm inputs.
To Reproduce Steps to reproduce the behavior:
- Add CardField component
- Open any of the inputs
Expected behavior Keyboard should easily be dismissed
Additional context I've already followed the solution from: https://github.com/stripe/stripe-react-native/issues/222 however this does not work for CardForm
Is this on Android or iOS? or both?
Filling out the entire bug report template is a huge help to us in debugging the issue
This is for iOS. It's basically the same issue with #222, however for CardForm that's why I didn't get too detailed about it, apologies.
Using StripeContainer only works if I wrap the entire screen. So, I found another ugly workaround. Create a 1x1 text input that you can focus to kill the keyboard. 🙄
const MyComponent = () => {
const closeKeyboard = useCallback(() => {
focusInputRef.current.focus();
Keyboard.dismiss();
focusInputRef.current.blur();
}, []);
return (
<View>
<CardForm />
<TextInput
ref={focusInputRef}
accessible={false}
accessibilityElementsHidden={true}
style={styles.hackFocusInput}
/>
</View>
)
}
const styles = {
hackFocusInput: {
width: 1,
height: 1,
position: 'absolute',
bottom: 0,
right: 0,
opacity: 0,
},
}
Using<StripeContainer /> also works, but I have to wrap the entire screen with it.
Same issue here but only with Zipcode. Urgent to fix this.