在KeyboardAvoidingView内部具有绝对位置的按钮“覆盖”其他元素

时间:2019-09-22 22:13:25

标签: javascript reactjs react-native expo styled-components

我有一个带有绝对位置的按钮,用于表格。在KeyboardAvoidingView内部时,它位于其他元素之上

const BtnContainer = styled.View`
  position: absolute;
  bottom: 38px;
  left: 16px;
  width: ${Dimensions.get('window').width - 32};
`

    <KeyboardAvoidingView
      behavior="padding"
      enabled
      style={{ flex: 1 }}
      keyboardVerticalOffset={60}
    >
        // form content
        <BtnContainer>
          <Button
            text={getButtonLabel()}
            disabled={!isButtonEnabled()}
            onPress={stepChangeCallBack}
          />
        </BtnContainer>
    </KeyboardAvoidingView>

enter image description here

我尝试了behavior="position",但它破坏了所有布局,并且behavior="height"也无效。

1 个答案:

答案 0 :(得分:-1)

这似乎是一个简单的CSS问题。在底部添加较少的像素可能会成功。尝试bottom: 30px

相关问题