需求
顯示金額時(shí)璃吧,小數(shù)部分字體要小嫡纠,整數(shù)部分字體要大递沪。底部肯定是要對(duì)齊的勇蝙,如下圖
different-text-align-bottom
實(shí)現(xiàn)方法
<View style={styles.con}>
<Text style={[styles.big]}>
{v1}
<Text style={[styles.small]}>{v2}</Text>
</Text>
</View>
// 樣式
const styles = StyleSheet.create({
con: {
flexDirection: 'row',
justifyContent: 'flex-end',
alignItems: 'flex-end',
},
big: {
includeFontPadding: false,
fontSize: 16,
},
small: {
includeFontPadding: false,
fontSize: 14,
},
});
參考:
https://stackoverflow.com/questions/50467856/nested-text-vertical-align-not-working-react-native