-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
feat: Add onClearIconPress to SearchBar #3679
Conversation
1f3345d
to
d864c27
Compare
af701c0
to
fab09fe
Compare
root.current?.clear(); | ||
rest.onChangeText?.(''); | ||
onClearIconPress?.(e); |
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.
In order to accept the PR please add an unit test confirming that onClearIconPress
is called when clear button is pressed
Hi @lukewalczak thanks for your reply. Sorry for late response I was on vacation. I think now everything is ready. |
Hey @n0tl3ss, thanks for PR adjustments. Please correct the commit message in order to merge it (according to the contribution guide). |
Hi, @lukewalczak. Is commit message now ok? :) |
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.
Thanks @n0tl3ss for addressing the feedback and adding a new functionality!
The commit message is still not correct, it should be |
@lukewalczak I think now commit and title of PR is fixed |
Summary
This PR adds the
onClearIconPress
prop to theSearchbar
component. IfonClearIconPress
is defined when pressing close button on search the default behaviour will be executed and after that users' hook will be executed. This for an example allowsKeyboard.dismiss()
to be called from hook.Test plan
There is no visually changes. Adding
onClearIconPress={() => /* delete query text (default behaviour) and dismiss keyboard */ Keyboard.dismiss()}
toSearchBar
should dismiss keyboard after clearing text.This feature was requested in #1970