Skip to content

Commit 902f725

Browse files
committed
chore: add pressable testing examples
1 parent 46383b2 commit 902f725

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

apps/example/src/Screens/Chat.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import {
88
Text,
99
TextInput,
1010
View,
11+
Button,
12+
Alert,
1113
} from 'react-native';
1214

1315
const MESSAGES = [
@@ -27,6 +29,7 @@ export function Chat({
2729
behavior={Platform.OS === 'ios' ? 'padding' : 'height'}
2830
style={styles.container}
2931
>
32+
<Button onPress={() => Alert.alert('Hey')} title="Press me" />
3033
<ScrollView
3134
contentInsetAdjustmentBehavior="automatic"
3235
style={styles.inverted}

apps/example/src/Screens/Contacts.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
import { useScrollToTop } from '@react-navigation/native';
22
import * as React from 'react';
33
import {
4+
Alert,
45
FlatList,
56
type FlatListProps,
67
Platform,
78
SafeAreaView,
89
StyleSheet,
910
Text,
11+
TouchableOpacity,
1012
View,
1113
} from 'react-native';
1214
import { useBottomTabBarHeight } from 'react-native-bottom-tabs';
@@ -74,7 +76,10 @@ const CONTACTS: Item[] = [
7476
const ContactItem = React.memo(
7577
({ item }: { item: { name: string; number: number } }) => {
7678
return (
77-
<View style={[styles.item, { backgroundColor: '#fff' }]}>
79+
<TouchableOpacity
80+
style={[styles.item, { backgroundColor: '#fff' }]}
81+
onPress={() => Alert.alert(`Pressed: ${item.name}`)}
82+
>
7883
<View style={styles.avatar}>
7984
<Text style={styles.letter}>
8085
{item.name.slice(0, 1).toUpperCase()}
@@ -84,7 +89,7 @@ const ContactItem = React.memo(
8489
<Text style={styles.name}>{item.name}</Text>
8590
<Text style={[styles.number, { opacity: 0.5 }]}>{item.number}</Text>
8691
</View>
87-
</View>
92+
</TouchableOpacity>
8893
);
8994
}
9095
);

0 commit comments

Comments
 (0)