How to add strike through on Text in react native?
You can use textDecorationLine
with 'line-through' property like below:
<Text style={{ textDecorationLine: 'line-through' }}>$12</Text>
it will put a line over your text!
So you want to achieve this right??
<Text style={styles.oldPrice}>$19.19</Text>
just pass this style to the text component
const styles = StyleSheet.create({
oldPrice: {
textDecorationLine: 'line-through',
textDecorationStyle: 'solid',
},
});
<Text style={{ textDecorationLine: 'line-through' }}>Strike through text</Text>
You can find more text styling options from the official documentation here
With :
<Text style={{textDecorationLine: 'line-through', textDecorationStyle: 'solid'}}>
Solid line-through
</Text>