vitalets / react-native-extended-stylesheet

Extended StyleSheets for React Native
MIT License
2.93k stars 132 forks source link

Question: When to use underscored styles ❓ #57

Closed deadcoder0904 closed 6 years ago

deadcoder0904 commented 6 years ago

I have read the docs about underscored styles but don't know what to use & why ❓

Currently, I'm using styles._text styles everywhere bcz once styles.text was not working.

So @vitalets if u can explain when to use underscored styles

vitalets commented 6 years ago

hi @deadcoder0904 ! Underscored styles are intended for components with explicit styling attributes. For example, <Icon color="red">. If you already defined styles for text:

const styles = EStyleSheet.create({
  text: {
    color: 'red'
  }
});

and want icon color to be the same, you can reuse text's style:

<Icon color={styles._text.color}>
deadcoder0904 commented 6 years ago

Cool got it thanks 🎉