How do I style child components through parent components?

1

I'm learning React native, and I'm having a question about styling child components more productively, because so far, I have to create a style and insert it into every component I want to style.

My question is: how to create only one style, and through it stylize the child components without having to insert the style in the child component?

For example:

<View style={ styles.pai }>
  <Text>Texto 1</Text>
  <Text>Texto 2</Text>
  <Text>Texto 3</Text>
</View>

I want all child Text components of the View component with the style style={ styles.pai } to have the color red.

In CSS this would be done using inheritance, like this:

.pai Text{
  color: red;
 }

How to do this in React native by leaving the code cleaner?

    
asked by anonymous 09.07.2018 / 18:01

0 answers