title: How to change state value in react native?
body: <p>I have problem in changing value of state.It gives mi following error
  "Undefine is not a function(evaluating '
     this.setState({
       switchValue:false
  })')"</p>
  
  <p>I have search on stack overflow but the solution is not work for me.</p>
  
  <pre><code>import React, { Component } from 'react';
  import {
      Alert,
      AppRegistry,
      StyleSheet,
      Text,
      View,
      Switch
  } from 'react-native';
  
  export default class AwesomeProject extends Component {
     constructor(props) {
     super(props);
     this.state = {switchValue: true};
  
  // Toggle the state every second
  
  }
  _onPressButton() {  
     this.setState({
     switchValue: false
   });
  } 
  render() {
  return (
    &lt;View style={styles.container}&gt;
      &lt;Text style={styles.welcome}&gt;
        Welcome to React Native!
      &lt;/Text&gt;     
      &lt;Switch 
        onValueChange={this._onPressButton}
        value={this.state.switchValue } 
      /&gt;      
    &lt;/View&gt;
  );
  }
  }
  
  const styles = StyleSheet.create({
  container: {
     flex: 1,
     justifyContent: 'center',
     alignItems: 'center',
     backgroundColor: '#F5FCFF',
    },
   welcome: {
     fontSize: 20,
     textAlign: 'center',
    margin: 10,
  },
  instructions: {
    textAlign: 'center',
    color: '#333333',
    marginBottom: 5,
  },
  </code></pre>
  
  <p>});</p>
  
  <pre><code>AppRegistry.registerComponent('AwesomeProject', () =&gt; AwesomeProject);
  </code></pre>