为什么我可以将Button
与RadioGroup
的底部对齐?
<View
style={{
height: 200,
padding: 12
}}
>
<Text style={{ fontSize: 16, color: "#fff", textAlign: "right" }}>
{this.props.current + 1} out of 10
</Text>
<Text style={{ fontSize: 32, fontWeight: "bold", color: "#fff" }}>
{this.props.question.question}
</Text>
<RadioGroup
onSelect={(index, answer) => onSelect(answer)}
selectedIndex={null}
>
{this.renderOptions(question)}
</RadioGroup>
<TouchableHighlight
style={{
height: 40,
width: 160,
borderRadius: 10,
backgroundColor: "yellow",
marginLeft: 50,
marginRight: 50,
marginTop: 20
}}
>
<Button
title="Submit Answer"
color="#fff"
onPress={() => {
this.props.onSelect(this.state.answer);
}}
/>
</TouchableHighlight>
</View>
答案 0 :(得分:0)
有一个<View style={{flexDireaction: "row"}}><View>content radio group</View><View>content button</View> </View>
尝试将其包装在视图中并添加样式:
position: 'absolute', right: 0, bottom: 0
或
flex: 1, flexDirection: 'column-reverse'
答案 1 :(得分:0)
该按钮未显示,因为您在height
的父级中有固定的<View>
,并且按钮的位置大于200高度。尝试增加父级的height
,或将其删除并添加flex: 1
。