不是自动获取焦点,是通过事件来给InputText获取焦点的方法,有没有?
可以通过设置是否加载textinput方法实现,如
var subView = null;
if (this.state.autoFocus) {
subView =
(<TextInput ref={(t)=>this._inputTf=t} style={{marginLeft:22,marginTop:-20,marginRight:22,height:120}} onChangeText={(text)=>this.onChangeText(text)} autoFocus={this.state.autoFocus} value={this.state.inputText}/>);
}
return <View style={{width:ScreenWidth}} >
{
subView
}
</View>
10 回答11.2k 阅读
5 回答4.8k 阅读✓ 已解决
4 回答3.1k 阅读✓ 已解决
2 回答2.7k 阅读✓ 已解决
3 回答2.3k 阅读✓ 已解决
3 回答2.2k 阅读✓ 已解决
2 回答2.6k 阅读✓ 已解决
1:看看官方文档有没有设置焦点的方法
2:如果没有那就设置 autoFocus={this.state.focus}
当你完成某个操作后设置this.setState{focus:true}.
I hope it help for you.