Skip to content

passiv/snaptrade-react-native-sdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SnapTrade React Native SDK

A React Native SDK for integrating the SnapTrade connection portal into your mobile applications. This SDK handles the WebView integration and message communication between your app and the SnapTrade portal.

Features

  • ✅ Cross-platform (iOS & Android)
  • ✅ Compatible with Expo and other React Native frameworks
  • ✅ TypeScript support
  • ✅ Simple integration with callbacks for all portal events
  • ✅ Lightweight with minimal dependencies

Installation

# Using npm
npm install snaptrade-react-native-sdk react-native-webview

# Using yarn
yarn add snaptrade-react-native-sdk react-native-webview

# Using pnpm
pnpm add snaptrade-react-native-sdk react-native-webview

Note: This package depends on react-native-webview. If you're using Expo, WebView is already included. For bare React Native projects, follow the react-native-webview installation instructions.

Quick Start

import React from 'react';
import { View, StyleSheet } from 'react-native';
import { SnapTradeConnect } from 'snaptrade-react-native-sdk';

const SnapTradeScreen = () => {
  return (
    <View>
      <SnapTradeConnect
        url="https://app.snaptrade.com/snapTrade/redeemToken?token"
        onSuccess={(event) => {
          console.log('Connection successful!', event.authorizationId);
        }}
        onError={(event) => {
          console.error('Connection error:', event.detail);
        }}
        onAbandoned={() => {
          console.log('User abandoned the connection process');
        }}
      />
    </View>
  );
};

export default SnapTradeScreen;

API Reference

SnapTradeConnect Component Props

Prop Type Required Description
url string Yes Generated connection portal URL
onSuccess function No Callback fired when a connection is successfully established - it includes the new connection authorization id
onError function No Callback fired when an error occurs during the connection process - it includes the error status code
onAbandoned function No Callback fired when the user closes the connection portal

License

MIT

About

React Native SDK for SnapTrade Connection Portal

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published