React-native-paper: Close Button on Searchbar

Created on 9 Jun 2018  路  5Comments  路  Source: callstack/react-native-paper


Current behaviour

I'm using Searchbar component of your library.
I request to an API on clicking the searchbar icon

Expected behaviour

I want to clear searchValue state variable on clicking the close button on searchbar
what should i do?

All 5 comments

Hi, @mmor93 You should just set your variable in state to empty string inside onIconPress callback. Does it work for you?

@Trancever
i will trigger the search function by onIconPress so i cant set my state to empty. i want to click on close button and set my state to empty.

Ok, so set this variable to empty inside onPress callback of button.

@Trancever
i cant because there is no props such onClosePress for Searchbar just onIconPress

Use onChangeText callback.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ButuzGOL picture ButuzGOL  路  4Comments

tonyxiao picture tonyxiao  路  3Comments

makhataibar picture makhataibar  路  4Comments

knobandre picture knobandre  路  4Comments

scottybo picture scottybo  路  3Comments