Skip to content

Commit db7432b

Browse files
committed
update demo
1 parent b47be81 commit db7432b

File tree

6 files changed

+342
-29
lines changed

6 files changed

+342
-29
lines changed

example/App.js

Lines changed: 71 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,80 @@
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'
84

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+
})
1137

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+
}
1850

19-
type Props = {};
20-
export default class App extends Component<Props> {
51+
// type Props = {};
52+
53+
export default class App extends Component {
2154
render() {
2255
return (
2356
<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)}/>
2778
</View>
2879
);
2980
}

0 commit comments

Comments
 (0)