It is possible to force a button to be focused ? I know the user can focused an element but I want to make it programmatically
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
Yes it is possible, with tvOS and react native if you want to force a focusable component to be focus you just need to set hasTVPreferredFocus to true
For example:
<TouchableHighlight
hasTVPreferredFocus={true}
onPress={() => {}}
>
<Text>Hello</Text>
</TouchableHighlight>