-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Expand file tree
/
Copy pathindex.tsx
More file actions
66 lines (63 loc) · 2.12 KB
/
Copy pathindex.tsx
File metadata and controls
66 lines (63 loc) · 2.12 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 React from 'react';
import { StyleSheet, Text } from 'react-native';
import { TouchableOpacity, ScrollView } from 'react-native-gesture-handler';
import { LoremIpsum } from '../../common';
export default function Example() {
return (
<ScrollView>
<Text style={styles.text}>
When the `exclusive` prop is set to true, the touchable is not allowed
to begin recognizing gesture (thus it shouldn't show feedback) when
another touchable is pressed. Similarly when the touchable with
`exclusive` set to true is pressed, no other touchable should begin
recognizing gesture.
</Text>
<Text style={styles.text}>Touchables with `exclusive` set to true:</Text>
<Boxes />
<Text style={styles.text}>
When the `exclusive` prop is set to false, the touchable is allowed to
begin recognizing gesture when another touchable (with `exclusive` prop
set to false) is already pressed.
</Text>
<Text style={styles.text}>Touchables with `exclusive` set to false:</Text>
<Boxes exclusive={false} />
<Text style={styles.text}>Touchables with `exclusive` set to false:</Text>
<Boxes exclusive={false} />
<LoremIpsum words={40} />
</ScrollView>
);
}
function Boxes(props: { exclusive?: boolean }) {
return (
<TouchableOpacity
style={{ backgroundColor: 'red', width: 300, height: 300 }}
extraButtonProps={{
exclusive: props.exclusive ?? true,
rippleColor: 'transparent',
}}>
<TouchableOpacity
style={{ backgroundColor: 'green', width: 200, height: 200 }}
extraButtonProps={{
exclusive: props.exclusive ?? true,
rippleColor: 'transparent',
}}>
<TouchableOpacity
style={{
backgroundColor: 'blue',
width: 100,
height: 100,
}}
extraButtonProps={{
exclusive: props.exclusive ?? true,
rippleColor: 'transparent',
}}
/>
</TouchableOpacity>
</TouchableOpacity>
);
}
const styles = StyleSheet.create({
text: {
padding: 10,
},
});