react-tagsinput
react-tagsinput copied to clipboard
any chance for the tags to be editable?
i need this feature in my application
I am facing the same issue.
Already got asked for in #137 & #184
I rewrite renderTag as follows, hope it helps
renderTag = (props) => {
const { isTagFocus } = this.state
const { tag, key, diasbled, onRemove, classNameRemove, getTagDisplayValue, ...other } = props
return <span key={key} {...other} onBlur={() => { this.setState({ isTagFocus: false }) }}>
{isTagFocus
? <AutosizeInput
onChange={this.hangdleTagChange}
onFocus={(e) => {
this.setState({
tagEditIndex: this.state.inputBills.indexOf(e.target.value)
})
}}
value={getTagDisplayValue(tag)}
inputClassName={styles.tagEditInput}
/>
: <span onClick={() => { this.setState({ isTagFocus: true }) }}>
{getTagDisplayValue(tag)}
</span>
}
{!diasbled && <a className={classNameRemove} onClick={(e) => { onRemove(key) }}></a>}
</span>
}
and how do you implement this?
Simply add the renderTag prop like so
<TagsInput renderTag={this.renderTag}/>