Skip to content

TextInput cursor position when manipulating text #9615

@jbcullis

Description

@jbcullis

Problem Description

When manipulating text during the onChangeText event, if the cursor is not at the end it will jump to the end.
Video below is from mac but same behavior on Windows.

iOS and Android behave as expected.

Steps To Reproduce

Create the following element, add some text. Then, move cursor to the beginning of the text and add more characters.
This will cause the cursor to move to the end of the text input.

<TextInput style={{flex: 1, height: 40}} value={this.state.Txt} onChangeText={(e) => {this.setState({Txt: e.toUpperCase()});}}>

Expected Results

No response

CLI version

npx react-native --version

Environment

OS: Windows 10 10.0.22000
CPU: (16) x64 Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz
Memory: 21.85 GB / 31.73 GB
Binaries:
Node: 16.13.0 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.17 - ~\AppData\Roaming\npm\yarn.CMD
npm: 8.1.3 - C:\Program Files\nodejs\npm.CMD
Watchman: Not Found
SDKs:
Android SDK: Not Found
Windows SDK:
AllowDevelopmentWithoutDevLicense: Enabled
AllowAllTrustedApps: Enabled
Versions: 10.0.18362.0, 10.0.19041.0, 10.0.22000.0
IDEs:
Android Studio: Not Found
Visual Studio: 17.0.31912.275 (Visual Studio Community 2022)
Languages:
Java: Not Found
npmPackages:
@react-native-community/cli: Not Found
react: 17.0.2 => 17.0.2
react-native: 0.66.0 => 0.66.0
react-native-windows: 0.66.5 => 0.66.5
npmGlobalPackages:
react-native: Not Found

Target Platform Version

No response

Target Device(s)

No response

Visual Studio Version

No response

Build Configuration

No response

Snack, code example, screenshot, or link to a repository

Screen.Recording.2022-02-26.at.10.40.58.AM.mov

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions