在React-Native> 0.44.0中切換到下一個TextInput
的正確方法是什麼?在React-Native中切換TextInputs
我試過它和.focus()
,但這沒有奏效。我發現的所有答案都過時了。
在React-Native> 0.44.0中切換到下一個TextInput
的正確方法是什麼?在React-Native中切換TextInputs
我試過它和.focus()
,但這沒有奏效。我發現的所有答案都過時了。
您應該指定ref到下一個文本輸入。試試這個
<TextInput
placeholder="first"
placeholderTextColor="rgba(0,0,0,0.5)"
returnKeyType="next"
onSubmitEditing={() => this.second.focus()}
/>
<TextInput
placeholder="second"
placeholderTextColor="rgba(0,0,0,0.5)"
returnKeyType="done"
ref={input => (this.second = input)} // This line is important
/>
這個應該肯定有效,試試看。 – Andreyco
我的問題是,我嵌套的元素,並試圖通過'ref'通過我的組件的孩子,但'ref'屬性永遠不會通過React –
你使用對焦() – digit
,它沒有定義,而不是一個功能 –
你嘗試喜歡指派裁判時,你得到了什麼錯誤:' this.refs = el} />' – Raymond