Skip to content

Commit ccacd91

Browse files
committed
💻 make list items touchable using TouchableHighlight
1 parent 634824d commit ccacd91

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

‎components/ScrollableList/index.js‎

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,21 @@
11
import React from 'react'
22

3-
import { StyleSheet, SafeAreaView, ScrollView, Text, View } from 'react-native'
3+
import { StyleSheet, SafeAreaView, ScrollView, Text, TouchableHighlight } from 'react-native'
44
export default function ScrollableList({list}) {
55
return(
66
<SafeAreaView style={styles.container}>
77
<ScrollView>
88
{
9-
list.map((pokemon, i) => <View key={i} style={styles.listItem}><Text style={styles.listItemText}>{pokemon.name}</Text></View>)
9+
list.map((pokemon, i) => (
10+
<TouchableHighlight
11+
onPress={() => console.log('pressed')}
12+
key={i}
13+
style={styles.listItem}>
14+
<Text style={styles.listItemText}>
15+
{pokemon.name}
16+
</Text>
17+
</TouchableHighlight>)
18+
)
1019
}
1120
</ScrollView>
1221
</SafeAreaView>

0 commit comments

Comments
 (0)