首页 > 解决方案 > 未定义的评估 frames.endCoordinates.height

问题描述

我已将 RN 升级到 0.59.1 并将本机基础更新到 2.13.5。出错

“未定义的frames.endCoordinates.height”

当我尝试textinputNative-Base内容在内部使用 react-native-keyboard-aware-scroll-view

这是来自KeyboardAwareHOC的函数react-native-keyboard-aware-scroll-view

 _updateKeyboardSpace = (frames: Object) => {
      if (this.props.enableAutomaticScroll) {
        let keyboardSpace: number =
          frames.endCoordinates.height + this.props.extraScrollHeight
        if (this.props.viewIsInsideTabBar) {
          keyboardSpace -= _KAM_DEFAULT_TAB_BAR_HEIGHT
        }

标签: react-nativereact-native-iosnative-base

解决方案


你的问题我无法理解你的意图。但你想做的似乎是这样的。

<KeyboardAwareScrollView
  onKeyboardWillShow={(frames: Object) => {
    console.log('Keyboard event', frames)
  }}>

这是正确的吗?您刚刚看到了react-native-keyboard-aware-scroll-view制作“ ”模块的代码。


推荐阅读