TypeError : undefined not an object - AsyncStorage

TypeError : undefined not an object - AsyncStorage

嗨,我似乎无法解决这个问题 - 我在 React Native 组件中使用 AsyncStorage 来加载文件路径字符串。当组件安装时我收到以下错误并且无法看到我在这里做错了什么,因为它几乎遵循记录的示例。 任何帮助将不胜感激。

"TypeError: undefined 不是一个对象(正在评估'_asyncStorage.AsyncStorage.getKeys')

这是我的代码:

import React, { Component } from 'react';
import BasicCard from './cards'
import {AsyncStorage} from '@react-native-community/async-storage'
import { 
    StyleSheet,    
    ScrollView,  
  } from 'react-native';


class NewPost extends Component{

  state={
    content:[]
  }

  componentDidMount(){
    this.getContent(this.getKeys())
  }

  getKeys = async () => {
    try{
      return await AsyncStorage.getKeys()
    }catch (e) {
      alert(e)
    }
  }

  getContent = async (keys) => {
    try{
      await AsyncStorage.multiGet(keys, store)
      this.setState({content:store})
    } catch (e) {
      alert ( e )
    }
  }



  render(){

    return( 
      <ScrollView style={styles.container}>
        {this.state.content.map((result,i,item) => (
          <BasicCard 
            imgName={item[i][0]}
            imgPath={item[i[1]]} />
        ))}
      </ScrollView>
    )
  }
}

export default NewPost;

const styles = StyleSheet.create({
  container: {
    flex: 1,
    flexDirection: 'column',
    backgroundColor: 'black',
  },   

});

asyncStorage 中没有名为 getkeys 的函数

refer this link to know the available functions in async storage

getKeys = async () => {
    try{
      return await AsyncStorage.getKeys()
    }catch (e) {
      alert(e)
    }
  }

改成这个

getKeys = async () => {
    try{
      return await AsyncStorage.getAllKeys()
    }catch (e) {
      alert(e)
    }
  }