generated from flatlogic/react-native-starter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
BaseScreens.js
138 lines (126 loc) · 3.58 KB
/
BaseScreens.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
import React, { useEffect, useCallback, useState, useContext } from "react";
import { View, Text, StyleSheet, ActivityIndicator, Image} from "react-native";
import { Button } from './src/components';
import { Card } from 'react-native-elements';
import { AuthContext } from "./utils/authContext";
import {fonts} from './src/styles'
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: "center",
alignItems: "center",
padding: 10,
},
button: {
paddingHorizontal: 20,
paddingVertical: 10,
marginVertical: 10,
borderRadius: 5
},
contenedor: {
justifyContent: 'center',
alignItems: 'center',
letterSpacing: 1,
fontSize: 15,
fontFamily: fonts.primaryBold,
textAlign: 'center'
},
});
const ScreenContainer = ({ children }) => (
<View style={styles.container}>{children}</View>
);
export const Home = ({ navigation }) => (
<ScreenContainer>
<Text>Master List Screen</Text>
<Button
caption="React Native by Example"
onPress={() =>
navigation.push("Details", { name: "React Native by Example " })
}
/>
<Button
caption="React Native School"
onPress={() =>
navigation.push("Details", { name: "React Native School" })
}
/>
<Button caption="Drawer" onPress={() => navigation.toggleDrawer()} />
</ScreenContainer>
);
export const Details = ({ route }) => (
<ScreenContainer>
<Text>Details Screen</Text>
{route.params.name && <Text>{route.params.name}</Text>}
</ScreenContainer>
);
export const Search = ({ navigation }) => (
<ScreenContainer>
<Text>Search Screen</Text>
<Button caption="Search 2" onPress={() => navigation.push("Search2")} />
<Button
caption="React Native School"
onPress={() => {
navigation.navigate("Home", {
screen: "Details",
params: { name: "React Native School" }
});
}}
/>
</ScreenContainer>
);
export const Search2 = () => (
<ScreenContainer>
<Text>Search2 Screen</Text>
</ScreenContainer>
);
export const Splash = (props) => (
<ScreenContainer>
<Image source={require('./assets/logo.png')} style={{height: 150, width: 300}} />
<Text style ={styles.contenedor}>{props.message}</Text>
<Text style ={styles.contenedor}>Cargando...</Text>
<ActivityIndicator size='large' color='#44C2CF'/>
</ScreenContainer>
);
export const Welcome = ({navigation}) => (
<ScreenContainer>
<Card style={styles.container }>
<Text style ={styles.contenedor}>Bienvenido</Text>
<Button
caption="Ingresar"
onPress={() => navigation.push('SignIn')}
style={{marginVertical: 10}}
/>
<Button
caption="Registrarse"
onPress={() => navigation.push('NewRegister')}
/>
</Card>
</ScreenContainer>
);
export const NewRegister = ({navigation}) => {
return(
<ScreenContainer>
<Card style={styles.container}>
<Text style={styles.contenedor}>Por favor seleccione la opción deseada para crear una nueva cuenta</Text>
<Button
caption="Soy Paciente"
onPress={() => navigation.push('UserRegister', {client_type: 0})}
style={{marginVertical: 10}}
/>
<Button
caption="Soy Doctor"
onPress={() => navigation.push('UserRegister', {client_type: 1})}
/>
</Card>
</ScreenContainer>
);
}
export const CreateAccount = () => {
const { signUp } = useContext(AuthContext);
return (
<ScreenContainer>
<Text>Create Account Screen</Text>
<Button caption="Sign Up" onPress={() => signUp()} />
</ScreenContainer>
);
};