|
|
@ -76,9 +76,15 @@ class TagInput extends Component {
|
|
|
|
// Listeners
|
|
|
|
// Listeners
|
|
|
|
|
|
|
|
|
|
|
|
onTagEdit = ({ value, ...otherProps }) => {
|
|
|
|
onTagEdit = ({ value, ...otherProps }) => {
|
|
|
|
this.setState({ value });
|
|
|
|
const currentValue = this.state.value;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (currentValue && this.props.onTagReplace) {
|
|
|
|
|
|
|
|
this.props.onTagReplace(otherProps, { name: currentValue });
|
|
|
|
|
|
|
|
} else {
|
|
|
|
this.props.onTagDelete(otherProps);
|
|
|
|
this.props.onTagDelete(otherProps);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.setState({ value });
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
onInputContainerPress = () => {
|
|
|
|
onInputContainerPress = () => {
|
|
|
@ -232,7 +238,7 @@ class TagInput extends Component {
|
|
|
|
<AutoSuggestInput
|
|
|
|
<AutoSuggestInput
|
|
|
|
{...otherProps}
|
|
|
|
{...otherProps}
|
|
|
|
forwardedRef={this._setAutosuggestRef}
|
|
|
|
forwardedRef={this._setAutosuggestRef}
|
|
|
|
className={styles.internalInput}
|
|
|
|
className={className}
|
|
|
|
inputContainerClassName={classNames(
|
|
|
|
inputContainerClassName={classNames(
|
|
|
|
inputContainerClassName,
|
|
|
|
inputContainerClassName,
|
|
|
|
isFocused && styles.isFocused
|
|
|
|
isFocused && styles.isFocused
|
|
|
@ -272,7 +278,8 @@ TagInput.propTypes = {
|
|
|
|
hasWarning: PropTypes.bool,
|
|
|
|
hasWarning: PropTypes.bool,
|
|
|
|
tagComponent: PropTypes.elementType.isRequired,
|
|
|
|
tagComponent: PropTypes.elementType.isRequired,
|
|
|
|
onTagAdd: PropTypes.func.isRequired,
|
|
|
|
onTagAdd: PropTypes.func.isRequired,
|
|
|
|
onTagDelete: PropTypes.func.isRequired
|
|
|
|
onTagDelete: PropTypes.func.isRequired,
|
|
|
|
|
|
|
|
onTagReplace: PropTypes.func
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
TagInput.defaultProps = {
|
|
|
|
TagInput.defaultProps = {
|
|
|
|