Skip to content

Commit f37be10

Browse files
committed
Fix linting errors related to styling
1 parent 537c369 commit f37be10

File tree

1 file changed

+38
-33
lines changed

1 file changed

+38
-33
lines changed

examples/speech-to-text/screens/SpeechToTextScreen.tsx

+38-33
Original file line numberDiff line numberDiff line change
@@ -90,13 +90,7 @@ export const SpeechToTextScreen = () => {
9090
</View>
9191
{downloadProgress !== 1 ? (
9292
<View style={styles.transcriptionContainer}>
93-
<Text
94-
style={{
95-
...styles.transcriptionText,
96-
color: 'gray',
97-
textAlign: 'center',
98-
}}
99-
>
93+
<Text style={[styles.transcriptionText, styles.textGreyCenter]}>
10094
{`Downloading model: ${(Number(downloadProgress.toFixed(4)) * 100).toFixed(2)}%`}
10195
</Text>
10296
</View>
@@ -106,11 +100,7 @@ export const SpeechToTextScreen = () => {
106100
style={
107101
sequence
108102
? styles.transcriptionText
109-
: {
110-
...styles.transcriptionText,
111-
color: 'gray',
112-
textAlign: 'center',
113-
}
103+
: [styles.transcriptionText, styles.textGreyCenter]
114104
}
115105
>
116106
{sequence ||
@@ -121,7 +111,7 @@ export const SpeechToTextScreen = () => {
121111
)}
122112
{error && (
123113
<Text
124-
style={{ ...styles.transcriptionText, color: 'red' }}
114+
style={[styles.transcriptionText, styles.redText]}
125115
>{`${error}`}</Text>
126116
)}
127117
<InputPrompt
@@ -140,18 +130,14 @@ export const SpeechToTextScreen = () => {
140130
<View
141131
style={[
142132
styles.recordingButtonWrapper,
143-
buttonDisabled && {
144-
borderColor: 'grey',
145-
},
133+
buttonDisabled && styles.borderGrey,
146134
]}
147135
>
148136
<TouchableOpacity
149137
disabled={buttonDisabled}
150138
style={[
151139
styles.recordingButton,
152-
buttonDisabled && {
153-
backgroundColor: 'grey',
154-
},
140+
buttonDisabled && styles.backgroundGrey,
155141
]}
156142
onPress={async () => {
157143
if (!audioUrl) {
@@ -162,7 +148,7 @@ export const SpeechToTextScreen = () => {
162148
}
163149
}}
164150
>
165-
<Text style={{ ...styles.recordingButtonText, fontSize: 13 }}>
151+
<Text style={[styles.recordingButtonText, styles.font13]}>
166152
{'TRANSCRIBE FROM URL'}
167153
</Text>
168154
</TouchableOpacity>
@@ -172,20 +158,17 @@ export const SpeechToTextScreen = () => {
172158
<View
173159
style={[
174160
styles.recordingButtonWrapper,
175-
recordingButtonDisabled && {
176-
borderColor: 'grey',
177-
},
178-
isRecording && { borderColor: 'rgb(240, 63, 50)' },
161+
recordingButtonDisabled && styles.borderGrey,
162+
isRecording && styles.borderRed,
179163
]}
180164
>
165+
zRXW
181166
<TouchableOpacity
182167
disabled={recordingButtonDisabled || isGenerating}
183168
style={[
184169
styles.recordingButton,
185-
recordingButtonDisabled && {
186-
backgroundColor: 'grey',
187-
},
188-
isRecording && { backgroundColor: 'rgb(240, 63, 50)' },
170+
recordingButtonDisabled && styles.backgroundGrey,
171+
isRecording && styles.backgroundRed,
189172
]}
190173
onPress={handleRecordPress}
191174
>
@@ -194,11 +177,7 @@ export const SpeechToTextScreen = () => {
194177
</Text>
195178
{DeviceInfo.isEmulatorSync() && (
196179
<Text
197-
style={{
198-
...styles.recordingButtonText,
199-
color: 'rgb(254, 148, 141)',
200-
fontSize: 11,
201-
}}
180+
style={[styles.recordingButtonText, styles.emulatorWarning]}
202181
>
203182
recording does not work on emulator
204183
</Text>
@@ -286,4 +265,30 @@ const styles = StyleSheet.create({
286265
color: 'white',
287266
fontWeight: '600',
288267
},
268+
textGreyCenter: {
269+
color: 'gray',
270+
textAlign: 'center',
271+
},
272+
redText: {
273+
color: 'red',
274+
},
275+
borderGrey: {
276+
borderColor: 'grey',
277+
},
278+
backgroundGrey: {
279+
backgroundColor: 'grey',
280+
},
281+
font13: {
282+
fontSize: 13,
283+
},
284+
borderRed: {
285+
borderColor: 'rgb(240, 63, 50)',
286+
},
287+
backgroundRed: {
288+
backgroundColor: 'rgb(240, 63, 50)',
289+
},
290+
emulatorWarning: {
291+
color: 'rgb(254, 148, 141)',
292+
fontSize: 11,
293+
},
289294
});

0 commit comments

Comments
 (0)