From a94d28d53d88863f10f8d383faa7a85e427ad21b Mon Sep 17 00:00:00 2001 From: 1Jesper1 <1jesper1@gmail.com> Date: Thu, 3 Mar 2022 14:50:18 +0100 Subject: [PATCH] Update README.md Add information to use library in React Native. --- README.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/README.md b/README.md index b6e47dc..95bec0f 100644 --- a/README.md +++ b/README.md @@ -99,6 +99,22 @@ require(["crypto-js"], function (CryptoJS) { ``` +### Usage in React Native (>= [crypto-js 4.0.0](https://github.com/1Jesper1/crypto-js/edit/develop/README.md#400)) + +```javascript +import 'react-native-get-random-values'; +import crypto from 'crypto-js'; +``` + +1. Check inlineRequires: true in metro.config.js +2. ``npm i crypto-js`` +3. ``npm i react-native-get-random-values`` +4. ``cd ios/ && pod install`` +5. Rebuild app +6. Add import 'react-native-get-random-values'; before crypto-js import. For example at the top of App.js. + +See https://www.npmjs.com/package/react-native-get-random-values + ## API See: https://cryptojs.gitbook.io/docs/