如何在本机反应中添加文本删除线?

新手上路,请多包涵

嘿,我想以 10 美元的金额添加 Strike Through 以显示削减金额。请检查以下:

 <View style={styles.row}>
    <View style={styles.inputWrapstotal}>
        <Text style={styles.labelcolor}>16.7% Off</Text>
    </View>
    <View style={styles.inputWrapstotal}>
        <Text style={styles.labelamount}>Rs $10</Text>
        <Text style={styles.labelamountchange}> 12 </Text>
    </View>
</View>

请添加 css 以便我可以对齐两个文本的一行,在此先感谢。

请检查图像 在此处输入图像描述

原文由 Madhur 发布,翻译遵循 CC BY-SA 4.0 许可协议

阅读 443
2 个回答

和 :

 <Text style={{textDecorationLine: 'line-through', textDecorationStyle: 'solid'}}>
  Solid line-through
</Text>

原文由 Andrii Starusiev 发布,翻译遵循 CC BY-SA 3.0 许可协议

<Text style={{ textDecorationLine: 'line-through' }}>Strike through text</Text>

您可以从 此处 的官方文档中找到更多文本样式选项

原文由 alexdriedger 发布,翻译遵循 CC BY-SA 3.0 许可协议

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题