什么是本机Base中的._root_focus()

时间:2019-06-11 08:15:31

标签: react-native native-base

我正在经历这个medium article about creating OTP component in react-native

在文章中,我看到作者已在componentDidMount中添加了此内容

 componentDidMount() {
        this.otpTextInput[0]._root.focus();
    }

以上,我知道._root.focus()来自native base,但是from their docs我无法理解它的作用?

有人可以帮助我弄清楚它做什么吗?

1 个答案:

答案 0 :(得分:0)

他将所有输入元素保留在otpTextInput数组中,当打开页面时,otpTextInput数组中第一个加载的输入成为焦点