0.1.5 • Published 2 years ago

@plaza-app/react-native v0.1.5

Weekly downloads
-
License
-
Repository
-
Last release
2 years ago

@plazaapp/react-native

Plaza React Native Web3 login (Beta)

This library currently only works with Expo-managed workflows.

See the docs for more information, or reach out to us in our Discord for help.

Requirements

Apple: iOS 12+ Android: Custom Tab support

Installation and Prerequisites

npm install @plazaapp/react-native

For this library to work you will need to install this library's peer dependencies (tested with the latest stable version of each):

crypto-browserify, stream-browserify, events, expo-constants, expo-linking, expo-web-browser,

Inside your metro.config.js, add the polyfills:

const path = require("path");

module.exports = {
  transformer: {
    getTransformOptions: async () => ({
      transform: {
        experimentalImportSupport: false,
        inlineRequires: true,
      },
      extraNodeModules: {
        ...{
          stream: path.join(__dirname, "node_modules", "stream-browserify"),
          crypto: path.join(__dirname, "node_modules", "crypto-browserify"),
          events: path.join(__dirname, "node_modules", "events"),
        },
      },
    }),
  },
};

Usage

import { Plaza } from '@plaza-app/react-native';

// ...

const plaza = new Plaza("<YOUR PUBLIC API KEY>")


return (
// ...
      <Button
        title="Log in"
        onPress={async () => {
          const { walletAddress, email } = await plaza.login();
        }}
      />
)

Expo linking

If you export your Expo app, you will need to register your app's custom linking scheme for the authentication flow to work:

import { Plaza } from '@plaza-app/react-native'

const Plaza = new Plaza("<YOUR PUBLIC API KEY>", "myapp")

This corresponds to your app's Expo config (app.json / app.config.js):

{
  "expo": {
    "scheme": "myapp"
  }
}
0.1.5

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago

0.0.0

2 years ago