-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.js
More file actions
170 lines (157 loc) · 5.42 KB
/
App.js
File metadata and controls
170 lines (157 loc) · 5.42 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
162
163
164
165
166
167
168
169
170
/**
* Sample React Native App
* https://github.com/facebook/react-native
*
* @format
* @flow
*/
import React, {Component} from 'react';
import { AsyncStorage } from 'react-native'
import { createStore, applyMiddleware } from 'redux';
import { Provider, connect } from 'react-redux';
import axios from 'axios';
import LoginPage from './src/Components/LoginPage';
import SignUpPage from './src/Components/SignUpPage';
import { Dashboard } from './src/Components/Dashboard';
import Main from './src/Components/Main';
import configureStore from './src/Store/configureStore';
import { Router,Scene } from 'react-native-router-flux';
import { TouchableOpacity ,Platform, StyleSheet, Text, View , Animated } from 'react-native';
import { Container, Header, Left, Body, Right, Button, Icon, Title } from 'native-base';
import Head from './src/Components/Head';
import Form from './src/Components/Form.js';
import SignUp from './src/Components/SignUp.js';
import * as sharedAction from './src/Actions/SharedActions/SharedActions'
import setAuthToken from './src/config/setAuthToken';
// import jwt from 'jsonwebtoken';
// import jwt from 'jwt-decode';
const store = configureStore();
const instructions = Platform.select({
ios: 'Press Cmd+R to reload,\n' + 'Cmd+D or shake for dev menu',
android:
'Double tap R on your keyboard to reload,\n' +
'Shake or press menu button for dev menu',
});
console.log('we are in APP.js');
debugger;
// AsyncStorage.removeItem('jwtToken')
// .then((data)=>{
// console.log('token might be remove now',data);
// }).catch((err)=>{
// console.log('error in removing token from asyncstorage');
// });
// AsyncStorage.getItem('jwtToken')
// .then((data)=>{
// debugger;
// console.log(data);
// // sharedAction.saveUserTokenToAsyc(data)
// // setAuthToken(data);
// // store.dispatch(sharedAction.setCurrentUser(jwt(data)));
// }).catch((err)=>{
// console.log('checking in error err',err);
// debugger;
// console.log(err);
// });
export default class App extends Component {
render() {
return (
<Provider store={store} >
<Router>
<Scene key="root">
<Scene
key="tabbar"
renderTitle={Head}
tab={true}
>
<Scene initial key="main" component={(props)=> <Main {...props} />} hideNavBar={true} />
{/* <Scene key="dummy" component={(props) => <SignUp {...props} />} hideNavBar={true} /> */}
<Scene key="dash" component={Dashboard} hideNavBar={true} />
{/* <Scene key="gold" component={GlodScreen} hideNavBar={true} title="Gold" />
<Scene key="black" component={BlackScreen} hideNavBar={true} title="Black" />
<Scene key="blue" component={BlueScreen} hideNavBar={true} title="Blue" />
<Scene key="maize" component={MaizeScreen} hideNavBar={true} title="Maize" /> */}
</Scene>
<Scene
key="modal"
direction="vertical"
component={(props)=> <SignUpPage {...props} />}
renderTitle={Head}
headerBackTitle={null}
hideNavBar
/>
<Scene
key="modal1"
direction="vertical"
component={(props)=> <LoginPage {...props} />}
renderTitle={Head}
headerBackTitle={null}
hideNavBar
/>
</Scene>
{/* <View style={{flex:1,flexDirection:'column'}} >
<View style={{marginBottom:50}} >
</View>
<View style={{ justifyContent:'center',flex:1 }} >
<SignUp page={this.state.Page} funcToBack ={this.switchBackViewToPage} modeopen={this.state.FormDisp} />
<TouchableOpacity onPress={this.switchViewToSignUp} style={{ marginBottom:45,
backgroundColor:'blue',
height:45,
borderRadius:5,display:(!this.state.FormDisp) ? 'flex':'none'}}>
<View style={{flexDirection:'row',alignSelf:'center',marginTop:8,}} >
<View>
<Icon style={{color:'white'}} name='account' type='MaterialCommunityIcons' />
</View>
<View>
<Text style={{color:'white', marginTop:3, fontWeight:'bold',}} > Sign Up </Text>
</View>
</View>
</TouchableOpacity>
<TouchableOpacity onPress={this.switchViewToLogin} style={{ marginBottom:45,
backgroundColor:'blue',
height:45,
borderRadius:5, display:(!this.state.FormDisp) ? 'flex':'none'}}>
<View style={{flexDirection:'row',alignSelf:'center',marginTop:8,}} >
<View>
<Icon name='login' type='MaterialCommunityIcons' style={{color:'white'}} />
</View>
<View>
<Text style={{color:'white', marginTop:5 , fontWeight:'bold',}} > Log In </Text>
</View>
</View>
</TouchableOpacity>
</View>
</View> */}
</Router>
</Provider>
);
}
}
const styles = StyleSheet.create({
button:{
marginBottom:45,
backgroundColor:'steelblue',
height:45,
borderRadius:5,
},
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
welcome: {
fontSize: 20,
textAlign: 'center',
margin: 10,
},
instructions: {
textAlign: 'center',
color: '#333333',
marginBottom: 5,
},
animationView:{
width:100,
height:100,
backgroundColor:'skyblue',
}
});