Skip to content

Commit 8055593

Browse files
authored
CharCounter now working with emojis (16-bit code) (#2570)
* CharCounter now working with emojis (16-bit code) * Fixed review notes
1 parent 1bf9548 commit 8055593

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/incubator/TextField/CharCounter.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,14 @@ import {CharCounterProps} from './types';
77

88
const CharCounter = ({maxLength, charCounterStyle, testID}: CharCounterProps) => {
99
const {value} = useContext(FieldContext);
10+
const length = value?.length ?? 0;
1011
if (_.isUndefined(maxLength)) {
1112
return null;
1213
}
1314

1415
return (
1516
<Text $textNeutral style={[styles.container, charCounterStyle]} testID={testID}>
16-
{`${_.size(value)}/${maxLength}`}
17+
{`${length}/${maxLength}`}
1718
</Text>
1819
);
1920
};

0 commit comments

Comments
 (0)