Skip to content

Commit 413016b

Browse files
committed
revert removing parts of combo example
1 parent 4c9e720 commit 413016b

File tree

2 files changed

+69
-2
lines changed

2 files changed

+69
-2
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import React, { View, Text, StyleSheet } from 'react-native';
2+
import {
3+
BorderlessButton,
4+
BorderlessButtonProps,
5+
} from 'react-native-gesture-handler';
6+
7+
export const InfoButton = (props: BorderlessButtonProps & { name: string }) => (
8+
<BorderlessButton
9+
{...props}
10+
style={styles.infoButton}
11+
// eslint-disable-next-line no-alert
12+
onPress={() => window.alert(`${props.name} info button clicked`)}>
13+
<View style={styles.infoButtonBorders}>
14+
<Text style={styles.infoButtonText}>i</Text>
15+
</View>
16+
</BorderlessButton>
17+
);
18+
19+
const styles = StyleSheet.create({
20+
infoButton: {
21+
width: 40,
22+
height: 40,
23+
},
24+
infoButtonBorders: {
25+
borderColor: '#467AFB',
26+
borderWidth: 2,
27+
width: 20,
28+
height: 20,
29+
alignItems: 'center',
30+
justifyContent: 'center',
31+
borderRadius: 10,
32+
margin: 10,
33+
},
34+
infoButtonText: {
35+
color: '#467AFB',
36+
fontWeight: 'bold',
37+
backgroundColor: 'transparent',
38+
},
39+
});

example/src/release_tests/combo/index.tsx

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import { PinchableBox } from '../../recipes/scaleAndRotate';
2929
import { PressBox } from '../../basic/multitap';
3030

3131
import { LoremIpsum } from '../../common';
32+
import { InfoButton } from './InfoButton';
3233

3334
const CHILD_REF = 'CHILD_REF';
3435

@@ -176,14 +177,41 @@ class Combo extends Component<ComboProps> {
176177
<RectButton
177178
style={styles.rectButton}
178179
onPress={() => Alert.alert('First row clicked')}>
179-
<Button title="first" />
180+
<Text style={styles.buttonText}>
181+
Swipe this row & observe highlight delay
182+
</Text>
183+
{/* Info icon will cancel when you scroll in the direction of the scrollview
184+
but if you move finger horizontally it would allow you to "re-enter" into
185+
an active state. This is typical for most of the buttons on iOS (but not
186+
on Android where the touch cancels as soon as you leave the area of the
187+
button). */}
188+
<InfoButton name="first" />
180189
</RectButton>
181190
</Swipeable>
182191
<View style={styles.buttonDelimiter} />
183192
<RectButton
184193
style={styles.rectButton}
185194
onPress={() => Alert.alert('Second row clicked')}>
186-
<Button title="second" />
195+
<Text style={styles.buttonText}>
196+
Second info icon will block scrolling
197+
</Text>
198+
{/* Info icon will block interaction with other gesture handlers including
199+
the scrollview handler its a descendant of. This is typical for buttons
200+
embedded in a scrollable content on iOS. */}
201+
<InfoButton disallowInterruption name="second" />
202+
</RectButton>
203+
<View style={styles.buttonDelimiter} />
204+
<RectButton
205+
style={styles.rectButton}
206+
onPress={() => Alert.alert('Third row clicked')}>
207+
<Text style={styles.buttonText}>
208+
This one will cancel when you drag outside
209+
</Text>
210+
{/* Info icon will cancel when you drag your finger outside of its bounds and
211+
then back unlike all the previous icons that would activate when you re-enter
212+
their activation area. This is a typical bahaviour for android but less frequent
213+
for most of the iOS native apps. */}
214+
<InfoButton shouldCancelWhenOutside name="third" />
187215
</RectButton>
188216
</View>
189217
<LoremIpsum />

0 commit comments

Comments
 (0)