title: How to change text Value upon Button press in React Native?
body: <p>I'm an iOS developer currently working on an experimental React Native app.</p>
  <p>I have the following code which shows a button and sample text on the screen.</p>
  <pre><code>import React from 'react';
  import { StyleSheet, Text, View , Button } from 'react-native';
  
  export default class App extends React.Component {
    constructor() {
      super();
      this.state = {sampleText: 'Initial Text'};
    }
  
    changeTextValue = () =&gt; {
      this.setState({sampleText: 'Changed Text'});
    }
  
    _onPressButton() {
      &lt;Text onPress = {this.changeTextValue}&gt;
        {this.state.sampleText}
      &lt;/Text&gt;
    }
  
    render() {
      return (
        &lt;View style={styles.container}&gt;
          &lt;Text onPress = {this.changeTextValue}&gt;
            {this.state.sampleText}
          &lt;/Text&gt;
  
          &lt;View style={styles.buttonContainer}&gt;
            &lt;Button
              onPress={this._onPressButton}
              title=&quot;Change Text!&quot;
              color=&quot;#00ced1&quot;
            /&gt;
          &lt;/View&gt;
        &lt;/View&gt;
      );
    }
  }
  
  const styles = StyleSheet.create({
    container: {
      flex: 1,
      backgroundColor: '#f5deb3',
      alignItems: 'center',
      justifyContent: 'center',
    },
    buttonContainer: {}
  });
  </code></pre>
  <p>The above code displays text and a button.</p>
  <p>However when I click the button, the app crashes instead of showing the new text which is to be shown.</p>
  <p>I'm new to React Native, kindly guide me on how to solve the error.</p>