title: React Native - How to call function from other function?
body: <p>Maybe it is a stupid question but how to call function from other function? In my code I can call function from constructor but when I try call function "showValue()" from other function then I have this error:</p>
  
  <blockquote>
    <p>undefined is not a function (evaluating 'this.showValue()')</p>
  </blockquote>
  
  <p>My code:</p>
  
  <pre><code>import React, { Component } from 'react';
  import {
      AppRegistry,
      StyleSheet,
      Text,
      TextInput,
      Button,
      View
  } from 'react-native';
  const Realm =  require('realm');
  let realm;
  export default class TestComponent extends Component {
  
      constructor() {
          super();
          this.state = {
              dog:'',
              all:'',
          };
          this.startDB();
  
      }
      startDB(){
          realm = new Realm({
              schema: [{name: 'Dog', properties: {name: 'string'}}]
          });
      }
  
      adValue(e){
  
          realm.write(() =&gt; {
              realm.create('Dog', {name: e.nativeEvent.text});
          });
      }
  
      showValue(){
          let all =realm.objects('Dog');
          let show='';
         all.forEach((name)=&gt;{
              show+=name.name+" ";
          });
  
          this.setState({
              all:show
          })
      };
  
      remove(){
          this.showValue();
  
      }
      render() {
          return (
              &lt;View&gt;
                  &lt;Text&gt;
                      Count of Dogs in Realm: {realm.objects('Dog').length}
                  &lt;/Text&gt;
                  &lt;Button
                      color={'royalblue'}
                      onPress={this.remove}
                      title="Remove"
                  /&gt;
  
                  &lt;Button
                      color={'brown'}
                      onPress={this.showValue.bind(this)}
                      title="Show"
                  /&gt;
                  &lt;TextInput
                      placeholder={'dodaj psa'}
                      onSubmitEditing={(e)=&gt;this.adValue(e)}
  
                  /&gt;
                  &lt;Text&gt;{this.state.dog}&lt;/Text&gt;
                  &lt;Text&gt;{this.state.all}&lt;/Text&gt;
  
  
              &lt;/View&gt;
          )
      }
  
  }
  AppRegistry.registerComponent('TestComponent', () =&gt; TestComponent);
  </code></pre>
  
  <p>Why I can't call this function?
  Thank you.</p>