Sara
Sara

Reputation: 103

How to change the text color in a view in react native?

I have a view where I am trying to change the color of the text but I am unable to do so. Inside the disclaimer view I have tried to add the style as a prop and tried to change the color properties but it won't work. I've done the following:

 <View
          style={styles.webview}
          text={
            disclaimerText?.replace('\n', '<br />'), 
            style= {{color: palette.foreground.main}}}
          onScroll={handleScroll}
        />

Upvotes: 0

Views: 1936

Answers (1)

Srishruthik Alle
Srishruthik Alle

Reputation: 488

if you want to use color you have to use the Text component like this.

<View style={styles.webview} onScroll={handleScroll}>
    <Text text={
            disclaimerText?.replace('\n', '<br />'), 
            style= {{color: palette.foreground.main}}} >Some text</Text>
</View>

Upvotes: 1

Related Questions