forked from sahilsian/watchlist
-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.js
150 lines (122 loc) · 3.3 KB
/
App.js
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
import { StatusBar } from 'expo-status-bar';
import React from 'react';
import { StyleSheet, Text, View } from 'react-native';
import { NavigationContainer } from '@react-navigation/native';
import { createStackNavigator } from '@react-navigation/stack';
//Importing Context
import MyProvider from './context';
import styled from 'styled-components/native'
//Importing Pages
import AddStockScreen from "./comps/Pages/AddStockScreen"
import StockScreen from "./comps/Pages/StockScreen"
import HomeScreen from "./comps/Pages/HomeScreen"
import SearchScreen from "./comps/Pages/SearchScreen"
// Importing comps
import Header from './comps/Header';
import { ScrollView } from 'react-native-gesture-handler';
// import SearchItem from './comps/SearchItem';
//Creating default styled components
const Screen = styled.View`
flex: 1;
justify-content: center;
align-items: center;
`;
const Test = styled.View`
width: 20px;
height: 20px;
background-color: #fad;
`;
//Creating homepage
function HomeScreenPage() {
return (
<Screen>
<HomeScreen>
{/* Page contents go here */}
</HomeScreen>
</Screen>
);
}
//Creating stock screen
function StockScreenPage({navigation, route}) {
const { equity } = route.params;
return (
<Screen>
<StockScreen
name={equity}
>
{/* Page contents go here */}
</StockScreen>
</Screen>
);
}
//Creating search screen
function SearchScreenPage({navigation}) {
return (
<Screen>
<SearchScreen
onPress={()=> {
navigation.navigate('Stock', {
equity: "TSLA"
})
}}>
{/* Page contents go here */}
</SearchScreen>
</Screen>
);
}
//Creating page to add stocks
//Affiliated with search screen
function AddStockScreenPage({route}) {
return (
<Screen>
<AddStockScreen>
{/* Page contents go here */}
</AddStockScreen>
</Screen>
);
}
//Creating stack navigation for routing
const Stack = createStackNavigator();
export default function App() {
return (
<MyProvider>
<NavigationContainer>
<Stack.Navigator
initialRouteName="Home"
screenOptions={{
headerStyle: {
elevation: 0,
shadowOpacity: 0,
borderBottomWidth: 0,
}
}}
>
{/* Homepage Stack Screen */}
<Stack.Screen
name="Home"
component={HomeScreen}
options={{ headerTitle: props => <Header Title="Watchlist" Back="none" /> }}
/>
{/* Stock Stack Screen */}
<Stack.Screen
name="Stock"
component={StockScreenPage}
options={{ headerTitle: props => <Header Title="Stock Name" Back="none" /> }}
/>
{/* Search Stock Stack Screen */}
<Stack.Screen
name="Search"
component={SearchScreenPage}
options={{ headerTitle: props => <Header Title="Search" Back="none" /> }}
/>
{/* Add Stock Stack Screen */}
<Stack.Screen
name="Add"
component={AddStockScreenPage}
options={{ headerTitle: props => <Header Title=" Add" Back="none" /> }}
/>
</Stack.Navigator>
</NavigationContainer>
</MyProvider>
);
}