title: TypeError: undefined is not an object (evaluating '_asyncStorage.AsyncStorage.setItem')
body: <h2>Version:</h2>
  <pre><code>@react-native-community/async-storage = ^1.6.1
  </code></pre>
  <h2>Problem:</h2>
  <ol>
  <li><em>Importing AsyncStorage like this:</em></li>
  </ol>
  <pre><code>import { AsyncStorage } from '@react-native-community/async-storage'
  </code></pre>
  <ol start="2">
  <li><em>Using in my code like this:</em></li>
  </ol>
  <pre><code>AsyncStorage.setItem('locale', locale)
  
  AsyncStorage.getItem('user').then((value) =&gt; 
  {
  ...
  }
  </code></pre>
  <h2>Errors:</h2>
  <ol>
  <li>TypeError: undefined is not an object (evaluating
  '_asyncStorage.AsyncStorage.setItem')</li>
  <li>TypeError: undefined is not an object (evaluating '_asyncStorage.AsyncStorage.getItem')</li>
  </ol>
  <h2>What I've tried</h2>
  <ol>
  <li>Importing <code>AsyncStorage</code> from 'react-native' gives no problems, only warning that <code>AsyncStorage</code> should be imported from '@react-native-community' because the <code>AsyncStorage</code> from 'react-native' is deprecated.</li>
  <li>Tried to uninstall and reinstall '@react-native-community/async-storage'-dependency, that didn't work.</li>
  <li>Googling it</li>
  </ol>
  <h2>Full code:</h2>
  <pre><code>import React from 'react';
  import { View, Image, NativeModules } from 'react-native';
  import { AsyncStorage } from '@react-native-community/async-storage'
  import { styles } from '../../components/Styles.js';
  import { GEOLocation } from '../../scripts/GEOLocation';
  import Moment from 'moment/min/moment-with-locales';
  
  export default class SplashScreen extends React.Component {
  
  
    constructor(props) {
      super(props);
      this.geo = new GEOLocation();
      this.setLocale();
      this.bootstrapAsync();
    }
  
  
    bootstrapAsync = async () =&gt; {
  
      this.geo.grantAccess()
  
      AsyncStorage.getItem('user').then((value) =&gt; {
        const user = JSON.parse(value);
        this.props.navigation.navigate(user ? 'App' : 'Auth');
      })
    };
  
    setLocale = () =&gt; {
      const deviceLocale = NativeModules.I18nManager.localeIdentifier
      var locale;
  
      if (deviceLocale.includes('_')) {
        var language = deviceLocale.split('_')[0]
        var country = deviceLocale.split('_')[1].toLowerCase()
  
        locale = language + '-' + country
      } else {
        locale = deviceLocale
      }
  
      if(Moment.locales().indexOf(locale) &gt; -1 ) {
        console.log('device locale')
        AsyncStorage.setItem('locale', locale)
      } else {
        console.log('default locale')
        AsyncStorage.setItem('locale', 'en')
      }
    }
  
  
    render() {
      return (
        &lt;View style={styles.container}&gt;
          &lt;Image style={styles.leImage} source={require('../../../assets/logo_icon.png')} /&gt;
        &lt;/View&gt;
      )
    }
  }
  </code></pre>