首页 > 解决方案 > KeyboardAvoidingView 内具有绝对位置的按钮“覆盖”其他元素

问题描述

我有一个绝对位置的按钮,用于表单。在 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>

在此处输入图像描述

我试过behavior="position"了,它破坏了所有的布局,behavior="height"也不起作用。

标签: javascriptreactjsreact-nativeexpostyled-components

解决方案


推荐阅读