-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add startup load & add home, create profile screen
- Loading branch information
Showing
6 changed files
with
197 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,52 @@ | ||
import { useNavigation, useRoute } from '@react-navigation/native'; | ||
import { createStackNavigator, TransitionPresets } from '@react-navigation/stack'; | ||
import { useContext, useEffect } from 'react'; | ||
import { AuthContext } from '../../context/AuthContext'; | ||
import CreateProfile from '../../screens/CreateProfile'; | ||
import Home from '../../screens/Home'; | ||
import Login from '../../screens/Login'; | ||
import Walkthrough from '../../screens/Walkthrough'; | ||
import Welcome from '../../screens/Welcome'; | ||
|
||
const Stack = createStackNavigator(); | ||
|
||
const StackNavigator = () => { | ||
return ( | ||
<Stack.Navigator | ||
screenOptions={{ | ||
headerShown: false, | ||
...TransitionPresets.SlideFromRightIOS | ||
}}> | ||
<Stack.Screen name="Welcome" component={Welcome} /> | ||
<Stack.Screen name="Walkthrough" component={Walkthrough} /> | ||
<Stack.Screen name="Login" component={Login} /> | ||
</Stack.Navigator> | ||
); | ||
|
||
const { user, isAuth } = useContext(AuthContext) | ||
|
||
console.log(user, isAuth); | ||
|
||
const initialRoute = () => { | ||
if (!isAuth) return "Welcome"; | ||
|
||
if (!user.isProfile) return "CreateProfile" | ||
|
||
return "Home" | ||
} | ||
|
||
return ( | ||
<Stack.Navigator | ||
initialRouteName={initialRoute()} | ||
screenOptions={{ | ||
headerShown: false, | ||
...TransitionPresets.SlideFromRightIOS | ||
}}> | ||
<Stack.Screen name="Welcome" component={Welcome} /> | ||
{!isAuth && | ||
<> | ||
<Stack.Screen name="Walkthrough" component={Walkthrough} /> | ||
<Stack.Screen name="Login" component={Login} /> | ||
</> | ||
} | ||
{ | ||
isAuth && | ||
<> | ||
<Stack.Screen name="CreateProfile" component={CreateProfile} /> | ||
<Stack.Screen name="Home" component={Home} /> | ||
</> | ||
} | ||
</Stack.Navigator> | ||
); | ||
} | ||
|
||
export default StackNavigator; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
import React, { useContext } from 'react'; | ||
import { StyleSheet, View } from 'react-native'; | ||
import { heightScreen, widthScreen } from '../../utils/layout'; | ||
import { Box, Button, Center, CloseIcon, Select, CheckIcon, FormControl, HStack, Icon, IconButton, Image, Input, Stack, Text, VStack } from 'native-base'; | ||
import { AntDesign } from '@expo/vector-icons'; | ||
import { AuthContext } from '../../context/AuthContext'; | ||
import { Fontisto, MaterialIcons } from "@expo/vector-icons"; | ||
|
||
|
||
|
||
const CreateProfile = () => { | ||
|
||
const { user } = useContext(AuthContext) | ||
|
||
return ( | ||
<View style={styles.container}> | ||
<Image source={{ uri: user.imageUrl }} alt={user.name} | ||
size='xl' | ||
rounded='full' borderColor='primary.100' | ||
borderWidth='3' | ||
/> | ||
<Text>Create Profile</Text> | ||
|
||
<FormControl> | ||
<FormControl.Label>Basic details:</FormControl.Label> | ||
<Stack space={5}> | ||
<Stack mt='2'> | ||
<Input | ||
InputLeftElement={ | ||
<Icon as={<MaterialIcons name="phone" />} | ||
size={5} ml="2" color="muted.600" />} | ||
variant="underlined" p={2} placeholder="Enter your phone number" /> | ||
</Stack> | ||
<Stack mt='2'> | ||
<Input | ||
InputLeftElement={ | ||
<Icon as={<MaterialIcons name="phone" />} | ||
size={5} ml="2" color="muted.600" />} | ||
variant="underlined" p={2} placeholder="Enter your city name" /> | ||
</Stack> | ||
<Stack mt='2'> | ||
<Input | ||
InputLeftElement={ | ||
<Icon as={<MaterialIcons name="location" />} | ||
size={5} ml="2" color="muted.600" />} | ||
variant="underlined" p={2} placeholder="Enter your pin code" /> | ||
</Stack> | ||
<Stack mt='2'> | ||
<Select | ||
// selectedValue={service} | ||
borderWidth='0' | ||
borderBottomWidth='1' | ||
minWidth="200" accessibilityLabel="Choose Service" | ||
placeholder="Choose Service" _selectedItem={{ | ||
bg: "teal.600", | ||
startIcon: | ||
<Icon as={<Fontisto name='blood-drop' />} | ||
size={5} />, | ||
endIcon: <CheckIcon size="5" /> | ||
}} mt={1} | ||
// onValueChange={itemValue => setService(itemValue)} | ||
> | ||
<Select.Item label="UX Research" value="ux" /> | ||
<Select.Item label="Web Development" value="web" /> | ||
<Select.Item label="Cross Platform Development" value="cross" /> | ||
<Select.Item label="UI Designing" value="ui" /> | ||
<Select.Item label="Backend Development" value="backend" /> | ||
</Select> | ||
</Stack> | ||
|
||
<Center> | ||
<Button | ||
mt='5' | ||
size='lg' | ||
w='1/2' | ||
fontSize='xl' | ||
rounded='2xl' | ||
> | ||
Continue | ||
</Button> | ||
</Center> | ||
</Stack> | ||
</FormControl> | ||
|
||
</View> | ||
); | ||
} | ||
|
||
export default CreateProfile | ||
|
||
const styles = StyleSheet.create({ | ||
container: { | ||
flex: 1, | ||
width: widthScreen, | ||
backgroundColor: "#fff", | ||
paddingHorizontal: heightScreen > 800 ? 32 : 26, | ||
justifyContent: "center", | ||
alignItems: "center", | ||
position: "relative", | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import * as React from 'react'; | ||
import { StyleSheet, View } from 'react-native'; | ||
import { heightScreen, widthScreen } from '../../utils/layout'; | ||
import { Box, Button, CloseIcon, HStack, Icon, IconButton, Text, VStack } from 'native-base'; | ||
import { AntDesign } from '@expo/vector-icons'; | ||
|
||
|
||
|
||
const Home = () => { | ||
|
||
return ( | ||
<View style={styles.container}> | ||
<Text>Hello</Text> | ||
|
||
</View> | ||
); | ||
} | ||
|
||
export default Home | ||
|
||
const styles = StyleSheet.create({ | ||
container: { | ||
flex: 1, | ||
width: widthScreen, | ||
backgroundColor: "#fff", | ||
paddingHorizontal: heightScreen > 800 ? 32 : 26, | ||
justifyContent: "center", | ||
alignItems: "center", | ||
position: "relative", | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters