小编Kar*_*ala的帖子

在react-native中动态隐藏/显示标头

我正在使用react-navigation进行路由.我想在一个组件上动态隐藏或显示标题.有办法吗?

我像这样动态更改headerLeft但无法找到任何方法来为整个标头执行此操作.

static navigationOptions = ({ navigation }) => ({
    headerRight: navigation.state.params ? navigation.state.params.headerRight : null
});

this.props.navigation.setParams({
        headerRight: (
            <View>
                <TouchableOpacity onPress={() => blaa} >
                     <Text>Start</Text>
                </TouchableOpacity>
            </View>
        )
});
Run Code Online (Sandbox Code Playgroud)

我想要这样的东西 - 隐藏/显示基于状态的标题:

this.props.navigation.setParams({
        header: this.state.header
});
Run Code Online (Sandbox Code Playgroud)

react-native react-navigation

3
推荐指数
1
解决办法
4454
查看次数

对齐单选按钮时Flexbox问题

我试图使用包装器上的flex属性对齐单选按钮和它的标签.但是当标签是多行时,它的单选按钮看起来很高.看看屏幕截图.在此输入图像描述

这是我的html/css

.input-answer-wrapper{}
    .input-answer-wrapper .input-radio-item .radio-label{
        font-size: 12pt;
        color: #36464E;
        display: flex;
    }
    .input-answer-wrapper .input-radio-item .radio-label p{
        display: inline-block;
    }
    .input-answer-wrapper .input-radio-item .radio-label .label-text{
        margin-left: 10px;
    }
    .mg-radio{
      line-height: 16px;
      min-width: 20%;
      padding: 10px 10px 5px 10px;
      cursor: pointer;
    }

    .mg-radio! > input[type=radio] { display: none; }

    .mg-radio input[type="radio"] {
      position: absolute;
      opacity: 0;
    }
    .mg-radio input[type="radio"] + .radio-label:before {
      content: '';
      background: #f4f4f4;
      border-radius: 100%;
      border: 1px solid #b4b4b4;
      display: inline-block;
      width: 1.4em;
      height: 1.4em;
      position: relative;
      top: -0.2em; …
Run Code Online (Sandbox Code Playgroud)

html css css3 flexbox

2
推荐指数
1
解决办法
755
查看次数

标签 统计

css ×1

css3 ×1

flexbox ×1

html ×1

react-native ×1

react-navigation ×1