mirror of
https://github.com/status-im/react-native-securerandom.git
synced 2026-08-27 17:11:14 +00:00
2dad2dcae6c5190c8099017cbbe9cf0f26ed453e
react-native-random-bytes
Getting started
$ npm install react-native-random-bytes --save
Mostly automatic installation
$ react-native link react-native-random-bytes
Manual installation
iOS
- In XCode, in the project navigator, right click
Libraries➜Add Files to [your project's name] - Go to
node_modules➜react-native-random-bytesand addRNRandomBytes.xcodeproj - In XCode, in the project navigator, select your project. Add
libRNRandomBytes.ato your project'sBuild Phases➜Link Binary With Libraries - Run your project (
Cmd+R)<
Android
- Open up
android/app/src/main/java/[...]/MainActivity.java
- Add
import com.reactlibrary.RNRandomBytesPackage;to the imports at the top of the file - Add
new RNRandomBytesPackage()to the list returned by thegetPackages()method
- Append the following lines to
android/settings.gradle:include ':react-native-random-bytes' project(':react-native-random-bytes').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-random-bytes/android') - Insert the following lines inside the dependencies block in
android/app/build.gradle:compile project(':react-native-random-bytes')
Windows
- In Visual Studio add the
RNRandomBytes.slninnode_modules/react-native-random-bytes/windows/RNRandomBytes.slnfolder to their solution, reference from their app. - Open up your
MainPage.csapp
- Add
using Random.Bytes.RNRandomBytes;to the usings at the top of the file - Add
new RNRandomBytesPackage()to theList<IReactPackage>returned by thePackagesmethod
Usage
import RNRandomBytes from 'react-native-random-bytes';
// TODO: What to do with the module?
RNRandomBytes;
Languages
C#
31.3%
C++
28.6%
Java
16%
Objective-C
9%
JavaScript
6%
Other
9.1%