carbon-design-system / carbon-react-native

The React Native implementation of the Carbon Design System
https://carbon-design-system.github.io/carbon-react-native/
Apache License 2.0
30 stars 8 forks source link

Search: callback on clear press #108

Closed WYXEhlEtzb2Gfe6HgrQLAf6MeMEatE77yYzHHIH closed 1 year ago

WYXEhlEtzb2Gfe6HgrQLAf6MeMEatE77yYzHHIH commented 1 year ago

Add callback for clear press on the search.

OnTextClearPress prop

keep currently behavior just call this function as more informational.

WYXEhlEtzb2Gfe6HgrQLAf6MeMEatE77yYzHHIH commented 1 year ago

Added:

// textBeforeClear is whatever text was in the box prior to clear
// Event is onPress event from React
onTextClearPress?: (textBeforeClear: string, event: GestureResponderEvent) => void;
WYXEhlEtzb2Gfe6HgrQLAf6MeMEatE77yYzHHIH commented 1 year ago

Pushed to NPM (v0.3.0)