-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.js
More file actions
161 lines (146 loc) · 4.02 KB
/
App.js
File metadata and controls
161 lines (146 loc) · 4.02 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
import { StatusBar } from 'expo-status-bar';
import React from 'react';
import { NavigationContainer } from '@react-navigation/native';
import { createNativeStackNavigator } from '@react-navigation/native-stack';
import { StyleSheet, Text, Button, View } from 'react-native';
import { SafeAreaView,
Image,
TouchableOpacity, } from 'react-native'
import SearchBar from "react-native-dynamic-search-bar";
// used resources:
// https://reactnavigation.org/docs/navigating/ --> basic switching pages
// https://github.com/expo/examples --> basic structure of app
function HomeScreen({ navigation }) {
return (
<View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
<StatusBar style="auto" />
<Text>Look at products below!!</Text>
<SearchBar
placeholder="Search here"
onPress={() => alert("onPress")}
onChangeText={(text) => console.log(text)}
/>
<Button
title="Browse Products"
onPress={() => navigation.navigate('BrowseProducts')}
/>
</View>
);
}
function BrowseProductsScreen({ navigation }) {
return (
<View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
<Text>View Products Below!</Text>
<TouchableOpacity
style={styles.viewMorePage}
activeOpacity={0.5}>
<Image
source={{
uri:
'https://m.media-amazon.com/images/I/81GkukapflL._SL1500_.jpg',
}}
style={styles.buttonImageIconStyle}
/>
<View style={styles.buttonIconSeparatorStyle} />
<Text style={styles.buttonTextStyle}>Example Product</Text>
</TouchableOpacity>
<TouchableOpacity
style={styles.browsePage}
activeOpacity={0.5}>
<Image
source={{
uri:
'https://m.media-amazon.com/images/I/81GkukapflL._SL1500_.jpg',
}}
style={styles.buttonImageIconStyle}
/>
<Text style={styles.buttonTextStyle}>Example Product</Text>
</TouchableOpacity>
<Button
title="Back"
onPress={() => navigation.navigate('Home')}
/>
</View>
);
}
const Stack = createNativeStackNavigator();
export default function App() {
return (
<NavigationContainer>
<Stack.Navigator initialRouteName="Home" screenOptions={{headerShown: false}}>
<Stack.Screen name="Home" component={HomeScreen} />
<Stack.Screen name="BrowseProducts" component={BrowseProductsScreen} />
</Stack.Navigator>
</NavigationContainer>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
margin: 10,
marginTop: 30,
padding: 30,
},
viewMorePage: {
flexDirection: 'column',
alignItems: 'center',
backgroundColor: '#485a96',
borderWidth: 0.5,
borderColor: '#fff',
height: '20%',
width: '40%',
borderRadius: 5,
margin: 5,
},
browsePage: {
flexDirection: 'row',
alignItems: 'left',
backgroundColor: '#947204',
borderWidth: 0.5,
borderColor: '#fff',
height: '8%',
width: '85%',
borderRadius: 5,
margin: 5,
},
buttonImageIconStyle: {
padding: 10,
margin: 5,
height: '75%',
width: '85%',
resizeMode: 'contain',
},
buttonTextStyle: {
color: '#fff',
marginBottom: 4,
marginLeft: 10,
},
buttonIconSeparatorStyle: {
backgroundColor: '#fff',
width: 40,
height: 1,
padding: 10
},
});
// export default App;
// export default function App() {
// return (
// <View style={styles.container}>
// <Text>Open up App.js to start working on your app!</Text>
// <Text>new line</Text>
// <Button
// title="Switch Page"
// onPress={() => Alert.alert('Simple Button pressed')}
// />
// <StatusBar style="auto" />
// </View>
// );
// }
// const styles = StyleSheet.create({
// container: {
// flex: 1,
// backgroundColor: '#fff',
// alignItems: 'center',
// justifyContent: 'center',
// },
// });