Skip to content

Commit 7e0281d

Browse files
authored
feat/renderInvalidTag_prop_in_chipsInput (#1044)
1 parent 317cac8 commit 7e0281d

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/components/chipsInput/index.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ class ChipsInput extends Component {
4242
* callback for custom rendering tag item
4343
*/
4444
renderTag: PropTypes.elementType,
45+
/**
46+
* callback for custom rendering invalid tag item
47+
*/
48+
renderInvalidTag: PropTypes.elementType,
4549
/**
4650
* callback for onChangeTags event
4751
*/
@@ -261,11 +265,15 @@ class ChipsInput extends Component {
261265
}
262266

263267
renderTag = (tag, index) => {
264-
const {tagStyle, renderTag} = this.props;
268+
const {tagStyle, renderTag, renderInvalidTag} = this.props;
265269
const {tagIndexToRemove} = this.state;
266270
const shouldMarkTag = tagIndexToRemove === index;
267271

268272
if (tag.invalid) {
273+
if (_.isFunction(renderInvalidTag)) {
274+
return renderInvalidTag(tag, index, shouldMarkTag, this.getLabel(tag));
275+
}
276+
269277
return (
270278
<View
271279
key={index}

0 commit comments

Comments
 (0)