我正在使用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) 我试图使用包装器上的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)