title: Change a button color by using onPress on React Native
body: <p>I would like to have button change its color when pressed. I tryed checking out other similar topics but I couldn't find a solution. The code renders and the initial button color is red, but when I press it, nothing happens.</p>
  
  <pre><code>export default class someProgram extends Component {
    render() {
  
    var buttonColor = "red";
  
    function changeButtonColor(){
      if(this.buttonColor === "red"){
        this.buttonColor = "green";
      }
      else{
        this.buttonColor = "red";
      }
    }
  
    return (
      &lt;View style={styles.container}&gt;      
        &lt;Button 
        title="Press me!"
        color={buttonColor}
        onPress={() =&gt; {changeButtonColor(buttonColor)}}  
        /&gt;
      &lt;/View&gt;
    );
   }
  }
  </code></pre>