Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TextInput-property selectTextOnFocus wrong behavior while input Text #47696

Open
drsag-mgr opened this issue Nov 19, 2024 · 3 comments
Open

TextInput-property selectTextOnFocus wrong behavior while input Text #47696

drsag-mgr opened this issue Nov 19, 2024 · 3 comments
Labels
Component: TextInput Related to the TextInput component. Needs: Author Feedback Needs: Repro This issue could be improved with a clear list of steps to reproduce the issue. Newer Patch Available

Comments

@drsag-mgr
Copy link

drsag-mgr commented Nov 19, 2024

Description

Let's assume that we have a TextInput field with a width of 50px and the attribute 'selectTextOnFocus=false'. The character 'W', for example, fits into this field 5x. If you enter another 'W', then the 1st 'W' disappears behind the left edge of the TextInput field - so far so good.

If you do the same with 'selectTextOnFocus=true', the entire content of the TextInput is selected when the 6th 'W' is entered. If you now type in another character, the selection is deleted and replaced by the current character - this is wrong and certainly not what you want.

Steps to reproduce

  1. Install the Application in Version 0.76.x
  2. Put <TextInput selectTextOnFocus='true' width='50' value={myVal} onChangeText={input=>setMyVal(input)} borderWidth=1/> on your TestScreen
  3. Now type text or numbers in the Field till your input is larger than the TextInput field.
  4. Now you will now notice that the entire text is always selected as soon as your input exceeds the size of the InputText field

React Native Version

0.76.x

Affected Platforms

Runtime - Android

Output of npx react-native info

System:
  OS: Windows 10 10.0.19045
  CPU: "(16) x64 AMD Ryzen 7 4800H with Radeon Graphics         "
  Memory: 12.61 GB / 31.37 GB
Binaries:
  Node:
    version: 18.20.5
    path: c:\tools\nvm\nodejs\node.EXE
  Yarn: Not Found
  npm:
    version: 10.8.2
    path: c:\tools\nvm\nodejs\npm.CMD
  Watchman: Not Found
SDKs:
  Android SDK:
    API Levels:
      - "21"
      - "22"
      - "25"
      - "27"
      - "28"
      - "29"
      - "30"
      - "31"
      - "33"
      - "34"
      - "35"
    Build Tools:
      - 28.0.3
      - 29.0.2
      - 30.0.2
      - 30.0.3
      - 33.0.0
      - 33.0.0
      - 33.0.1
      - 34.0.0
      - 35.0.0
    System Images:
      - android-22 | Google APIs Intel x86 Atom
      - android-25 | Google APIs Intel x86 Atom
      - android-29 | Intel x86 Atom_64
      - android-29 | Google APIs Intel x86 Atom
      - android-30 | Google APIs Intel x86 Atom
      - android-30 | Google Play Intel x86 Atom
    Android NDK: Not Found
  Windows SDK:
    AllowAllTrustedApps: Disabled
    Versions:
      - 10.0.17763.0
IDEs:
  Android Studio: AI-233.14808.21.2331.11842104
  Visual Studio: Not Found
Languages:
  Java: 1.8.0_322
  Ruby: Not Found
npmPackages:
  "@react-native-community/cli":
    installed: 15.0.1
    wanted: 15.0.1
  react:
    installed: 18.3.1
    wanted: 18.3.1
  react-native:
    installed: 0.76.2
    wanted: 0.76.2
  react-native-windows: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: true
iOS:
  hermesEnabled: Not found
  newArchEnabled: Not found

Stacktrace or Logs

No Stacktrace

Reproducer

NOT REPRODUCEABLE IN SNACK !!!!!!!!!!!!
https://snack.expo.dev/Q5Ik92dmP6Leh1YAPyWBB

Screenshots and Videos

file.mp4

Snack:
https://snack.expo.dev/Q5Ik92dmP6Leh1YAPyWBB

@react-native-bot
Copy link
Collaborator

Tip

Newer version available: You are on a supported minor version, but it looks like there's a newer patch available - 0.76.2. Please upgrade to the highest patch for your minor or latest and verify if the issue persists (alternatively, create a new project and repro the issue in it). If it does not repro, please let us know so we can close out this issue. This helps us ensure we are looking at issues that still exist in the most recent releases.

@react-native-bot react-native-bot added Newer Patch Available Component: TextInput Related to the TextInput component. Needs: Author Feedback Needs: Repro This issue could be improved with a clear list of steps to reproduce the issue. labels Nov 19, 2024
@react-native-bot
Copy link
Collaborator

Tip

Newer version available: You are on a supported minor version, but it looks like there's a newer patch available - undefined. Please upgrade to the highest patch for your minor or latest and verify if the issue persists (alternatively, create a new project and repro the issue in it). If it does not repro, please let us know so we can close out this issue. This helps us ensure we are looking at issues that still exist in the most recent releases.

@react-native-bot
Copy link
Collaborator

Warning

Missing reproducer: We could not detect a reproducible example in your issue report. Please provide either:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: TextInput Related to the TextInput component. Needs: Author Feedback Needs: Repro This issue could be improved with a clear list of steps to reproduce the issue. Newer Patch Available
Projects
None yet
Development

No branches or pull requests

2 participants