React Native文本DecorationLine

jslywgbw  于 2022-12-04  发布在  React
关注(0)|答案(2)|浏览(144)

你好,我想得到下划线只有2个字母,但获得全文如何得到下划线只有前2个字母,下面是我用的代码来获得文本下划线。

<Text
                style={{
                  textDecorationLine: "underline",
                  textDecorationColor: "#F88022",
                  textDecorationStyle: "solid",
                  marginTop: SCREENHEIGHT * 0.08,
                  fontFamily: "Outfit-Regular",
                  fontSize: SCREENHEIGHT * 0.023,
                  color: "#0C0C0C",
                }}
              >
                Contract Details
              </Text>
hof1towb

hof1towb1#

在文本组件内使用文本组件

<Text>
your rest of the text
    <Text
        style={{
         textDecorationLine: "underline",
         textDecorationColor: "#F88022",
         textDecorationStyle: "solid",
         marginTop: SCREENHEIGHT * 0.08,
         fontFamily: "Outfit-Regular",
         fontSize: SCREENHEIGHT * 0.023,
         color: "#0C0C0C",
       }}>
          your underline text
      </Text>

</Text>
e0bqpujr

e0bqpujr2#

使用此代码:

<View style={{flexDirection: 'row'}}>
  <Text>The Other Text </Text>
    <Text
      style={{
        textDecorationLine: "underline",
        textDecorationColor: "#F88022",
        textDecorationStyle: "solid",
        marginTop: SCREENHEIGHT * 0.08,
        fontFamily: "Outfit-Regular",
        fontSize: SCREENHEIGHT * 0.023,
        color: "#0C0C0C",
      }}
    >
      Contract Details
    </Text>
  <Text>The Other Text </Text>
</View>

相关问题