【问题标题】:Flexbox layout on child view not working React Native子视图上的 Flexbox 布局不起作用 React Native
【发布时间】:2019-05-30 07:48:00
【问题描述】:

尝试使用 put space-between 并使用 flexbox 拉伸出现在覆盖弹出屏幕中的按钮。这是屏幕主视图的子视图。只有 alignItems: 'center' 似乎正在努力对齐这些按钮。 任何帮助其他 flexbox 属性在此子视图上工作的帮助将不胜感激

<View style={{ flex: 1 }}>
            <ImageBackground
              style={{ width: Dimensions.get("window").width, height: 300 }}
              source={require("../../resources/img/image.jpeg")}
            />
            <View style={{ marginTop: -20, paddingLeft: 20, paddingRight: 20 }}>
              <MainButton onPress={this.openOverlay} size={MainButtonSize.medium}>
                {this.bookButton}
              </MainButton>
            </View>

            <Overlay
              visible={this.state.modalVisible}
              onClose={this.onClose}
              closeOnTouchOutside
              animationType="zoomIn"
              containerStyle={{ backgroundColor: "rgba(255, 255, 255, 0.78)" }}
              childrenWrapperStyle={{ backgroundColor: "red" }}
              animationDuration={350}
            >
              {(hideModal, overlayState) => (
                <View style={{ alignItems: "center" }}>. <== THIS VIEW
                  <MainButton size={MainButtonSize.large} onPress={this.onStaffPress}>
                    {this.staffButton}
                  </MainButton>

                  <MainButton size={MainButtonSize.large} onPress={this.onServicesPress}>
                    {this.serviceButton}
                  </MainButton>

                  <MainButton size={MainButtonSize.small} onPress={this.onClose}>
                    {this.closeButton}
                  </MainButton>
                </View>
              )}
            </Overlay>
          </View>

【问题讨论】:

    标签: react-native flexbox react-native-flexbox


    【解决方案1】:

    请尝试在 View 标签中设置 flex: 1

    【讨论】:

    • 谢谢,我必须这样做并增加弹出窗口的大小
    • 很高兴知道,伙计:)
    猜你喜欢
    • 1970-01-01
    • 2018-11-22
    • 2018-03-06
    • 2015-08-05
    • 2018-05-23
    • 2021-10-20
    • 1970-01-01
    • 2020-02-12
    • 2015-10-30
    相关资源
    最近更新 更多