|
1 | 1 | import { Alert, Image, Pressable, ScrollView, Text, View } from 'react-native'; |
| 2 | +import { SafeAreaView } from 'react-native-safe-area-context'; |
2 | 3 |
|
3 | 4 | import { Iterable, IterableCommerceItem } from '@iterable/react-native-sdk'; |
4 | 5 |
|
@@ -32,35 +33,37 @@ export const Commerce = () => { |
32 | 33 | }; |
33 | 34 |
|
34 | 35 | return ( |
35 | | - <ScrollView> |
36 | | - <View style={styles.container}> |
37 | | - <Text style={styles.title}>Commerce</Text> |
38 | | - <Text style={styles.subtitle}> |
39 | | - Purchase will be tracked when "Buy" is clicked. See logs for |
40 | | - output. |
41 | | - </Text> |
42 | | - {items.map((item) => ( |
43 | | - <View key={item.id} style={styles.cardContainer}> |
44 | | - <View style={styles.infoContainer}> |
45 | | - <View style={styles.imageContainer}> |
46 | | - <Image source={item.icon} style={styles.cardImage} /> |
47 | | - </View> |
48 | | - <View style={styles.textContainer}> |
49 | | - <Text style={styles.cardTitle}>{item.name}</Text> |
50 | | - <Text style={styles.cardSubtitle}>{item.subtitle}</Text> |
51 | | - <Text style={styles.price}>${item.price}</Text> |
52 | | - <Pressable |
53 | | - style={styles.button} |
54 | | - onPress={() => handleClick(item)} |
55 | | - > |
56 | | - <Text style={styles.buttonText}>Buy</Text> |
57 | | - </Pressable> |
| 36 | + <SafeAreaView> |
| 37 | + <ScrollView> |
| 38 | + <View style={styles.container}> |
| 39 | + <Text style={styles.title}>Commerce</Text> |
| 40 | + <Text style={styles.subtitle}> |
| 41 | + Purchase will be tracked when "Buy" is clicked. See logs for |
| 42 | + output. |
| 43 | + </Text> |
| 44 | + {items.map((item) => ( |
| 45 | + <View key={item.id} style={styles.cardContainer}> |
| 46 | + <View style={styles.infoContainer}> |
| 47 | + <View style={styles.imageContainer}> |
| 48 | + <Image source={item.icon} style={styles.cardImage} /> |
| 49 | + </View> |
| 50 | + <View style={styles.textContainer}> |
| 51 | + <Text style={styles.cardTitle}>{item.name}</Text> |
| 52 | + <Text style={styles.cardSubtitle}>{item.subtitle}</Text> |
| 53 | + <Text style={styles.price}>${item.price}</Text> |
| 54 | + <Pressable |
| 55 | + style={styles.button} |
| 56 | + onPress={() => handleClick(item)} |
| 57 | + > |
| 58 | + <Text style={styles.buttonText}>Buy</Text> |
| 59 | + </Pressable> |
| 60 | + </View> |
58 | 61 | </View> |
59 | 62 | </View> |
60 | | - </View> |
61 | | - ))} |
62 | | - </View> |
63 | | - </ScrollView> |
| 63 | + ))} |
| 64 | + </View> |
| 65 | + </ScrollView> |
| 66 | + </SafeAreaView> |
64 | 67 | ); |
65 | 68 | }; |
66 | 69 |
|
|
0 commit comments