Skip to content
This repository was archived by the owner on Jun 13, 2023. It is now read-only.

Commit 3dc20c2

Browse files
committed
small fix
1 parent c0e7598 commit 3dc20c2

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

Tags/index.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,12 @@ class Tags extends React.Component {
3838
};
3939

4040
onChangeText = text => {
41+
const regex = new RegExp(`^[${this.props.createTagOnString.join("")}]+$`, 'g');
4142
if (text.length === 0) {
4243
this.showLastTag();
4344
} else if (
4445
text.length > 1 &&
46+
!text.match(regex) &&
4547
this.props.createTagOnString.includes(text.slice(-1)) &&
4648
!(this.state.tags.indexOf(text.slice(0, -1).trim()) > -1)
4749
) {
@@ -99,7 +101,8 @@ class Tags extends React.Component {
99101
renderTag
100102
} = this.props;
101103

102-
const onPress = e => {
104+
const onPress = event => {
105+
event.persist();
103106
if (deleteTagOnPress && !readonly) {
104107
this.setState(state =>
105108
({
@@ -111,11 +114,11 @@ class Tags extends React.Component {
111114
() => {
112115
this.props.onChangeTags &&
113116
this.props.onChangeTags(this.state.tags);
114-
onTagPress && onTagPress(index, tag, e, true);
117+
onTagPress && onTagPress(index, tag, event, true);
115118
}
116119
);
117120
} else {
118-
onTagPress && onTagPress(index, tag, e, false);
121+
onTagPress && onTagPress(index, tag, event, false);
119122
}
120123
};
121124

0 commit comments

Comments
 (0)