You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Touchable components do not have a focus() method -- that is a TextInput method. If you want to programmatically change focus, you should set the hasTVPreferredFocus prop on the component you want to focus.
Thanks. Shouldn't that be reflected in typescript as it identifies the focus() function as a valid function inherited from the interface NativeMethods?
(I've updated the example repository to use typescript)
@ivodaveiga I do see that the focus() method is there in the types -- maybe that is a bug in in @types/react-native. Checking the official docs at https://reactnative.dev, it does not appear that the method exists in any core components except TextInput.
Description
The
focus()
function throws an error (No command found with name "focus"
) when invoked on a touchable ref.Tested on "Apple TV" simulator.
React Native version:
Steps To Reproduce
Use the reproducible demo below
Button 1
Expected Results
Button 2
is focusedSnack, code example, screenshot, or link to a repository:
https://github.com/ivodaveiga/react-native-tvos-focus-test
The text was updated successfully, but these errors were encountered: