title: Expo/React Native error - TypeError: undefined is not an object (evaluating 'string.toLowerCase')
body: <p>So I'm making an React Native app, I have server and db set up on heroku.
  Using expo to view it on the phone and in web browser on my pc.</p>
  <p>On web, everything works right.</p>
  <p>On phone, I get the error from the screenshot. I guess there's a problem with data not coming on time or maybe there's a different way of writing things?</p>
  <p>Is there a way to get full app on phone without using android studio?</p>
  <p><a href="https://i.stack.imgur.com/Z7Oka.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Z7Oka.jpg" alt="enter image description here" /></a></p>
  <p>Here's the code related to error:</p>
  <pre><code>&lt;TextInput
      style={styles.input}
      placeholder='Search...'
      onChange={(e) =&gt; { this.handleInput(e.target.value) }}
  &gt;&lt;/TextInput&gt;
  
  
  handleInput = (value) =&gt; {
    if (value !== this.state.insertionIngredient) {
      this.setState({ ...this.state, insertionIngredient: value });
    };
  };
  
  handleFindButton = () =&gt; {
    this.setState({ ...this.state, isLoading: true });
  
    const id = searchString(this.state.insertionLanguage, this.state.data, 
                            this.state.insertionIngredient);
    const result = getById(this.state.queryLanguage, this.state.data, id);
  
    if (id === 'No such word in the database.' || result === 'No such word in the database.') {
      this.setState({ ...this.state, queryIngredient: 'No such word in the database.' });
    } else {
      this.setState({ ...this.state, queryIngredient: result });
    };
  };
  
  const searchString = (language, state, string) =&gt; {
    let array;
    if (language === 'english') {
        array = state.english;
    } else if (language === 'spanish') {
        array = state.spanish;
    } else if (language === 'german') {
        array = state.german;
    } else if (language === 'serbian') {
        array = state.serbian;
    };
  
    string = string.toLowerCase();
    let filter = escapeRegExp(string);
    let regex = new RegExp(&quot;^&quot; + filter, &quot;i&quot;);
  
    const word = array.filter(val =&gt; {
        return val.word.match(regex)
    });
  
    if (word.length &gt; 0) {
        return word[0].id;
    } else {
        return 'No such word in the database';
    }};
  </code></pre>
  <p><a href="https://i.stack.imgur.com/nGrp0.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/nGrp0.jpg" alt="How app looks" /></a></p>