我用:
ComponentDidMount(){
this.foca()
}
foca = () => {
this.refs.edit.focus()
}
<TextInput
ref='edit'
style={{height:60, borderColor:'gray', borderWidth:1, backgroundColor:'white', borderRadius:10}}
onChangeText={(text) => this.setState({busca: text})}
onSubmitEditing={(event) => this.props.navigation.navigate('Resultado', {busca: this.state.busca})}
/>
但它不起作用......
我喜欢在显示屏幕时将焦点设置在我的TextInput上