-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwhisper.jsx
163 lines (145 loc) · 3.6 KB
/
whisper.jsx
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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
/**
* Mockup React Native App
* Working with TextInput
* In practice, a user would submit text that they would like to be translated,
* and another user would record their voice and upload.
* This mockup does not show language selection, and uses text rather than audio.
*/
import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
Text,
View,
TextInput,
Button,
SectionList
} from 'react-native';
class UselessTextInput extends Component {
render() {
return (
<TextInput
{...this.props} // Inherit any props passed to it; e.g., multiline, numberOfLines below
editable = {true}
maxLength = {40}
/>
);
}
}
export default class Project extends Component {
constructor(props) {
super(props);
this.state = {
text: 'MyFileName',
sections: [
{title: 'Bears', data: ['There was a bear.']},
]
};
}
onPressSubmit = ()=> {
this.setState({
sections: [...this.state.sections, {title: this.state.text, data: [this.state.text]}]
})
}
render() {
return (
<View style={styles.container}>
<View style={styles.container}>
<SectionList
sections={
this.state.sections
}
renderItem={({item}) => <Text style={styles.item}>{item}</Text>}
renderSectionHeader={({section}) => <Text style={styles.sectionHeader}>{section.title}</Text>}
keyExtractor={(item, index) => index}
/>
</View>
<Text style={styles.welcome}>
{this.state.text}
</Text>
<Text style={styles.instructions}>
Share your story!
</Text>
<View style={{
borderBottomColor: '#199999',
borderBottomWidth: 5 }}
>
<UselessTextInput
multiline = {true}
numberOfLines = {4}
onChangeText={(text) => this.setState({text})}
/>
</View>
<Button
onPress={this.onPressSubmit}
title="Record Me"
color="#841584"
accessibilityLabel="Learn more about this purple button"
/>
<Text style={styles.welcome}>
{this.state.text2}
</Text>
<Text style={styles.instructions}>
Share your voice!
</Text>
<View style={{
borderBottomColor: '#199999',
borderBottomWidth: 5 }}
>
<UselessTextInput
multiline = {true}
numberOfLines = {4}
onChangeText={(text2) => this.setState({text2})}
/>
</View>
<Button
onPress={this.onPressSubmit2}
title="Upload Audio"
color="#841584"
accessibilityLabel="Learn more about this purple button"
/>
<Text style={styles.welcome}>
{this.state.text3}
</Text>
<Text style={styles.instructions}>
Discover a story!
</Text>
<View style={{
borderBottomColor: '#199999',
borderBottomWidth: 5 }}
>
<UselessTextInput
multiline = {true}
numberOfLines = {4}
onChangeText={(text3) => this.setState({text3})}
/>
</View>
<Button
onPress={this.onPressSubmit3}
title="Hear Me"
color="#841584"
accessibilityLabel="Learn more about this purple button"
/>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
welcome: {
fontSize: 20,
textAlign: 'center',
margin: 10,
},
instructions: {
textAlign: 'center',
color: '#333333',
marginBottom: 5,
},
});
AppRegistry.registerComponent('Project', () => Project);