|
1 | | -/** |
2 | | - * Sample React Native App |
3 | | - * https://github.com/facebook/react-native |
4 | | - * |
5 | | - * @format |
6 | | - * @flow |
7 | | - */ |
| 1 | +import React from 'react'; |
| 2 | +import { StyleSheet, Text, View, TouchableHighlight, ScrollView, TextInput, Alert } from 'react-native'; |
| 3 | +import JVerification from 'jverification-react-native' |
8 | 4 |
|
9 | | -import React, {Component} from 'react'; |
10 | | -import {Platform, StyleSheet, Text, View} from 'react-native'; |
| 5 | +var styles = StyleSheet.create({ |
| 6 | + parent: { |
| 7 | + padding: 35, |
| 8 | + |
| 9 | + flexDirection: 'column', |
| 10 | + justifyContent: 'center', |
| 11 | + alignItems: 'center', |
| 12 | + }, |
| 13 | + setBtnStyle: { |
| 14 | + width: 180, |
| 15 | + marginTop: 10, |
| 16 | + borderWidth: 1, |
| 17 | + borderColor: '#3e83d7', |
| 18 | + borderRadius: 8, |
| 19 | + backgroundColor: '#3e83d7', |
| 20 | + padding: 10 |
| 21 | + }, |
| 22 | + textStyle: { |
| 23 | + textAlign: 'center', |
| 24 | + fontSize: 25, |
| 25 | + color: '#ffffff' |
| 26 | + }, |
| 27 | + inputText: { |
| 28 | + width: 180, |
| 29 | + fontSize: 15, |
| 30 | + marginLeft: 5, |
| 31 | + marginRight: 5, |
| 32 | + color: '#000000', |
| 33 | + padding: 10, |
| 34 | + textAlign: 'left' |
| 35 | + } |
| 36 | +}) |
11 | 37 |
|
12 | | -const instructions = Platform.select({ |
13 | | - ios: 'Press Cmd+R to reload,\n' + 'Cmd+D or shake for dev menu', |
14 | | - android: |
15 | | - 'Double tap R on your keyboard to reload,\n' + |
16 | | - 'Shake or press menu button for dev menu', |
17 | | -}); |
| 38 | +class Button extends React.Component { |
| 39 | + render() { |
| 40 | + return <TouchableHighlight |
| 41 | + style={styles.setBtnStyle} |
| 42 | + onPress={this.props.onPress} |
| 43 | + underlayColor='#e4083f' |
| 44 | + activeOpacity={0.5} |
| 45 | + > |
| 46 | + <Text style={styles.textStyle}>{this.props.title}</Text> |
| 47 | + </TouchableHighlight> |
| 48 | + } |
| 49 | +} |
18 | 50 |
|
19 | | -type Props = {}; |
20 | | -export default class App extends Component<Props> { |
| 51 | +// type Props = {}; |
| 52 | + |
| 53 | +export default class App extends Component { |
21 | 54 | render() { |
22 | 55 | return ( |
23 | 56 | <View style={styles.container}> |
24 | | - <Text style={styles.welcome}>Welcome to React Native!</Text> |
25 | | - <Text style={styles.instructions}>To get started, edit App.js</Text> |
26 | | - <Text style={styles.instructions}>{instructions}</Text> |
| 57 | + <Button title="init" |
| 58 | + onPress={() => JVerification.init({ |
| 59 | + appKey: 'a1703c14b186a68a66ef86c1', |
| 60 | + channel: 'the channel' |
| 61 | + })}/> |
| 62 | + |
| 63 | + <Button title="getToken" |
| 64 | + onPress={() => JVerification.getToken((res) => { |
| 65 | + Alert.alert('token', JSON.stringify(res)); |
| 66 | + })}/> |
| 67 | + |
| 68 | + <Button title="verifyNumber" |
| 69 | + onPress={() => JVerification.verifyNumber({ |
| 70 | + number: 'the number', |
| 71 | + code: 'code' |
| 72 | + },(res) => { |
| 73 | + Alert.alert('token', JSON.stringify(res)); |
| 74 | + })}/> |
| 75 | + |
| 76 | + <Button title="setDebug" |
| 77 | + onPress={() => JVerification.setDebug(true)}/> |
27 | 78 | </View> |
28 | 79 | ); |
29 | 80 | } |
|
0 commit comments