gpt4 book ai didi

react-native - 按住 textInput 时 react native 滚动不起作用

转载 作者:行者123 更新时间:2023-12-05 07:45:05 24 4
gpt4 key购买 nike

我有带有注册表单的安卓应用程序。它的代码:

<View style={{flex:1}}>
<ScrollView style={{flex:1, backgroundColor='#ffffff'}}>
<More components...>
<TextInput style={styles.inputText}
value={this.state.mail}
placeholder="Email"
onChangeText={(text)=>this.setState.(mail:text)}/>
<TextInput style={styles.inputText}
value={this.state.fName}
placeholder="First name"
onChangeText={(text)=>this.setState.(fName:text)}/>
<TextInput style={styles.inputText}
value={this.state.sName}
placeholder="Second name"
onChangeText={(text)=>this.setState.(sName:text)}/>
<More components...>
</ScrollView>
</View>

但是当用户按住 TextInput 并开始滚动时, View 不会滚动。在其他控件中,滚动效果很好。

最佳答案

<ScrollView style={{flex:1, backgroundColor='#ffffff'}}>
<View style={{flex:1}}>
<More components...>
<TextInput style={styles.inputText}
value={this.state.mail}
placeholder="Email"
onChangeText={(text)=>this.setState.(mail:text)}/>
<TextInput style={styles.inputText}
value={this.state.fName}
placeholder="First name"
onChangeText={(text)=>this.setState.(fName:text)}/>
<TextInput style={styles.inputText}
value={this.state.sName}
placeholder="Second name"
onChangeText={(text)=>this.setState.(sName:text)}/>
<More components...>

滚动元素必须包含一个 View

关于react-native - 按住 textInput 时 react native 滚动不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42209371/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com