React Native TextInput 不在 ScrollView 中滚动
React Native TextInput not scroll in ScrollView
我写了这样的代码:
<View style={{flex:1}}>
<ScrollView style={{flex:1, backgroundColor='#ffffff'}}>
<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)}/>
</ScrollView>
</View>
但是当我在 TextInput 中拖动开始时不滚动!
我像这样拖动:
enter image description here
但不滚动...
问题已解决。我只是将这个道具添加到 TextInput 组件:
multiline={true}
numberOfLines={1}
我写了这样的代码:
<View style={{flex:1}}>
<ScrollView style={{flex:1, backgroundColor='#ffffff'}}>
<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)}/>
</ScrollView>
</View>
但是当我在 TextInput 中拖动开始时不滚动! 我像这样拖动: enter image description here 但不滚动...
问题已解决。我只是将这个道具添加到 TextInput 组件:
multiline={true}
numberOfLines={1}