6

I am looking for a way to make a diagonal line through a text element on react-native.

with an :after element and css this should be possible but this is not available in react-native.

Anybody cool suggestions?

3 Answers 3

6

Eventually, I went for a situation where I drew an absolute positioned line with a rotation on it.

<View
                style={{
                    position: 'absolute',
                    transform: [ {rotate: '17deg'} ],
                    top: 7,
                    width: 25,
                    height: 1,
                    borderBottomColor: styleGuide.errorColorRed,
                    borderBottomWidth: 1,
                }}/>
Sign up to request clarification or add additional context in comments.

Comments

0

if you want to make strick in text you should use something like this

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

2 Comments

also u can use this two props textDecorationColor: color (iOS) textDecorationStyle: enum('solid', 'double', 'dotted', 'dashed') (iOS)
Sure but this will make it a horizontal line. I am looking for a way to make diagonal line-through. Thanks anyhow.
-1

You can try this:

style={{ textDecorationLine: 'line-through' }}

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.