Usage
Customize YOUR_NAVIGATION file:
import React from "react";
import {NavigationContainer } from '@react-navigation/native';
import { createNativeStackNavigator } from '@react-navigation/native-stack';
import VaultStack, {navigationRef } from 'shr-vaults/stack';
const Stack = createNativeStackNavigator(); // <--- add this
export default function AppNav(){
return(
<NavigationContainer
ref={navigationRef} // <--- add this
>
<Stack.Navigator>
{/*---your screens--*/}
{/*........*/}
{VaultStack} {/* <--add this */}
</Stack.Navigator>
</NavigationContainer>
)
}
initial and set config
SHRSdk.init('YOUR_CLIENT_ID', 'YOUR_CLIENT_SECRET', options)
// example: in your screen
import * as SHRSdk from 'shr-vaults';
const option ={
iosPathGroup: '', //(optional) ex: 'group.test.vaultdemo - only ios'
primaryColor: '#EF5DA8', //(optional) customize color for Login-sdk and signup-sdk
secondaryColor: '#ffffff', //(optional) customize color for Login-sdk and signup-sdk
headerLogo: require('./assets/logo.jpeg'), // (optional) - customize your logo
};
// initial
useEffect(()=>{
async function _init(){
try {
await SHRSdk.init('YOUR_CLIENT_ID', 'YOUR_CLIENT_SECRET', options);
}catch (e) {
console.error('encryptWithPublicKey error', error);
}finally {
setLoading(false);
}
};
_init();
},[]);
Props
Login
//...
import * as SHRSdk from 'shr-vaults';
//...
SHRSdk.login(function(isSuccess){
// do something ...
});
SignUp
//...
import * as SHRSdk from 'shr-vaults';
//...
SHRSdk.signup(function(isSuccess){
// do something ...
});
Remove account
//...
import * as SHRSdk from 'shr-vaults';
//...
SHRSdk.removeAccount();
Add document
//...
import * as SHRSdk from 'shr-vaults';
//...
SHRSdk.addDocument(({success: boolean, error: string})=>{
// your code ...
});
Get list document
//...
import * as SHRSdk from 'shr-vaults';
//...
const list:[] = await SHRSdk.getAllDocuments();
Get document detail (by ID)
//...
import * as SHRSdk from 'shr-vaults';
//...
const detail = await SHRSdk.getShareRingDocumentById(document_id);
Remove document by ID
//...
import * as SHRSdk from 'shr-vaults';
//...
const isSuccess:boolean = await SHRSdk.removeDocumentsByID(document_id);
ShareRing Link query
//updating ....
Get user info
//...
import * as SHRSdk from 'shr-vaults';
//...
const data = await SHRSdk.getUserInfo();