- 
                Notifications
    You must be signed in to change notification settings 
- Fork 24.9k
Closed
Labels
BugComponent: TextComponent: TextInputRelated to the TextInput component.Related to the TextInput component.Platform: AndroidAndroid applications.Android applications.Platform: LinuxBuilding on Linux.Building on Linux.StaleThere has been a lack of activity on this issue and it may be closed soon.There has been a lack of activity on this issue and it may be closed soon.
Description
- Review the documentation: https://facebook.github.io/react-native
- Search for existing issues: https://github.com/facebook/react-native/issues
- Use the latest React Native release: https://github.com/facebook/react-native/releases
Environment
Run react-native info in your terminal and paste its contents here.
  React Native Environment Info:
    System:
      OS: Linux 4.15 Ubuntu 18.04.1 LTS (Bionic Beaver)
      CPU: x64 Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz
      Memory: 1.12 GB / 15.54 GB
      Shell: 4.4.19 - /bin/bash
    Binaries:
      Node: 10.9.0 - ~/.nvm/versions/node/v10.9.0/bin/node
      Yarn: 1.10.1 - /usr/bin/yarn
      npm: 6.4.1 - ~/.nvm/versions/node/v10.9.0/bin/npm
      Watchman: 4.9.0 - /usr/local/bin/watchman
    SDKs:
      Android SDK:
        Build Tools: 23.0.1, 23.0.2, 23.0.3, 25.0.0, 25.0.1, 25.0.2, 25.0.3, 26.0.1, 26.0.2, 27.0.0, 27.0.1, 27.0.3
        API Levels: 23, 24, 25, 26, 27
    npmPackages:
      @storybook/react-native: 4.0.11 => 4.0.11
      @types/react: ^16.7.13 => 16.7.13
      @types/react-native: ^0.57.17 => 0.57.17
      react: ^16.6.3 => 16.6.3
      react-native: 0.57.7 => 0.57.7
Description
So I have this TextInput component that's supposed to toggle between secureTextEntry, a common use case for showing/hiding password. The issue is that the text selection is reset to the start of the input and I can't find a way to set the cursor position to the end after toggling "show/hide password".
In other words, setting the property selection={{ start: number, end: number }} on a TextInput element seems to do nothing.
What's been attempted:
- Setting the selection state after a button click event.
- Updating selection state after the onSelectionChangeevent
- Using textInputRef.current.setNativeProps({ selection: {} })oncomponentDidUpdate
Image:
Reproducible Demo
maphongba008, floriancargoet, carlosfilipe, bobsmits and ankardon
Metadata
Metadata
Assignees
Labels
BugComponent: TextComponent: TextInputRelated to the TextInput component.Related to the TextInput component.Platform: AndroidAndroid applications.Android applications.Platform: LinuxBuilding on Linux.Building on Linux.StaleThere has been a lack of activity on this issue and it may be closed soon.There has been a lack of activity on this issue and it may be closed soon.
