在React Native应用程序中的文本前后行

时间:2017-11-19 23:52:50

标签: javascript android css reactjs react-native

如何在React Native app中为文本设置样式,就像截图一样?我有一些想法用于样式:before和:after伪元素,但这些元素在React Native中不存在。

screenshot

一些想法?

1 个答案:

答案 0 :(得分:0)

要为文字设置样式,并在其周围显示水平线,您可以将文字放在如下视图中:

<View>
      <View style={{alignSelf:'center',position:'absolute',borderBottomColor:'black',borderBottomWidth:1,height:'50%',width:'90%'}}/>
      <Text style={{alignSelf:'center',paddingHorizontal:5}}>Your text here</Text>
</View>