mirror of
https://github.com/lemeow125/Reactnative-notesapp.git
synced 2024-11-17 06:29:27 +08:00
navigations and polished user info, home and add note screen
This commit is contained in:
parent
7008729348
commit
77cd205448
8 changed files with 144 additions and 21 deletions
3
App.tsx
3
App.tsx
|
@ -11,8 +11,10 @@ import AddNote from "./src/Routes/AddNote/AddNote";
|
||||||
import Login from "./src/Routes/Login/Login";
|
import Login from "./src/Routes/Login/Login";
|
||||||
import Register from "./src/Routes/Register/Register";
|
import Register from "./src/Routes/Register/Register";
|
||||||
|
|
||||||
|
|
||||||
const Drawer = createDrawerNavigator();
|
const Drawer = createDrawerNavigator();
|
||||||
|
|
||||||
|
|
||||||
export default function App() {
|
export default function App() {
|
||||||
return (
|
return (
|
||||||
<NavigationContainer>
|
<NavigationContainer>
|
||||||
|
@ -26,6 +28,7 @@ export default function App() {
|
||||||
<Drawer.Screen name="User Info" component={UserInfo} />
|
<Drawer.Screen name="User Info" component={UserInfo} />
|
||||||
<Drawer.Screen name="Login" component={Login} />
|
<Drawer.Screen name="Login" component={Login} />
|
||||||
<Drawer.Screen name="Register" component={Register} />
|
<Drawer.Screen name="Register" component={Register} />
|
||||||
|
|
||||||
</Drawer.Navigator>
|
</Drawer.Navigator>
|
||||||
</NavigationContainer>
|
</NavigationContainer>
|
||||||
);
|
);
|
||||||
|
|
19
package-lock.json
generated
19
package-lock.json
generated
|
@ -11,6 +11,7 @@
|
||||||
"@react-navigation/drawer": "^6.6.2",
|
"@react-navigation/drawer": "^6.6.2",
|
||||||
"@react-navigation/native": "^6.1.6",
|
"@react-navigation/native": "^6.1.6",
|
||||||
"@react-navigation/native-stack": "^6.9.12",
|
"@react-navigation/native-stack": "^6.9.12",
|
||||||
|
"@react-navigation/stack": "^6.3.16",
|
||||||
"expo": "~48.0.5",
|
"expo": "~48.0.5",
|
||||||
"expo-linear-gradient": "^12.1.1",
|
"expo-linear-gradient": "^12.1.1",
|
||||||
"expo-status-bar": "~1.4.4",
|
"expo-status-bar": "~1.4.4",
|
||||||
|
@ -4914,6 +4915,24 @@
|
||||||
"nanoid": "^3.1.23"
|
"nanoid": "^3.1.23"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@react-navigation/stack": {
|
||||||
|
"version": "6.3.16",
|
||||||
|
"resolved": "https://registry.npmjs.org/@react-navigation/stack/-/stack-6.3.16.tgz",
|
||||||
|
"integrity": "sha512-KTOn9cNuZ6p154Htbl2DiR95Wl+c7niLPRiGs7gjOkyVDGiaGQF9ODNQTYBDE1OxZGHe/EyYc6T2CbmiItLWDg==",
|
||||||
|
"dependencies": {
|
||||||
|
"@react-navigation/elements": "^1.3.17",
|
||||||
|
"color": "^4.2.3",
|
||||||
|
"warn-once": "^0.1.0"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"@react-navigation/native": "^6.0.0",
|
||||||
|
"react": "*",
|
||||||
|
"react-native": "*",
|
||||||
|
"react-native-gesture-handler": ">= 1.0.0",
|
||||||
|
"react-native-safe-area-context": ">= 3.0.0",
|
||||||
|
"react-native-screens": ">= 3.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@segment/loosely-validate-event": {
|
"node_modules/@segment/loosely-validate-event": {
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/@segment/loosely-validate-event/-/loosely-validate-event-2.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/@segment/loosely-validate-event/-/loosely-validate-event-2.0.0.tgz",
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
"@react-navigation/drawer": "^6.6.2",
|
"@react-navigation/drawer": "^6.6.2",
|
||||||
"@react-navigation/native": "^6.1.6",
|
"@react-navigation/native": "^6.1.6",
|
||||||
"@react-navigation/native-stack": "^6.9.12",
|
"@react-navigation/native-stack": "^6.9.12",
|
||||||
|
"@react-navigation/stack": "^6.3.16",
|
||||||
"expo": "~48.0.5",
|
"expo": "~48.0.5",
|
||||||
"expo-linear-gradient": "^12.1.1",
|
"expo-linear-gradient": "^12.1.1",
|
||||||
"expo-status-bar": "~1.4.4",
|
"expo-status-bar": "~1.4.4",
|
||||||
|
|
|
@ -5,11 +5,14 @@ import Background from '../../Components/Background/Background';
|
||||||
import { SafeAreaView } from 'react-native-safe-area-context';
|
import { SafeAreaView } from 'react-native-safe-area-context';
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import {TouchableOpacity,} from "react-native";
|
import {TouchableOpacity,} from "react-native";
|
||||||
|
import { RootDrawerParamList } from "../../Interfaces/Interfaces";
|
||||||
|
import { useNavigation } from "@react-navigation/native";
|
||||||
|
|
||||||
export default function AddNote() {
|
export default function AddNote() {
|
||||||
const [addnote, setNote] = useState("");
|
const [addnote, setNote] = useState("");
|
||||||
|
const [addtitle, setTitle] = useState("");
|
||||||
|
|
||||||
|
const navigation = useNavigation<RootDrawerParamList>();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Background>
|
<Background>
|
||||||
|
@ -21,8 +24,8 @@ export default function AddNote() {
|
||||||
style={styles.title}
|
style={styles.title}
|
||||||
placeholder="Title"
|
placeholder="Title"
|
||||||
placeholderTextColor="white"
|
placeholderTextColor="white"
|
||||||
onChangeText={setNote}
|
onChangeText={setTitle}
|
||||||
value={addnote}
|
value={addtitle}
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
<View style={styles.typehere}>
|
<View style={styles.typehere}>
|
||||||
|
@ -31,13 +34,20 @@ export default function AddNote() {
|
||||||
placeholder="Type here...."
|
placeholder="Type here...."
|
||||||
placeholderTextColor="white"
|
placeholderTextColor="white"
|
||||||
onChangeText={setNote}
|
onChangeText={setNote}
|
||||||
value={addnote}
|
value={addnote}
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
<TouchableOpacity style={styles.savebtn}>
|
<TouchableOpacity style={styles.savebtn}>
|
||||||
<Text style={styles.savenote}>SAVE</Text>
|
<Text style={styles.savenote}>SAVE</Text>
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
|
<TouchableOpacity style={styles.cancelbtn}
|
||||||
|
onPress={() => {
|
||||||
|
navigation.navigate("Home");
|
||||||
|
}}>
|
||||||
|
<Text style={styles.cancel}>CANCEL</Text>
|
||||||
|
</TouchableOpacity>
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
</SafeAreaView>
|
</SafeAreaView>
|
||||||
</Background>
|
</Background>
|
||||||
);
|
);
|
||||||
|
|
|
@ -2,10 +2,13 @@ import * as React from 'react';
|
||||||
import {View, Text} from 'react-native';
|
import {View, Text} from 'react-native';
|
||||||
import styles from '../../styles';
|
import styles from '../../styles';
|
||||||
import Background from '../../Components/Background/Background';
|
import Background from '../../Components/Background/Background';
|
||||||
import AddIcon from '../../Components/Icons/AddIcon/AddIcon';
|
import { useNavigation } from "@react-navigation/native";
|
||||||
|
import {TouchableOpacity,} from "react-native";
|
||||||
|
import { RootDrawerParamList } from "../../Interfaces/Interfaces";
|
||||||
|
|
||||||
export default function Home() {
|
export default function Home() {
|
||||||
//const navigation = ({ navigation}: {navigation:any}) => {
|
const navigation = useNavigation<RootDrawerParamList>();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Background>
|
<Background>
|
||||||
<Text style={{...styles.text_white, ...{fontSize: 25}}}>Clip Notes</Text>
|
<Text style={{...styles.text_white, ...{fontSize: 25}}}>Clip Notes</Text>
|
||||||
|
@ -16,13 +19,16 @@ export default function Home() {
|
||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
justifyContent: 'center',
|
justifyContent: 'center',
|
||||||
}}>
|
}}>
|
||||||
<View style={styles.homecont}>
|
<View style={styles.homecont}>
|
||||||
<View style={styles.addicon}>
|
<TouchableOpacity
|
||||||
<AddIcon size={32} color="white" />
|
onPress={() => {
|
||||||
<Text style={styles.no}>No notes yet...</Text>
|
navigation.navigate("Add Note");
|
||||||
</View>
|
}}>
|
||||||
|
<Text style={styles.newnote}>+</Text>
|
||||||
|
</TouchableOpacity>
|
||||||
|
<Text style={styles.no}>New note...</Text>
|
||||||
<View style={{margin: 16}} />
|
<View style={{margin: 16}} />
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
</Background>
|
</Background>
|
||||||
);
|
);
|
||||||
|
|
|
@ -6,12 +6,14 @@ import { SafeAreaView} from "react-native";
|
||||||
import { StatusBar } from "expo-status-bar";
|
import { StatusBar } from "expo-status-bar";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import {TouchableOpacity,} from "react-native";
|
import {TouchableOpacity,} from "react-native";
|
||||||
|
import { RootDrawerParamList } from "../../Interfaces/Interfaces";
|
||||||
|
import { useNavigation } from "@react-navigation/native";
|
||||||
|
|
||||||
export default function Login() {
|
export default function Login() {
|
||||||
const [username, setUsername] = useState("");
|
const [username, setUsername] = useState("");
|
||||||
const [password, setPassword] = useState("");
|
const [password, setPassword] = useState("");
|
||||||
|
|
||||||
|
const navigation = useNavigation<RootDrawerParamList>();
|
||||||
return (
|
return (
|
||||||
<Background>
|
<Background>
|
||||||
<Text style={{...styles.text_white, ...{fontSize: 32}}}></Text>
|
<Text style={{...styles.text_white, ...{fontSize: 32}}}></Text>
|
||||||
|
@ -45,7 +47,10 @@ export default function Login() {
|
||||||
<TouchableOpacity style={styles.loginBtn}>
|
<TouchableOpacity style={styles.loginBtn}>
|
||||||
<Text style={styles.loginText}>LOGIN</Text>
|
<Text style={styles.loginText}>LOGIN</Text>
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
<TouchableOpacity style={styles.registerbtn}>
|
<TouchableOpacity style={styles.registerbtn}
|
||||||
|
onPress={() => {
|
||||||
|
navigation.navigate("Register");
|
||||||
|
}}>
|
||||||
<Text style={styles.registertext}>REGISTER</Text>
|
<Text style={styles.registertext}>REGISTER</Text>
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
</View>
|
</View>
|
||||||
|
|
|
@ -4,15 +4,35 @@ import styles from '../../styles';
|
||||||
import Background from '../../Components/Background/Background';
|
import Background from '../../Components/Background/Background';
|
||||||
import { SafeAreaView } from 'react-native-safe-area-context';
|
import { SafeAreaView } from 'react-native-safe-area-context';
|
||||||
import UserIcon from '../../Components/Icons/UserIcon/UserIcon';
|
import UserIcon from '../../Components/Icons/UserIcon/UserIcon';
|
||||||
|
import {TouchableOpacity, TextInput} from "react-native";
|
||||||
|
import { useState } from "react";
|
||||||
|
|
||||||
export default function UserInfo() {
|
export default function UserInfo() {
|
||||||
|
const [isEditable, setIsEditable] = useState(false);
|
||||||
return (
|
return (
|
||||||
<Background>
|
<Background>
|
||||||
<Text style={{...styles.text_white, ...{fontSize: 32}}}></Text>
|
<Text style={{...styles.text_white, ...{fontSize: 32}}}></Text>
|
||||||
<SafeAreaView>
|
<SafeAreaView>
|
||||||
<View style={styles.userinfocont}>
|
<View style={styles.userinfocont}>
|
||||||
<Text style ={styles.userlabel} > <UserIcon size={32} color="white"/> USER INFO</Text>
|
<Text style ={styles.userlabel} > <UserIcon size={32} color="white"/> USER INFO</Text>
|
||||||
|
|
||||||
</View>
|
</View>
|
||||||
|
<View style={styles.form}>
|
||||||
|
<View style={styles.inputRow}>
|
||||||
|
<Text style={styles.label}>Username</Text>
|
||||||
|
<TextInput
|
||||||
|
style={[styles.inputUser, !isEditable && styles.disabledInput]}
|
||||||
|
editable={isEditable}
|
||||||
|
/>
|
||||||
|
|
||||||
|
</View>
|
||||||
|
<TouchableOpacity
|
||||||
|
style={styles.editButton}
|
||||||
|
onPress={() => setIsEditable(!isEditable)}
|
||||||
|
>
|
||||||
|
<Text style={styles.buttonText}>{isEditable ? "Save" : "Edit Profile"}</Text>
|
||||||
|
</TouchableOpacity>
|
||||||
|
</View>
|
||||||
</SafeAreaView>
|
</SafeAreaView>
|
||||||
</Background>
|
</Background>
|
||||||
);
|
);
|
||||||
|
|
|
@ -146,10 +146,6 @@ const styles = StyleSheet.create({
|
||||||
alignItems: 'flex-start',
|
alignItems: 'flex-start',
|
||||||
justifyContent: 'center',
|
justifyContent: 'center',
|
||||||
},
|
},
|
||||||
addicon:{
|
|
||||||
alignItems: 'center',
|
|
||||||
marginTop: 5,
|
|
||||||
},
|
|
||||||
no: {
|
no: {
|
||||||
fontSize: 20,
|
fontSize: 20,
|
||||||
color: 'white',
|
color: 'white',
|
||||||
|
@ -192,12 +188,21 @@ const styles = StyleSheet.create({
|
||||||
justifyContent: "center",
|
justifyContent: "center",
|
||||||
},
|
},
|
||||||
savebtn:{
|
savebtn:{
|
||||||
width: "50%",
|
width: "40%",
|
||||||
borderRadius: 25,
|
borderRadius: 25,
|
||||||
height: 50,
|
height: 40,
|
||||||
alignItems: "center",
|
alignItems: "center",
|
||||||
justifyContent: "center",
|
justifyContent: "center",
|
||||||
marginTop: 40,
|
marginTop: 10,
|
||||||
|
backgroundColor: "green",
|
||||||
|
},
|
||||||
|
cancelbtn:{
|
||||||
|
width: "40%",
|
||||||
|
borderRadius: 25,
|
||||||
|
height: 40,
|
||||||
|
alignItems: "center",
|
||||||
|
justifyContent: "center",
|
||||||
|
marginTop: 10,
|
||||||
backgroundColor: "green",
|
backgroundColor: "green",
|
||||||
},
|
},
|
||||||
savenote:{
|
savenote:{
|
||||||
|
@ -205,6 +210,11 @@ const styles = StyleSheet.create({
|
||||||
fontWeight: 'bold',
|
fontWeight: 'bold',
|
||||||
fontSize: 20,
|
fontSize: 20,
|
||||||
},
|
},
|
||||||
|
cancel:{
|
||||||
|
color: 'white',
|
||||||
|
fontWeight: 'bold',
|
||||||
|
fontSize: 20,
|
||||||
|
},
|
||||||
homecont:{
|
homecont:{
|
||||||
marginTop: 30,
|
marginTop: 30,
|
||||||
height: 150,
|
height: 150,
|
||||||
|
@ -214,6 +224,55 @@ const styles = StyleSheet.create({
|
||||||
alignItems: "center",
|
alignItems: "center",
|
||||||
justifyContent: "center",
|
justifyContent: "center",
|
||||||
},
|
},
|
||||||
|
newnote:{
|
||||||
|
color: 'white',
|
||||||
|
fontWeight: 'bold',
|
||||||
|
fontSize: 50,
|
||||||
|
},
|
||||||
|
//
|
||||||
|
form: {
|
||||||
|
flex: 1,
|
||||||
|
alignItems: "center",
|
||||||
|
},
|
||||||
|
inputRow: {
|
||||||
|
width: "60%",
|
||||||
|
height: 50,
|
||||||
|
marginTop: 50,
|
||||||
|
marginLeft:10,
|
||||||
|
justifyContent: "center",
|
||||||
|
},
|
||||||
|
label: {
|
||||||
|
marginBottom: 5,
|
||||||
|
marginLeft: 5,
|
||||||
|
fontSize: 20,
|
||||||
|
color: "white",
|
||||||
|
},
|
||||||
|
disabledInput: {
|
||||||
|
backgroundColor: "white",
|
||||||
|
borderRadius: 10,
|
||||||
|
|
||||||
|
},
|
||||||
|
editButton: {
|
||||||
|
backgroundColor: "green",
|
||||||
|
width: "20%",
|
||||||
|
borderRadius: 25,
|
||||||
|
height: 40,
|
||||||
|
alignItems: "center",
|
||||||
|
justifyContent: "center",
|
||||||
|
marginTop: 20,
|
||||||
|
marginLeft: 20
|
||||||
|
},
|
||||||
|
buttonText:{
|
||||||
|
color: "white",
|
||||||
|
},
|
||||||
|
inputUser:{
|
||||||
|
marginLeft: 10,
|
||||||
|
height: 40,
|
||||||
|
width: "100%",
|
||||||
|
color: "black",
|
||||||
|
backgroundColor: "white",
|
||||||
|
borderRadius: 10,
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
export default styles;
|
export default styles;
|
||||||
|
|
Loading…
Reference in a new issue