当键盘出现时,用输入文本向上滑动固定页脚
Slide up fixed footer with input text when keyboard appears
我正在尝试向上滑动应用程序的某些部分。
我搜索了一些信息,然后在 Whosebug 中找到了这个 post -> How to auto-slide the window out from behind keyboard when TextInput has focus?
问题是我的应用有点不同,我不知道将 Scrollview 标签放在哪里。
我得到了这个分布:
<View style={ styles.container }>
<View style={ styles.header }>
<View style={ styles.headerTextContainer }>
<Text style={ styles.headerText } onPress={() => this.refs.listView.getScrollResponder().scrollTo(0) }>Parte { this.props.partNumber } - { this.state.totalComments } comentarios</Text>
</View>
</View>
<ListView
dataSource={this.state.dataSource}
renderRow={this.renderComment}
style={ styles.content }
ref="listView" />
<View style={ styles.footer }>
<View style={ styles.footerTextInputContainer }>
<TextInput
style={ styles.footerTextInput }
onChangeText={(text) => console.log(text) }
placeholder="Escribe un comentario" />
</View>
<TouchableHighlight onPress={() => console.log("SEND COMMENT") } underlayColor="#ffffff">
<View style={ styles.footerSendButtonContainer }>
<Text style={ styles.footerSendButton }>Enviar</Text>
</View>
</TouchableHighlight>
</View>
</View>
出现键盘时我唯一想向上滑动的是页脚视图。
希望有人能帮帮我。
谢谢:)
我能够通过使用这个组件来做到这一点:react-native-keyboard-spacer
谢谢!
我正在尝试向上滑动应用程序的某些部分。
我搜索了一些信息,然后在 Whosebug 中找到了这个 post -> How to auto-slide the window out from behind keyboard when TextInput has focus?
问题是我的应用有点不同,我不知道将 Scrollview 标签放在哪里。
我得到了这个分布:
<View style={ styles.container }>
<View style={ styles.header }>
<View style={ styles.headerTextContainer }>
<Text style={ styles.headerText } onPress={() => this.refs.listView.getScrollResponder().scrollTo(0) }>Parte { this.props.partNumber } - { this.state.totalComments } comentarios</Text>
</View>
</View>
<ListView
dataSource={this.state.dataSource}
renderRow={this.renderComment}
style={ styles.content }
ref="listView" />
<View style={ styles.footer }>
<View style={ styles.footerTextInputContainer }>
<TextInput
style={ styles.footerTextInput }
onChangeText={(text) => console.log(text) }
placeholder="Escribe un comentario" />
</View>
<TouchableHighlight onPress={() => console.log("SEND COMMENT") } underlayColor="#ffffff">
<View style={ styles.footerSendButtonContainer }>
<Text style={ styles.footerSendButton }>Enviar</Text>
</View>
</TouchableHighlight>
</View>
</View>
出现键盘时我唯一想向上滑动的是页脚视图。
希望有人能帮帮我。
谢谢:)
我能够通过使用这个组件来做到这一点:react-native-keyboard-spacer
谢谢!