-
Notifications
You must be signed in to change notification settings - Fork 1
/
App.js
executable file
·123 lines (98 loc) · 2.72 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
import * as React from 'react';
import { Text, View, StyleSheet, Button, TouchableWithoutFeedback, Alert } from 'react-native';
import { Constants } from 'expo';
import { RadioButtons, SegmentedControls } from 'react-native-radio-buttons';
import "prop-types";
//asdf
// or any pure javascript modules available in npm
import { Card } from 'react-native-paper';
export default class App extends React.Component {
constructor(props) {
super(props);
this.state = {
selectedOption: "Thursday & Friday"
};
}
render() {
const options = ['Monday & Tuesday', 'Tuesday & Wednesday', 'Wednesday & Thursday', 'Thursday & Friday'];
function setSelectedOption(selectedOption) {
this.setState({
selectedOption,
});
}
function renderOption(option, selected, onSelect, index) {
const style = selected ? {
padding: 2,
color: '',
textAlign: 'center',
fontWeight: 'bold'
} : {
padding: 2,
//v0.3
textAlign: 'center',
fontStyle: "italic"
};
return (
<TouchableWithoutFeedback onPress={onSelect} key={index}>
<Text style={style}>{option}</Text>
</TouchableWithoutFeedback>
);
}
function renderContainer(optionNodes) {
return <View>{optionNodes}</View>;
}
return (
<View style={styles.container}>
<Text style={styles.title}>
Class Registration
</Text>
<Text style={styles.paragraph}>
We are pre-registering for the next tutorial. The class will be two days long. Please register for one of the following options:
</Text>
<RadioButtons
options={options}
onSelection={setSelectedOption.bind(this)}
selectedOption={this.state.selectedOption}
renderOption={renderOption}
renderContainer={renderContainer}
/>
<View style={{paddingTop: 30}}>
<Button
title="Submit"
color="purple"
accessibilityLabel="Submit your selection"
onPress={
() => {
Alert.alert('Your response has been recorded!');
}
}
/>
</View>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
paddingTop: Constants.statusBarHeight,
backgroundColor: '#ecf0f1',
padding: 8,
},
paragraph: {
margin: 24,
fontSize: 20,
fontWeight: 'italics',
textAlign: 'center',
},
title: {
color: 'green',
paddingBottom: 20,
textDecorationLine: 'underline',
margin: 24,
fontSize: 30,
fontWeight: 'bold',
textAlign: 'center',
},
});