open-index/open-npm huggingface dataset:
npm package: @plaza-app/react-native
Description: test
Author: plaza
Latest version: 0.1.5

# @plazaapp/react-native

Plaza React Native Web3 login (Beta)

**This library currently only works with Expo-managed workflows.**

See [the docs](https://auth.plazaapp.io/guides) for more information, or reach out to us in [our Discord](https://discord.gg/FWEQZ5aVm5) for help.

## Requirements
Apple: iOS 12+
Android: Custom Tab support

## Installation and Prerequisites

```sh
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:

```js
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

```js
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:

```js
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): 

```json
{
  "expo": {
    "scheme": "myapp"
  }
}
```