-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MTHD-1655] RNMethodElements component (#2)
* RNMethodElements component * PR fixes * README updated * Finalize react-native-method-elements Co-authored-by: Marco del Carmen <[email protected]>
- Loading branch information
1 parent
94c480f
commit e2689d4
Showing
7 changed files
with
16,789 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: Release to NPM | ||
on: | ||
release: | ||
types: [created] | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Setup node | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: '14.x' | ||
registry-url: 'https://registry.npmjs.org' | ||
|
||
- name: Install NPM packages | ||
run: | | ||
npm install | ||
- name: Run build. | ||
run: | | ||
npm run build | ||
- name: NPM pack | ||
run: | | ||
npm pack | ||
- name: Public to NPM | ||
run: npm publish --access public | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -102,3 +102,6 @@ dist | |
|
||
# TernJS port file | ||
.tern-port | ||
|
||
# WebStorm | ||
.idea/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,49 @@ | ||
# react-native-method-elements | ||
react-native-method-elements | ||
|
||
[![NPM](https://img.shields.io/npm/v/react-method-elements.svg)](https://www.npmjs.com/package/react-native-method-elements) | ||
|
||
## Introduction | ||
Official react native components for Method. See [Method Elements reference](https://docs.methodfi.com/api/elements/intro) to learn more. | ||
|
||
## Install | ||
|
||
```bash | ||
npm install --save react-native-method-elements | ||
|
||
or | ||
|
||
yarn install --save react-native-method-elements | ||
``` | ||
|
||
## Usage | ||
|
||
```jsx | ||
import * as React from 'react'; | ||
import { RNMethodElements } from 'react-native-method-elements'; | ||
|
||
const App = () => { | ||
const [token, setToken] = React.useState(null); | ||
|
||
React.useEffect(() => { | ||
// Request for an element token from the | ||
// Method API (POST /elements/token) | ||
// through your backend server. | ||
setToken('pk_elem_123456789'); | ||
}); | ||
|
||
if (!token) return null; | ||
|
||
return ( | ||
<RNMethodElements | ||
env="dev" // (dev / sandbox / production) | ||
token={token} | ||
onOpen={(payload) => console.log('onOpen', payload)} | ||
onSuccess={(payload) => console.log('onSuccess', payload)} | ||
onEvent={(payload) => console.log('onEvent', payload)} | ||
onExit={(payload) => console.log('onExit', payload)} | ||
onError={(payload) => console.log('onError', payload)} /> | ||
); | ||
} | ||
|
||
export default App; | ||
``` |
Oops, something went wrong.