【发布时间】:2018-03-05 16:50:50
【问题描述】:
我的 React Native 视图几乎完成了,但我不确定如何在包含许多项目的页面中对单个项目进行分组。
如何将Details直接移动到Header下?
return (
<View style={s.container}>
<View style={[s.header, s.flexRow]}>
<Text style={s.carRegNr}> CV 515632 </Text>
<Text style={s.insuranceName}> Plus </Text>
</View>
<View style={s.flexColumn}>
<Text style={s.claimNrText}> Claim nr </Text>
<Text style={s.claimNr}> 020202 </Text>
</View>
<View style={s.flexColumn}>
<Text style={s.nextSteps}> Next steps </Text>
<Text style={s.nextStepsDetails}> Goto the repair shop </Text>
</View>
<View style={[s.flexRow, {justifyContent: "flex-end"}]}>
<CarRepairShop
name="Best Auto"
address1="Shiny road 1"
address2="0101 City"
/>
<CarRepairShop name="Rental" address1="Rental included"/>
</View>
<GjeButton
title="Close"
/>
{ /*
<GjeButton
title={"Set DamageClaimReceiptNr"}
onPress={ () => this.props.setDamageClaimReceiptNr("100") }
/>
<GjeButton
title={"Add car registration nr"}
onPress={ () => this.props.setCarRegNr("lkj2") }
/>
*/
}
</View>
)
}
}
样式
export default StyleSheet.create({
container: {
height: 10,
flex: 1,
padding: 30,
flexDirection: "column",
justifyContent: "flex-start"
},
header: {
justifyContent: "space-between",
borderColor: colors.grape,
borderRadius: 2,
},
carRegNr: {
fontWeight: "bold",
color: colors.black,
fontSize: 25,
},
groupTight: {
flexDirection: "column",
flex: 1,
justifyContent: "flex-start"
},
insuranceName: {
color: colors.black,
fontSize: 23
},
flexRow: {
flex: 1,
flexDirection: "row",
justifyContent: "space-between",
},
flexColumn: {
width: "100%",
flex: 1,
flexDirection: "column",
},
nextSteps: {
color: colors.black,
fontSize: 15,
},
nextStepsDetails: {
color: colors.black,
fontSize: 7,
},
bold: {
color: colors.black,
fontWeight: "bold",
},
cont: {
margin: 5,
padding: 3,
},
claimNrText: {
color: colors.black,
margin: 0,
padding: 0,
fontSize: 30,
},
claimNr: {
fontSize: 26,
}
})
【问题讨论】:
标签: reactjs react-native flexbox