Skip to content
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

Better handle cancel button internally #137

Merged
merged 2 commits into from
Jan 8, 2018
Merged

Conversation

iRoachie
Copy link
Collaborator

@iRoachie iRoachie commented Jan 8, 2018

Only shows the cancel button when the search bar has focus. No more hacks with setting state on focus needed

@iRoachie iRoachie force-pushed the showCancelWhileEditing branch from ee211f8 to 4b75649 Compare January 8, 2018 18:59
@iRoachie iRoachie changed the title feat: Add showCancelWhileEditing prop feat: Add showCancelButtonWhileEditing prop Jan 8, 2018
@iRoachie
Copy link
Collaborator Author

iRoachie commented Jan 8, 2018

Simple markup to test behavior:

<SearchBar
  showsCancelWhileEditing
  ref={ref => (this.searchBar = ref)}
  barTintColor={Theme.primary}
  tintColor={Theme.secondary}
  onChangeText={(text: string) => this.searchChanged(text)}
  onSearchButtonPress={() => this.searchBar.blur()}
/>

Produces this output:

search bar

@iRoachie iRoachie force-pushed the showCancelWhileEditing branch 5 times, most recently from 7f21022 to 732faf4 Compare January 8, 2018 19:36
…us for showCancelWhileEditing

Rename showCancelWhileEditing to showCancelButtonWhileEditing
@iRoachie iRoachie force-pushed the showCancelWhileEditing branch from 732faf4 to 789a8d1 Compare January 8, 2018 19:37
@iRoachie iRoachie changed the title feat: Add showCancelButtonWhileEditing prop Show cancel button while editing Jan 8, 2018
@iRoachie iRoachie changed the title Show cancel button while editing Better handle cancel button internally Jan 8, 2018
@iRoachie iRoachie merged commit 0e8ba00 into next Jan 8, 2018
@iRoachie iRoachie deleted the showCancelWhileEditing branch January 8, 2018 20:24
iRoachie added a commit that referenced this pull request Jan 8, 2018
* feat: Handle cancel button behaviour on blur, cancel, search, and focus for showCancelWhileEditing

Rename showCancelWhileEditing to showCancelButtonWhileEditing

* fix(onCancelButtonPress): Clear text in search bar
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant