Closed marwan2 closed 5 years ago
You're listening for an event that will never happen. onCancelButtonPress
only fires when tapping the Cancel
button, there's no special event for tapping X
, just use onChange
Why don't you add event for pressing X button ?
UISearchBar doesn't have an event for this natively. The only way is to check if the string is empty in the onChange
OK I'll try it, thanks
First I'm using the search to call an API, not client side search. So the behaviour when I click X button to clear search is to go to function onCancelButtonPress
this is to call again the API after setState of searchKeyword to empty. This behviour not working.
and the cancel handler: