xtrinch
xtrinch

Reputation: 2281

React native textDecoration properties not working on Android

I am using on

<Text style={styles.sampleStyle}> Something </Text>

the following styles:

sampleStyle: {
    textDecorationLine: "underline",
    textDecorationStyle: "solid",
    textDecorationColor: "#000",
}

However, they don't seem to be working. What am I doing wrong?

Upvotes: 33

Views: 48788

Answers (3)

root
root

Reputation: 173

sampleStyle: {
   textDecorationLine: "underline",
   textDecorationStyle: "solid",
   textDecorationColor: "#000",
}

only works on ios

Upvotes: 0

Katrina Kozorezov
Katrina Kozorezov

Reputation: 33

<Text style={styles.sampleStyle}>Something</Text>

var styles = StyleSheet.create({
    sampleStyle: {
        color: "#000"
    }
});

An old question, but here's a quick answer for those still searching in 2020+

For Android it seems that simply using color: is what is needed. If you take a look at the docs, textDecorationColor is labeled for ios use. https://reactnative.dev/docs/text-style-props

Upvotes: 3

G. Hamaide
G. Hamaide

Reputation: 7106

You didn't specify the style you want for your Text component. Try with :

<Text style={styles.sampleStyle} >Something </Text>

var styles = StyleSheet.create({
  sampleStyle: {
    textDecorationLine: "underline",
    textDecorationStyle: "solid",
    textDecorationColor: "#000"
  }
});

Upvotes: 51

Related Questions