Programmatic focus of TextInput
in useEffect
fails silently in Bridgeless mode on iOS
#47359
Labels
Component: TextInput
Related to the TextInput component.
Issue: Author Provided Repro
This issue can be reproduced in Snack or an attached project.
Platform: iOS
iOS applications.
Type: New Architecture
Issues and PRs related to new architecture (Fabric/Turbo Modules)
Description
The
focus()
method ofTextInput
inuseEffect
doesn't work in Bridgeless mode on iOS. The input is not focused, and the soft keyboard doesn’t appear.Even worse, the
isFocused()
method returnstrue
regardless, so future calls tofocus()
are ignored because it considers the input already focused.Steps to reproduce
Check if the
TextInput
is focused initially. If so, the test passes. If not, proceed to steps 3-5.Click the Focus button.
Click the Blur button.
Click the Focus button.
Expected result: The
TextInput
is focused initially.Actual result: The
TextInput
is not focused initially and after the first time clicking the Focus button. It is only focused after clicking Blur and then clicking Focus again.React Native Version
0.76.1
Affected Platforms
Runtime - iOS
Output of
npx react-native info
Stacktrace or Logs
Reproducer
https://github.com/QichenZhu/reproducer-react-native-textinput-focus
Screenshots and Videos
bridgeless-enabled.mp4
bridgeless-disabled.mp4
The text was updated successfully, but these errors were encountered: