express-wyre-react-native

0.0.1-alpha.4 • Public • Published

express-wyre-react-native

💸 The companion React Native library for express-wyre.

🚀 Getting Started

Using Yarn and Expo:

yarn add express-wyre-react-native
expo install react-native-webview

Using Yarn and Vanilla:

yarn add express-wyre-react-native
yarn add react-native-webview

✍️ Usage

Apply the default export ExpressWyre at the graphical root of your application. Then call the usePlaid hook to request a public token:

import React from "react";
import { StyleSheet, Text, SafeAreaView, View, TouchableOpacity } from "react-native";
 
import ExpressWyre, { usePlaid } from "express-wyre-react-native";
 
function PlaidButton() {
  const { requestPublicToken } = usePlaid();
  return (
    <TouchableOpacity
      onPress={async () => {
        try {
          const { publicToken } = await requestPublicToken();
          console.warn(`Got a publicToken! ${publicToken}`);
        } catch (e) {
          console.error(e);
        }
      }}>
      <Text children="Request Plaid Token" />
    </TouchableOpacity>
  );
};
 
export default function App() {
  return (
    <ExpressWyre baseUrl="http://localhost:3000/wyre">
      <View style={StyleSheet.absoluteFill}>
        <SafeAreaView />
        <PlaidButton />
      </View>
    </ExpressWyre>
  );
}

The baseUrl prop is required. This defines the location of your express-wyre middleware. For further details, check out the Example App.

✌️ License

MIT

Package Sidebar

Install

npm i express-wyre-react-native

Weekly Downloads

4

Version

0.0.1-alpha.4

License

MIT

Unpacked Size

26.5 kB

Total Files

19

Last publish

Collaborators

  • cawfree