【发布时间】:2019-03-30 08:23:18
【问题描述】:
React-Native 新手在这里遇到问题,想知道我是否错过了安装软件包的基本步骤。
我一直在尝试使用 react-native-rsa-native 包 (https://github.com/amitaymolko/react-native-rsa-native)
但是我得到了
TypeError: undefined is not an object (evaluating '_reactNativeRsaNative.RSA.generateKeys')
我的测试代码是:
import React from 'react';
import { StyleSheet, Text, View } from 'react-native';
import { RSA, RSAKeychain } from 'react-native-rsa-native';
export default class App extends React.Component {
componentWillMount() {
RSA.generateKeys(4096) // set key size
.then(keys => {
console.log('4096 private:', keys.private) // the private key
console.log('4096 public:', keys.public) // the public key
});
}
render() {
...
}
}
随后的步骤是:
expo init rsatest --template blank@sdk-31 --yarn
cd rsatest
yarn add react-native-rsa-native
react-native link react-native-rsa-native
yarn start
react-native-rsa-native 包确实出现在 node_modules 目录中,但是我觉得我缺少一些东西。
有什么想法吗?
【问题讨论】:
标签: react-native package