-
Notifications
You must be signed in to change notification settings - Fork 64
/
app.js
65 lines (52 loc) · 1.41 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
55
56
57
58
59
60
61
62
63
import React, { Component } from 'react';
import {
StyleSheet,
Text,
View
} from 'react-native';
import {RadioGroup, RadioButton} from 'react-native-flexi-radio-button'
class App extends Component{
constructor(){
super()
this.state = {
text: ''
}
this.onSelect = this.onSelect.bind(this)
}
onSelect(index, value){
this.setState({
text: `Selected index: ${index} , value: ${value}`
})
}
render(){
return(
<View style={styles.container}>
<RadioGroup
onSelect = {(index, value) => this.onSelect(index, value)}
>
<RadioButton value={'item1'} >
<Text>This is item #1</Text>
</RadioButton>
<RadioButton value={'item2'}>
<Text>This is item #2</Text>
</RadioButton>
<RadioButton value={'item3'}>
<Text>This is item #3</Text>
</RadioButton>
</RadioGroup>
<Text style={styles.text}>{this.state.text}</Text>
</View>
)
}
}
let styles = StyleSheet.create({
container: {
marginTop: 40,
padding: 20
},
text: {
padding: 10,
fontSize: 14,
},
})
module.exports = App