键盘出现时,使用输入文本向上滑动固定页脚

时间:2016-01-24 16:33:43

标签: keyboard react-native keyboard-events

我正试图滑动我应用的某些部分。

我搜索了一些信息,我在Stackoverflow中找到了这篇文章 - > 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>

键盘出现时,我唯一想要向上滑动的是页脚视图。

我希望有人可以帮助我。

谢谢:)

1 个答案:

答案 0 :(得分:1)

我可以使用此组件来完成:react-native-keyboard-spacer

谢谢!