Skip to content

Commit

Permalink
feat: custom icon for clear in seachbar (callstack#965)
Browse files Browse the repository at this point in the history
  • Loading branch information
raajnadar authored and Trancever committed Jun 27, 2019
1 parent adb3337 commit c23d4eb
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/components/Searchbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ type Props = React.ComponentProps<typeof TextInput> & {
* Custom color for icon, default will be derived from theme
*/
iconColor?: string;
/**
* Custom icon for clear button, default will be icon close
*/
clearIcon?: IconSource;
};

/**
Expand Down Expand Up @@ -133,6 +137,7 @@ class Searchbar extends React.Component<Props> {
theme,
style,
iconColor: customIconColor,
clearIcon,
inputStyle,
...rest
} = this.props;
Expand Down Expand Up @@ -189,7 +194,7 @@ class Searchbar extends React.Component<Props> {
color={value ? iconColor : 'rgba(255, 255, 255, 0)'}
rippleColor={rippleColor}
onPress={this._handleClearPress}
icon="close"
icon={clearIcon || 'close'}
accessibilityTraits="button"
accessibilityComponentType="button"
accessibilityRole="button"
Expand Down

0 comments on commit c23d4eb

Please sign in to comment.