0.0.3 • Published 5 years ago

@pbteja-dev/share-kit-reactnative v0.0.3

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
5 years ago

Share Kit React Native

Share Kit React Native

React Native wrapper for Share Kit

Installation

Install share-kit-reactnative package

npm install --save @bloomprotocol/share-kit-reactnative

Link Libraries

react-native link react-native-randombytes
react-native link react-native-svg
react-native link react-native-linear-gradient

To allow the usage of node core modules, rn-nodeify is being used.

Note: You can also use any other method that you know to allow node core modules. Refer the rn-nodeify repo for any further details about rn-nodeify.

Install rn-nodeify

npm install --save-dev rn-nodeify@latest

In package.json, add a postinstall script as follows.

...
"scripts": {
    ...
    "postinstall": "./node_modules/.bin/rn-nodeify --hack --install"
}
...

Run

npm run postinstall

Usage

Check demo for complete example.

import { RequestButton, RequestData, Action } from "@bloomprotocol/share-kit-reactnative";

const requestData: RequestData = {
    action: Action.attestation,
    token: 'a08714b92346a1bba4262ed575d23de3ff3e6b5480ad0e1c82c011bab0411fdf',
    url: 'https://receive-kit.bloom.co/api/receive',
    org_logo_url: 'https://bloom.co/images/notif/bloom-logo.png',
    org_name: 'Bloom',
    org_usage_policy_url: 'https://bloom.co/legal/terms',
    org_privacy_policy_url: 'https://bloom.co/legal/privacy',
    types: ['phone', 'email'],
};

const buttonCallbackUrl = 'https://mysite.com/bloom-callback';

<RequestButton
    requestData={requestData}
    buttonCallbackUrl={buttonCallbackUrl} 
/>

More

For more information and documentation see Share Kit