TypeError: Undefined is not an object key store

TypeError: Undefined is not an object key store

我只是想将 RNSecureKeystore 添加到我的 React Native 项目中,但我总是收到错误消息:"TypeError: undefined is not an object (evaluating _reactNativeSecureKeystore.default.set')"。位于 DrawerNavScreen 的错误。

会不会是React Native版本的问题?

   import React, {Component} from 'react';
import {TextInput, TouchableHighlight, Modal, Button, Platform, StyleSheet, Text, View, Image} from 'react-native';
import {createStackNavigator, createDrawerNavigator} from 'react-navigation';
import RNSecureKeyStore, {ACCESSIBLE} from "react-native-secure-key-store";

   render(){

// For storing key
RNSecureKeyStore.set("key1", "value1", {accessible: ACCESSIBLE.WHEN_UNLOCKED})
  .then((res) => {
    console.log(res);
  }, (err) => {
    console.log(err);
  });

// For retrieving key 
RNSecureKeyStore.get("key1")
  .then((res) => {
    console.log(res);
  }, (err) => {
    console.log(err);
  });

// For removing key 
RNSecureKeyStore.remove("key1")
  .then((res) => {
    console.log(res);
  }, (err) => {
    console.log(err);
  });   

您的 RNSecureKeyStore 似乎在应用程序中不可用。您是否已成功将库链接在一起? react-native-link 应该这样做,否则它可能与您使用的 RN 版本有关。