title: Error: ReferenceError: getUnreadEmails is not defined
body: <p>please when I call the method getNumberOfUnreadEmails in the App.js i have this error : 
  YellowBox.js:67 Possible Unhandled Promise Rejection (id: 0):
  Error: ReferenceError: getUnreadEmails is not defined
  Error: ReferenceError: getUnreadEmails is not defined
      at blob:<a href="http://localhost:8081/16f9ab34-0ee8-4ee2-8319-83df5fb4878a:102968:19" rel="nofollow noreferrer">http://localhost:8081/16f9ab34-0ee8-4ee2-8319-83df5fb4878a:102968:19</a>
      at tryCallOne (blob:<a href="http://localhost:8081/16f9ab34-0ee8-4ee2-8319-83df5fb4878a:31155:14" rel="nofollow noreferrer">http://localhost:8081/16f9ab34-0ee8-4ee2-8319-83df5fb4878a:31155:14</a>)
      at blob:<a href="http://localhost:8081/16f9ab34-0ee8-4ee2-8319-" rel="nofollow noreferrer">http://localhost:8081/16f9ab34-0ee8-4ee2-8319-</a></p>
  
  <p>expect :
  give me the number of unread Messages</p>
  
  <p>AzureInstance.js</p>
  
  <pre><code>
   export default class AzureInstance {
  constructor(credentials) {
  this.authority = 'https://login.microsoftonline.com/common';
  this.authorize_endpoint = '/oauth2/v2.0/authorize';
  this.redirect_uri = 'https://login.microsoftonline.com/common/oauth2/nativeclient';
  this.token_endpoint ='/oauth2/v2.0/token';
  this.client_id = credentials.client_id;
  this.client_secret = credentials.client_secret;
  this.scope = credentials.scope;
  this.token = {};
  
  // function binding
  this.getConfig = this.getConfig.bind(this);
  this.setToken = this.setToken.bind(this);
  this.getToken = this.getToken.bind(this);
  this.getUserInfo = this.getUserInfo.bind(this);
  this.getUnreadEmails=this.getUnreadEmails.bind(this);
  this.getNumberOfUnreadEmails=this.getNumberOfUnreadEmails.bind(this);
  //this.getRequest=this.getRequest.bind(this);
  }
  
  getConfig(){
  return {
  authority: this.authority,
  authorize_endpoint: this.authorize_endpoint,
  token_endpoint: this.token_endpoint,
  client_id: this.client_id,
  client_secret: this.client_secret,
  redirect_uri: this.redirect_uri,
  scope: this.scope,
  }
  }
  
  setToken(token){
  this.token = token;
  }
  
  getToken(){
  return this.token;
  }
  getUserInfo()
  {
  try{
  return this.getRequest("https://graph.microsoft.com/v1.0/me");
  }
  catch(err){
  throw err;
  }
  }
  
  getNumberOfUnreadEmails()
  {
  return getUnreadEmails().value.length();
  }
  getUnreadEmails()
  {
  try{
  return this.getRequest("https://graph.microsoft.com/v1.0/me/mailFolders/Inbox/messages?$filter=isRead ne true");
  }
  catch(err){
  throw err;
  }
  }
  
  getRequest(req) {
  if (this.token === undefined){
  throw new Error("Access token is undefined, please authenticate using Auth first");
  }
  
  return fetch(req, {
  headers: {
  'Authorization': "Bearer " + this.token.accessToken,
  }
  }).then(response =&gt; {
  // return blob object
  return response.json()
  })
  .then(response =&gt; {
  // read blob object back to json
  return response
  }).catch(err =&gt; {
  // incase of error reject promise
  throw new Error(err);
  });
  }
  }
  </code></pre>
  
  <p>App.js</p>
  
  <pre><code>
  import React from 'react';
  import {AppRegistry,Text,StyleSheet,Picker} from 'react-native';
  import {View} from 'react-native-webview';
  
  import {AzureInstance, AzureLoginView} from '../src/screens/auth/';
  
  // CONSTANT
  const CREDENTIAILS = {
  client_id: '--------------------------',
  client_secret: '--------------------',
  scope: 'User.ReadBasic.All Mail.Read offline_access'
  };
  
  export default class azureAuth extends React.Component {
    constructor(props){
      super(props);
  this.state = {
  displayName : "Nan",
  mail : "",
  id : ""
  };
      this.azureInstance = new AzureInstance(CREDENTIAILS);
  this._onLoginSuccess = this._onLoginSuccess.bind(this);
    }
  
    _onLoginSuccess(){
      this.azureInstance.getUserInfo().then(result =&gt; {
  console.log(result);
      }).catch(err =&gt; {
        console.log(err);
  });
  this.azureInstance.getUnreadEmails().then(result =&gt;{
  console.log(result);
  }).catch(err =&gt;{
  console.log(err);
  });
  
  this.azureInstance.getNumberOfUnreadEmails().then(result =&gt;{
  console.log(result);
  }).catch(err =&gt;{
  console.log(err);
  });
    }
  
  render() {
  return (
  &lt;AzureLoginView
  azureInstance={this.azureInstance}
  loadingMessage="Requesting access token"
  onSuccess={this._onLoginSuccess}
  /&gt;
  );
  }
  }
  
  const styles = StyleSheet.create({
  container: {
  paddingTop: 23
  },
  baseText: {
  fontFamily: 'Cochin',
  },
  titleText: {
  fontSize: 20,
  fontWeight: 'bold',
  },
  });
  
  AppRegistry.registerComponent('azureAuth', () =&gt; azureAuth);
  </code></pre>