Skip to content

Commit 6477492

Browse files
committed
Fix example
1 parent 2d90e76 commit 6477492

File tree

3 files changed

+76
-57
lines changed

3 files changed

+76
-57
lines changed

example/App.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ const EXAMPLES: ExamplesSection[] = [
220220
},
221221
{
222222
name: 'Nested Text',
223-
component: TwoFingerPan,
223+
component: NestedText,
224224
unsupportedPlatforms: new Set(['macos']),
225225
},
226226
],

example/src/empty/EmptyExample.tsx

+8-56
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,19 @@
1-
import { useState } from 'react';
2-
import { StyleSheet } from 'react-native';
3-
4-
import {
5-
Text,
6-
GestureHandlerRootView,
7-
TouchableOpacity,
8-
} from 'react-native-gesture-handler';
9-
10-
export default function App() {
11-
const [counter, setCounter] = useState(0);
1+
import React from 'react';
2+
import { StyleSheet, Text, View } from 'react-native';
123

4+
export default function EmptyExample() {
135
return (
14-
<GestureHandlerRootView style={styles.container}>
15-
<Text style={{ fontSize: 30 }}>{`Counter: ${counter}`}</Text>
16-
17-
<TouchableOpacity
18-
onPress={() => {
19-
console.log('Touchable');
20-
setCounter((prev) => prev + 1);
21-
}}>
22-
<Text
23-
style={[styles.textCommon, styles.outerText]}
24-
onPress={() => {
25-
console.log('Outer text');
26-
setCounter((prev) => prev + 1);
27-
}}>
28-
{'Outer Text '}
29-
<Text
30-
style={[styles.textCommon, styles.innerText]}
31-
onPress={() => {
32-
console.log('Nested text');
33-
setCounter((prev) => prev + 1);
34-
}}>
35-
{'Nested Text'}
36-
</Text>
37-
</Text>
38-
</TouchableOpacity>
39-
</GestureHandlerRootView>
6+
<View style={styles.container}>
7+
<Text style={{ fontSize: 64, opacity: 0.25 }}>😞</Text>
8+
<Text style={{ fontSize: 24, opacity: 0.25 }}>It's so empty here</Text>
9+
</View>
4010
);
4111
}
4212

4313
const styles = StyleSheet.create({
4414
container: {
4515
flex: 1,
46-
alignItems: 'center',
4716
justifyContent: 'center',
48-
49-
gap: 20,
50-
},
51-
52-
textCommon: {
53-
padding: 10,
54-
color: 'white',
55-
},
56-
57-
outerText: {
58-
fontSize: 30,
59-
borderWidth: 2,
60-
backgroundColor: '#131313',
61-
},
62-
63-
innerText: {
64-
fontSize: 25,
65-
backgroundColor: '#F06312',
17+
alignItems: 'center',
6618
},
6719
});
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
import { useState } from 'react';
2+
import { StyleSheet } from 'react-native';
3+
4+
import {
5+
Text,
6+
GestureHandlerRootView,
7+
TouchableOpacity,
8+
} from 'react-native-gesture-handler';
9+
10+
export default function NestedText() {
11+
const [counter, setCounter] = useState(0);
12+
13+
return (
14+
<GestureHandlerRootView style={styles.container}>
15+
<Text style={{ fontSize: 30 }}>{`Counter: ${counter}`}</Text>
16+
17+
<TouchableOpacity
18+
onPress={() => {
19+
console.log('Touchable');
20+
setCounter((prev) => prev + 1);
21+
}}>
22+
<Text
23+
style={[styles.textCommon, styles.outerText]}
24+
onPress={() => {
25+
console.log('Outer text');
26+
setCounter((prev) => prev + 1);
27+
}}>
28+
{'Outer Text '}
29+
<Text
30+
style={[styles.textCommon, styles.innerText]}
31+
onPress={() => {
32+
console.log('Nested text');
33+
setCounter((prev) => prev + 1);
34+
}}>
35+
{'Nested Text'}
36+
</Text>
37+
</Text>
38+
</TouchableOpacity>
39+
</GestureHandlerRootView>
40+
);
41+
}
42+
43+
const styles = StyleSheet.create({
44+
container: {
45+
flex: 1,
46+
alignItems: 'center',
47+
justifyContent: 'center',
48+
49+
gap: 20,
50+
},
51+
52+
textCommon: {
53+
padding: 10,
54+
color: 'white',
55+
},
56+
57+
outerText: {
58+
fontSize: 30,
59+
borderWidth: 2,
60+
backgroundColor: '#131313',
61+
},
62+
63+
innerText: {
64+
fontSize: 25,
65+
backgroundColor: '#F06312',
66+
},
67+
});

0 commit comments

Comments
 (0)