-
Notifications
You must be signed in to change notification settings - Fork 10
Dismiss the keyboard when the picker opens on android #5
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
Dismiss the keyboard when the picker opens on android #5
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good and tests well!
cc: @tgolen
@@ -532,6 +532,12 @@ export default class RNPickerSelect extends PureComponent { | |||
onValueChange={this.onValueChange} | |||
selectedValue={selectedItem.value} | |||
{...pickerProps} | |||
onFocus={() => { | |||
Keyboard.dismiss(); | |||
if (pickerProps.onFocus) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure about how this repo does it, but in E/App we would also check to make sure that onFocus
is also a function before calling it. Should we do that here? It seems like it would be nice, so that the lib doesn't crash if someone passes something that isn't a function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That was what I initially thought too. But I check for the other callback (onOpen
, onClose
) and none of them check if it's a function. I think it's fine to let the app that implement the library to make sure a function is passed, just like React Native component that will throw an error if you give onPress
an integer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tgolen, thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I think that works for me. I'll be interested to see if they request something similar in the upstream repo's PR.
Dismiss the soft keyboard when the picker opens on Android. This will align the behavior with the iOS platform.
Related Issue: Expensify/App#15109
Upstream PR: lawnstarter#501