title: Can't seem to return a value, only a promise
body: <p>Im trying to write my first react native app so it doesnt do anything real complicated, just getting a feel for things. Right now it has a button which increases a text field by 1 when i press it and I also want the button to now display some text from another function which I have imported.</p>
  
  <p>I have my main App.js and another file which i import into App.js which contains a function that returns a string value</p>
  
  <pre><code>import { myFunction } from './JSFunctions/functions.js'
  </code></pre>
  
  <p>myFunction runs fine on its own and will print its results to the console via console.log but when I add in the line</p>
  
  <pre><code>return output
  </code></pre>
  
  <p>all i get is</p>
  
  <pre><code>Promise { &lt;pending&gt; }
  </code></pre>
  
  <p>I realise I need to convert the promise by using <code>await</code> or <code>.then</code> somehow but ive been banging my head for hours on a desk trying to get it to work but I just get errors.</p>
  
  <p>here are the functions</p>
  
  <pre><code>export async function myFunction(){
  \\lots of other code here that has been removed 
      var i;
      var output;
      for (i = 0; i &lt; length; i++) { 
          output = DO STUFF AND CREATE A LONG STRING HERE
          console.log(output) //produces the correct output to console
      }
      return output;     
  }
  </code></pre>
  
  <p>Here is the function in App.js</p>
  
  <pre><code>export default class App extends React.Component {
  
    constructor(props) {
      super(props)
      this.state = { 
        count: 0, 
        output_string: ''
      }
    }
  
    onPress = () =&gt; {
      this.setState({
        count: this.state.count+1,
        output_string: myFunction()
      })
  
    }  
  
  
    render(){ 
      const handlePress = () =&gt; false
      return (
      &lt;React.Fragment&gt;
        &lt;View style = {styles.container}&gt;
          &lt;TouchableOpacity
            onPress={this.onPress}
          &gt;
            &lt;Text&gt;
              My First Button
            &lt;/Text&gt;
          &lt;/TouchableOpacity&gt;
  
          &lt;Text&gt;Hello World! This is a text area.&lt;/Text&gt;
          &lt;Text&gt;{ this.state.count !== 0 ? this.state.count: null}&lt;/Text&gt;
          &lt;Text&gt;{this.state.output_string}&lt;/Text&gt;
        &lt;/View&gt;
      &lt;/React.Fragment&gt;
      );
    }
  
  }
  </code></pre>