Search code examples
react-nativecoding-stylestylesheet

React Native StyleSheet.create pass props?


is it possible to pass props top the StyleSheets? If not what is the best alternative to it?


Solution

  • if I have a variable as a style I prefer to use as state and therefore use it in the style

    like :

    <p style={{height:this.state.height}}>complicated </p>
    

    you can use both

    <p style={styles.paragraph,{height:this.state.height}}></p>