react-native - 按钮未显示在视图中
问题描述
Hw 可以将 my 对齐Button
到 my 的底部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>
解决方案
尝试<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'
推荐阅读
- android - 如何在 Android Gradle 项目的项目配置阶段之前定义 ANDROID_HOME?
- powerbi - 如何收获切片机选择
- google-sheets - 如何在两个日期之间扩展数据?
- node.js - 如何在 node.js 中调用 Microsoft Graph API“https://graph.microsoft.com/v1.0/me/”?
- regex - 用于组合“匹配所有内容”和“负前瞻”的正则表达式
- amazon-web-services - DynamoDB 更新 - 只能在使用表达式时指定 ExpressionAttributeNames
- c++ - 递归函数如何返回它的值?
- linux - 组装 NASM - AND 掩码
- dart - Flutter FadeInImage Network - 在 setState 图像更改时不会淡入图像
- visual-studio - 如何从 Blender 导出 fbx 纹理以在 Monogame 中使用