android – How to add strike through on Text in react native?-ThrowExceptions

Exception or error:

Hey I want to add Strike Through in $10 amount for showing cut amount. Please check below :

<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>

Please add css so that i can align in a line of both text , Thanks in Advance.

Please check the images enter image description here

How to solve:

With :

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

###

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

You can find more text styling options from the official documentation here

###

Try this :

<Text style={{ textDecorationLine: 'line-through' }}>$12</Text>

It will strike through complete text.

Leave a Reply

Your email address will not be published. Required fields are marked *