本地基础需要键盘覆盖内容

问题描述 投票:0回答:1

例如,有一个页脚,我希望键盘将其隐藏。现在我有这样的东西:

enter image description here

enter image description here

我需要做什么?

PS:我使用native-base。

react-native native-base
1个回答
1
投票

您必须

import { Keyboard } from "react-native";
并向其添加侦听器。每当键盘打开时,隐藏页脚。

类似:

  componentDidMount () {
    this.keyboardDidShowListener = Keyboard.addListener('keyboardDidShow', this._keyboardDidShow);
    this.keyboardDidHideListener = Keyboard.addListener('keyboardDidHide', this._keyboardDidHide);
  }

  componentWillUnmount () {
    this.keyboardDidShowListener.remove();
    this.keyboardDidHideListener.remove();
  }

  _keyboardDidShow () {
    // change the state of showFooter to false
  }

  _keyboardDidHide () {
    // change the state of showFooter to true
  }

查看键盘文档

© www.soinside.com 2019 - 2024. All rights reserved.