forked from tschoffelen/react-native-keycode
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
54 lines (47 loc) · 1.17 KB
/
App.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import React, { Component } from 'react'
import { Text, View, StyleSheet, Button } from 'react-native'
import { KeycodeInput } from 'react-native-keycode'
export default class App extends Component {
state = {
value: ''
}
render () {
return (
<View style={styles.container}>
<Text style={styles.text}>Enter your access code.</Text>
<KeycodeInput
value={this.state.value}
onChange={(value) => this.setState({value})}
onComplete={(value) => {
alert('Completed! Value: ' + value)
}}/>
<View style={styles.button}>
<Button
color='#9b9b9b'
title='Set value'
onPress={() => this.setState({value: '3F'})}/>
<Button
color='#9b9b9b'
title='Reset value'
onPress={() => this.setState({value: ''})}/>
</View>
</View>
)
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
alignItems: 'center',
justifyContent: 'center',
backgroundColor: '#fff',
paddingBottom: 200
},
text: {
fontSize: 18,
marginBottom: 32
},
button: {
marginTop: 96
}
})