-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.js
82 lines (71 loc) · 2.34 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
import React, { Component } from 'react';
import {
StyleSheet,
Text,
View,
Alert,
TouchableOpacity
} from 'react-native';
export default class App extends Component {
render() {
return (
<View style={styles.container}>
<Text style={styles.text} onPress={() => this.handlePress('Simple text, sound OFF')}>
Simple text, sound OFF
</Text>
<Text style={styles.text} touchSoundEnabled={true} onPress={() => this.handlePress('Simple text, sound ON')}>
Simple text, sound ON
</Text>
<TouchableOpacity onPress={() => this.handlePress('TouchableOpacity, sound OFF')}>
<View style={styles.btn}>
<Text>TouchableOpacity Sound OFF</Text>
</View>
</TouchableOpacity>
<TouchableOpacity touchSoundEnabled={true} onPress={() => this.handlePress('TouchableOpacity, sound ON')}>
<View style={styles.btn}>
<Text>TouchableOpacity Sound ON</Text>
</View>
</TouchableOpacity>
<Text style={styles.text} onPress={() => this.handlePress('Top-level text Sound OFF')}>
<Text style={styles.nestedText} onPress={() => this.handlePress('Nested text Sound OFF')}>Nested</Text>
{' text '}
<Text style={styles.nestedText} onPress={() => this.handlePress('Nested text Sound ON')} touchSoundEnabled={true}> sound </Text>
{' OFF '}
</Text>
<Text touchSoundEnabled={true} style={styles.text} onPress={() => this.handlePress('Top-level text Sound ON')}>
<Text style={styles.nestedText} onPress={() => this.handlePress('Nested text Sound OFF')}>Nested</Text>
{' text '}
<Text style={styles.nestedText} onPress={() => this.handlePress('Nested text Sound ON')} touchSoundEnabled={true}> sound </Text>
{' ON '}
</Text>
</View>
);
}
handlePress = (text) => {
Alert.alert('Touch', text);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: 'white',
},
text: {
fontSize: 24,
textAlign: 'center',
margin: 16,
},
nestedText: {
backgroundColor: 'green',
},
btn: {
width: 160,
height: 80,
marginBottom: 16,
backgroundColor: 'red',
alignItems: 'center',
justifyContent: 'center'
}
});