Skip to content

selectOnFocus does not work with autoFocus #43413

@AlexShukel

Description

@AlexShukel

Description

When using selectOnFocus with autoFocus, text is not being selected automatically on first mount.

Steps to reproduce

  1. Open Expo Snack link - https://snack.expo.dev/@alexshukel/selectonfocus-bug
  2. Text in TextInput is not selected automatically on mount

React Native Version

0.73.6

Affected Platforms

Runtime - Android

Output of npx react-native info

System:
  OS: Windows 11 10.0.22631
  CPU: (12) x64 Intel(R) Core(TM) i7-10850H CPU @ 2.70GHz
  Memory: 13.95 GB / 31.61 GB
Binaries:
  Node:
    version: 20.11.0
    path: C:\Program Files\nodejs\node.EXE
  Yarn:
    version: 1.22.21
    path: ~\AppData\Local\pnpm\yarn.CMD
  npm:
    version: 10.2.4
    path: C:\Program Files\nodejs\npm.CMD
  Watchman:
    version: 20231008.002904.0
    path: C:\soft\watchman-v2023.10.09.00-windows\bin\watchman.EXE
SDKs:
  Android SDK: Not Found
  Windows SDK: Not Found
IDEs:
  Android Studio: Not Found
  Visual Studio:
    - 17.8.34330.188 (Visual Studio Community 2022)
Languages:
  Java: javac 11
  Ruby: Not Found
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.73.6
    wanted: 0.73.6
  react-native-windows: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: Not found
  newArchEnabled: Not found

Stacktrace or Logs

Not seeing selected text in the input.

Reproducer

https://snack.expo.dev/@alexshukel/selectonfocus-bug

Screenshots and Videos

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions