mirror of
https://github.com/Grasscutters/Cultivation.git
synced 2025-12-15 00:24:45 +01:00
custom clear function
This commit is contained in:
@@ -11,6 +11,7 @@ interface IProps {
|
||||
readOnly?: boolean;
|
||||
id?: string;
|
||||
clearable?: boolean;
|
||||
customClearBehaviour?: () => void;
|
||||
style?: {
|
||||
[key: string]: any;
|
||||
}
|
||||
@@ -51,6 +52,10 @@ export default class TextInput extends React.Component<IProps, IState> {
|
||||
{
|
||||
this.props.clearable ?
|
||||
<div className="TextClear" onClick={() => {
|
||||
// Run custom behaviour first
|
||||
console.log('cleared')
|
||||
if (this.props.customClearBehaviour) return this.props.customClearBehaviour()
|
||||
|
||||
this.setState({ value: '' })
|
||||
|
||||
if (this.props.onChange) this.props.onChange('')
|
||||
|
||||
Reference in New Issue
Block a user