Skip to content

Detecting caret position/selection change and/or get caret position/selection #24713

Closed
@CyberMew

Description

🐛 Bug Report

There is no way to track if a selection has been made or if the caret position has shifted, when the TextInput is already active (focused).

This is causing an issue if we needed the caret to always be on the far right end and this action shifts the caret/selection away.

There are no other callback functions being called when this event happens (do correct me if I am wrong).

To Reproduce

  1. Focus on a TextInput with some text.
  2. Get selection data from onSelectionChange or onFocus.
  3. Tap/Select on another portion of the text from the same TextInput.
  4. Now be frustrated when you can't get the new selection data.

Expected Behavior

onSelectionChange or onFocus should be called

Code Example

(too simple to re-create).

Environment

info
React Native Environment Info:
System:
OS: macOS 10.14.3
CPU: (12) x64 Intel(R) Core(TM) i7-8700B CPU @ 3.20GHz
Memory: 9.25 GB / 32.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 10.15.1 - /usr/local/bin/node
npm: 6.9.0 - /usr/local/bin/npm
SDKs:
iOS SDK:
Platforms: iOS 12.1, macOS 10.14, tvOS 12.1, watchOS 5.1
IDEs:
Xcode: 10.1/10B61 - /usr/bin/xcodebuild
npmPackages:
react: 16.8.3 => 16.8.3
react-native: ^0.59.5 => 0.59.5
npmGlobalPackages:
react-native-cli: 2.0.1

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions