How to pass style props for a specific component in react-native : <p>I tried creating a button with specific styles for its .
I had more than 3 properties like justifyContent, alignItems, backgroundColor and height. I wanted to pass a style from another component to this, so that the backgroundColor property of the button changes.</p>

<p>My Code:</p>

<pre><code>import React from 'react';
import { Text, TouchableOpacity } from 'react-native';

const Button = ({ buttonName, csCode }) =&gt; {
  const { buttonStyle, textStyle } = styles;

  return (
    &lt;TouchableOpacity style={{ buttonStyle, backgroundColor: [csCode] }}&gt;
      &lt;Text style={textStyle}&gt;
      {buttonName}
      &lt;/Text&gt;
    &lt;/TouchableOpacity&gt;
  );
};

const styles = {
  textStyle: {
    alignSelf: 'center',
    color: '#ffffff',
    fontSize: 35,
    fontWeight: '600',

  },
  buttonStyle: {
    justifyContent: 'center',
    alignSelf: 'stretch',
    height: '20%',
  }
};

export { Button };
</code></pre>

<p>Here, the buttonStyle is not applied to the buttons, instead only the backgroundColor prop is only being applied. Any help ?</p>

<p>Thanks.</p>
