用边框和边距装饰文本的一部分

时间:2018-11-06 20:52:07

标签: react-native

我正在尝试用react-native装饰部分文本。我设法使用嵌套的<Text>组件将背景添加到部分文本中。看起来像这样:

实际:

Actual Decoration

<Text>
    The Python shell used in the terminal is called a
    <Text style={...}>{` ??? `}</Text>
    interpreter.
</Text>

但是,这不允许您添加边框半径,边距或填充。我正在寻找的是这样的:

预期:

Expected Decoration

1 个答案:

答案 0 :(得分:0)

考虑使用View,这是一个小例子:

<View style={{flexDirection:'row'}}>
  <Text>The Python shell used in the terminal is called a</Text>
  <View style={{you can apply your style here}}><Text>{` ??? `}</Text></View>
  <Text>interpreter.</Text>
</View>
相关问题