-
Notifications
You must be signed in to change notification settings - Fork 265
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
Unable to dismiss the keyboard using CardField
#222
Comments
Hi, thanks for flagging. In this case we have to handle it manually, so we need to track screen interactions and dismiss the keyboard if needed. To achieve this I propose to that stripe sdk will expose extra UI component which will take care of it. To use it you will have to wrap your entire screen where is the CardInput, with our component. |
Can anyone provide more information as how I can dismiss the keyboard, because I am searching for it, is there any property or method we need to call in order to dismiss keyboard when clicked outside the CardField input. |
you have to wrap your screen with |
If I understand properly, you mean to say
|
But above code is not working and I am also not able to get StripeContainer from @stripe/stripe-react-native like below. Version "@stripe/stripe-react-native": "^0.1.2" It will be good, If you can send any reference for dismissing keyboard when click outside of CardField, Because I am not able to get any working example yet. |
@smeetagrawal |
Is there any way to call Edit: I was able to deal with this issue by calling // CardFieldView.swift
override func removeFromSuperview() {
self.endEditing(true)
self.delegate?.onDidDestroyViewInstance(id: CARD_FIELD_INSTANCE_ID)
} and then force re-render when bottom sheet is closed, this will close the kbd too... const [key, setKey] = useState(1);
<BottomSheetModal onDismiss={() => setKey(key + 1)}>
<CardField key={key} />
</BottomSheetModal> I still prefer to be able to call |
Does anyone have any ideas on how to dismiss the keyboard without the press triggering something else? We have the CardField in a scrollview containing other payment methods (things like loyalty points), and if you click off to dismiss the keyboard it is very easy to accidentally swap the payment method for something else. The best I can come up with so far is to track when the field is in use and disable the all of the other elements on screen. Bit tricky without an onBlur handler though Edit: I have shuffled things around so if someone presses another element while the CardField is in focus, that removes our tracking of the field being in focus (it also prevents the normal behaviour when pressing those elements). This let me work around a lack of onBlur, but it would be a lot cleaner if that existed. Even cleaner would be some way (maybe prop driven) to make it so if you press outside of the keyboard (and maybe check they aren't pressing the field component?), the keyboard is dismissed without the press doing anything else. I think I could do this purely in RN by putting up some kind transparent View on top of the entire screen based on the field having focus, but I don't know how I would still let the user press into the different sub-fields of the CardField component |
@cinnabarcaracal thanks for outlining your workaround. I've copied this to the |
Hi everyone! I'm still not able to resolve this, I've a modal with a TextInput from react-native and a Thanks so much everyone! Screen.Recording.2021-09-20.at.10.11.38.mov |
@johanjq You need to add It defaults to |
|
It's just boolean |
For bottomsheetmodal Use the CardForm ref to control keyboard dismiss. ` <Pressable ....other view components ` |
Describe the bug
There is no way to dismiss the keyboard (by pressing "Done", or taping away) using the
CardField
component from what I can tell. This is the same behavior in the example project as well.To Reproduce
Steps to reproduce the behavior:
CardField
component on a screenExpected behavior
A user can easily dismiss the keyboard.
The text was updated successfully, but these errors were encountered: