react-native-search-header
react-native-search-header copied to clipboard
Request - onClear prop
May we please get an onClear prop. onClear I want to clear out my search results. I added it in manually for now, but it would be awesome so I dont have to manually add this in everytime i update the package.
I'll get that feature implement for the next update soon. Thanks.
Thank you so so much!!
Is this what you are looking for?
<SearchHeader onClearSuggesstion = {() => true }/>
This will only clear if the function return true after componentWillReceiveProps is called.
There is also a clearSuggestion function that is called by ref.
Oh no, what i was looking for was when user presses the "X" icon it should trigger callback. If possible that would be super awesome.
Here is an example of what you can do with component ref method.
<SearchHeader ref = {(searchHeader) => { this.searchHeader = searchHeader; }} /> <View style = { styles.button }> <Button title = 'Clear Suggestion' onPress = {() => this.searchHeader.clearSuggestion()} /> </View>
Thanks thats cool but then i have to implement my own styling on the clear button :(
Your stryling is perfect.
@tuantle Really need this onClear()
prop.
This would trigger a callback when the (x) button is pressed or the text input data is cleared using clear()
method.
@adi23arora I have onClear callback prop implemented, but I did not put it in the docs and not tested. You can try it out to see if it is working. If not, I will fix it in the next update.
@tuantle I guess it's not working. I tried it out but there's no change when the (x) button is pressed to clear the text input.
I see. I'll will fit that and have an update in a day or two.
Please update to version 0.2.7. I tested it, but let me know if it is still not working.
@tuantle Thanks for the update, it's working now.