Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add strike through on Text in react native?

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

like image 410
Madhur Avatar asked Aug 23 '17 07:08

Madhur


People also ask

How do you strike out text in react?

To cross out text on click in React:Set the onClick prop on the element. When the element is clicked, check if its text-decoration property is set. If the property is set, remove it, otherwise set it to line-through .

What is a strike through text?

A strikethrough is a horizontal line drawn through text, used to indicate the deletion of an error or the removal of text in a draft.

How do you strikethrough text in JavaScript?

To create a strikethrough text with JavaScript, use the strike() method. This method causes a string to be displayed as struck-out text as if it were in a <strike> tag.


1 Answers

With :

<Text style={{textDecorationLine: 'line-through', textDecorationStyle: 'solid'}}>   Solid line-through </Text> 
like image 185
Andrew Avatar answered Sep 18 '22 23:09

Andrew