Skip to content

TextInput maxLength creates problems in emoji insertion in the end #22690

Closed
@JayantJoseph

Description

@JayantJoseph

Environment

React Native Environment Info:
System:
OS: Windows 10
CPU: (4) x64 Intel(R) Core(TM) i5-6400 CPU @ 2.70GHz
Memory: 1.71 GB / 7.91 GB
Binaries:
Yarn: 1.7.0 - ~\AppData\Roaming\npm\yarn.CMD
npm: 5.6.0 - C:\Program Files\nodejs\npm.CMD
IDEs:
Android Studio: Version 3.1.0.0 AI-173.4819257

Packages:
react: 16.6.3
react-native: 0.57.8

Description

Note:This issue is previously reported in issue #10964, but it seems it is marked resolved and closed. So I couldn't comment on it, as the bug still exists. The solution given as the last entry in #10964 doesn't actually solve this issue.

Consider a TextInput with maxLength = [ any value ]

At maxLength-1 enter a smiley with character length 2 [eg: mountain smiley, frowning face] .
Expected output: The smiley doesn't get inserted as only 1 character can be inserted, or the smiley is inserted completely considering it as a single character.
Actual output: The smiley gets cut and some other character is shown. Same could happen for other smileys also [with character length > 2].

Similarly,
At maxLength-2 enter a smiley with character length 3, and they get cut into some other symbols.

Note: I think this is because at maxLength -1, only one character can be entered, so when we insert a smiley at that position, only 1 character of the emoji is being entered and the rest is omitted. That is, if the smiley [say, character size 4] inserted is larger than the remaining space[say, 2], characters up to the remaining space is taken and the rest [2] are omitted. This is issue I am facing

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugComponent: TextComponent: TextInputRelated to the TextInput component.StaleThere has been a lack of activity on this issue and it may be closed soon.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions