-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Expand file tree
/
Copy pathindex.tsx
More file actions
66 lines (58 loc) · 1.42 KB
/
Copy pathindex.tsx
File metadata and controls
66 lines (58 loc) · 1.42 KB
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
import { useState } from 'react';
import { StyleSheet } from 'react-native';
import {
Text,
GestureHandlerRootView,
TouchableOpacity,
} from 'react-native-gesture-handler';
export default function NestedText() {
const [counter, setCounter] = useState(0);
return (
<GestureHandlerRootView style={styles.container}>
<Text style={{ fontSize: 30 }}>{`Counter: ${counter}`}</Text>
<TouchableOpacity
onPress={() => {
console.log('Touchable');
setCounter((prev) => prev + 1);
}}>
<Text
style={[styles.textCommon, styles.outerText]}
onPress={() => {
console.log('Outer text');
setCounter((prev) => prev + 1);
}}>
{'Outer Text '}
<Text
style={[styles.textCommon, styles.innerText]}
onPress={() => {
console.log('Nested text');
setCounter((prev) => prev + 1);
}}>
{'Nested Text'}
</Text>
</Text>
</TouchableOpacity>
</GestureHandlerRootView>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
alignItems: 'center',
justifyContent: 'center',
gap: 20,
},
textCommon: {
padding: 10,
color: 'white',
},
outerText: {
fontSize: 30,
borderWidth: 2,
backgroundColor: '#131313',
},
innerText: {
fontSize: 25,
backgroundColor: '#F06312',
},
});