-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding login and sign up pages #25
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
import React from 'react'; | ||
import { View, Text, TextInput, TouchableOpacity, StyleSheet } from 'react-native'; | ||
|
||
const ForgotPasswordScreen: React.FC = () => { | ||
const [phoneNumber, setPhoneNumber] = React.useState(''); | ||
const [otp, setOtp] = React.useState(''); | ||
const [newPassword, setNewPassword] = React.useState(''); | ||
const [confirmNewPassword, setConfirmNewPassword] = React.useState(''); | ||
|
||
const handleResetPassword = () => { | ||
if (newPassword !== confirmNewPassword) { | ||
// Passwords don't match | ||
console.log('Passwords do not match'); | ||
return; | ||
} | ||
|
||
// Add your reset password logic here | ||
console.log('Phone Number:', phoneNumber); | ||
console.log('OTP:', otp); | ||
console.log('New Password:', newPassword); | ||
}; | ||
|
||
return ( | ||
<View style={styles.container}> | ||
<Text style={styles.title}>Forgot Password</Text> | ||
<TextInput | ||
style={styles.input} | ||
placeholder="Phone Number" | ||
onChangeText={setPhoneNumber} | ||
value={phoneNumber} | ||
keyboardType="phone-pad" | ||
/> | ||
<TextInput | ||
style={styles.input} | ||
placeholder="OTP" | ||
onChangeText={setOtp} | ||
value={otp} | ||
keyboardType="numeric" | ||
/> | ||
<TextInput | ||
style={styles.input} | ||
placeholder="New Password" | ||
onChangeText={setNewPassword} | ||
value={newPassword} | ||
secureTextEntry | ||
/> | ||
<TextInput | ||
style={styles.input} | ||
placeholder="Re-enter New Password" | ||
onChangeText={setConfirmNewPassword} | ||
value={confirmNewPassword} | ||
secureTextEntry | ||
/> | ||
<TouchableOpacity style={styles.button} onPress={handleResetPassword}> | ||
<Text style={styles.buttonText}>Reset Password</Text> | ||
</TouchableOpacity> | ||
</View> | ||
); | ||
}; | ||
|
||
const styles = StyleSheet.create({ | ||
container: { | ||
flex: 1, | ||
justifyContent: 'center', | ||
alignItems: 'center', | ||
paddingHorizontal: 20, | ||
}, | ||
title: { | ||
fontSize: 24, | ||
fontWeight: 'bold', | ||
marginBottom: 20, | ||
}, | ||
input: { | ||
width: '100%', | ||
height: 40, | ||
borderWidth: 1, | ||
borderColor: '#ccc', | ||
borderRadius: 5, | ||
paddingHorizontal: 10, | ||
marginBottom: 10, | ||
}, | ||
button: { | ||
width: '100%', | ||
height: 40, | ||
backgroundColor: 'blue', | ||
justifyContent: 'center', | ||
alignItems: 'center', | ||
borderRadius: 5, | ||
marginBottom: 10, | ||
}, | ||
buttonText: { | ||
color: 'white', | ||
fontSize: 16, | ||
fontWeight: 'bold', | ||
}, | ||
}); | ||
|
||
export default ForgotPasswordScreen; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import React from 'react'; | ||
import { View, Text, Button, StyleSheet } from 'react-native'; | ||
|
||
const Dashboard: React.FC = () => { | ||
const handleNavigation = (page: string) => { | ||
// Handle navigation logic here | ||
console.log(`Navigating to ${page}`); | ||
}; | ||
|
||
const handleFeatureClick = (feature: string) => { | ||
// Handle feature click logic here | ||
console.log(`Clicked on feature: ${feature}`); | ||
}; | ||
|
||
return ( | ||
<View style={styles.container}> | ||
<View style={styles.middleButtons}> | ||
<Button title="Payment Due" onPress={() => handleFeatureClick('Payment Due')} /> | ||
<Button title="Visitors Update" onPress={() => handleFeatureClick('Visitors Update')} /> | ||
{/* Add more feature buttons as needed */} | ||
</View> | ||
|
||
<View style={styles.bottomButtons}> | ||
<Button title="Home" onPress={() => handleNavigation('Home')} /> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. use of expo router will make it easier to navigate |
||
<Button title="Profile" onPress={() => handleNavigation('Profile')} /> | ||
<Button title="Settings" onPress={() => handleNavigation('Settings')} /> | ||
<Button title="Logout" onPress={() => handleNavigation('Logout')} /> | ||
</View> | ||
</View> | ||
); | ||
}; | ||
|
||
const styles = StyleSheet.create({ | ||
container: { | ||
flex: 1, | ||
justifyContent: 'center', | ||
alignItems: 'center', | ||
}, | ||
middleButtons: { | ||
flex: 1, | ||
justifyContent: 'center', | ||
alignItems: 'center', | ||
}, | ||
bottomButtons: { | ||
flexDirection: 'row', | ||
justifyContent: 'space-around', | ||
alignItems: 'center', | ||
paddingBottom: 20, | ||
width: '100%', | ||
}, | ||
}); | ||
|
||
export default Dashboard; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
import React from 'react'; | ||
import { View, Text, TextInput, TouchableOpacity, StyleSheet } from 'react-native'; | ||
|
||
const LoginScreen: React.FC = () => { | ||
const [username, setUsername] = React.useState(''); | ||
const [password, setPassword] = React.useState(''); | ||
|
||
const handleLogin = () => { | ||
// Add your login logic here | ||
console.log('Username:', username); | ||
console.log('Password:', password); | ||
}; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. redirect this page directly from make this initial route |
||
|
||
const handleForgotPassword = () => { | ||
// Add your forgot password logic here | ||
console.log('Forgot Password'); | ||
}; | ||
|
||
const handleRegister = () => { | ||
// Add your register logic here | ||
console.log('Register'); | ||
}; | ||
|
||
return ( | ||
<View style={styles.container}> | ||
<Text style={styles.title}>RESIDENTRON</Text> | ||
<TextInput | ||
style={styles.input} | ||
placeholder="Username" | ||
onChangeText={setUsername} | ||
value={username} | ||
autoCapitalize="none" | ||
/> | ||
<TextInput | ||
style={styles.input} | ||
placeholder="Password" | ||
onChangeText={setPassword} | ||
value={password} | ||
secureTextEntry | ||
/> | ||
<TouchableOpacity style={styles.button} onPress={handleLogin}> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. currently change onpress to href={"/(tabs)/main"} |
||
<Text style={styles.buttonText}>Login</Text> | ||
</TouchableOpacity> | ||
<TouchableOpacity onPress={handleForgotPassword}> | ||
<Text style={styles.forgotPasswordText}>Forgot Password?</Text> | ||
</TouchableOpacity> | ||
<TouchableOpacity onPress={handleRegister}> | ||
<Text style={styles.registerText}>Register</Text> | ||
</TouchableOpacity> | ||
</View> | ||
); | ||
}; | ||
|
||
const styles = StyleSheet.create({ | ||
container: { | ||
flex: 1, | ||
justifyContent: 'center', | ||
alignItems: 'center', | ||
paddingHorizontal: 20, | ||
}, | ||
title: { | ||
fontSize: 24, | ||
fontWeight: 'bold', | ||
marginBottom: 20, | ||
}, | ||
input: { | ||
width: '100%', | ||
height: 40, | ||
borderWidth: 1, | ||
borderColor: '#ccc', | ||
borderRadius: 5, | ||
paddingHorizontal: 10, | ||
marginBottom: 10, | ||
}, | ||
button: { | ||
width: '100%', | ||
height: 40, | ||
backgroundColor: 'blue', | ||
justifyContent: 'center', | ||
alignItems: 'center', | ||
borderRadius: 5, | ||
marginBottom: 10, | ||
}, | ||
buttonText: { | ||
color: 'white', | ||
fontSize: 16, | ||
fontWeight: 'bold', | ||
}, | ||
forgotPasswordText: { | ||
marginTop: 10, | ||
color: 'blue', | ||
}, | ||
registerText: { | ||
marginTop: 10, | ||
color: 'blue', | ||
fontWeight: 'bold', | ||
}, | ||
}); | ||
|
||
export default LoginScreen; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
import React from 'react'; | ||
import { View, Text, TextInput, TouchableOpacity, StyleSheet } from 'react-native'; | ||
|
||
const MyAccountScreen: React.FC = () => { | ||
const [fullName, setFullName] = React.useState(''); | ||
const [email, setEmail] = React.useState(''); | ||
const [phoneNumber, setPhoneNumber] = React.useState(''); | ||
const [address, setAddress] = React.useState(''); | ||
|
||
const handleSaveChanges = () => { | ||
// Add your save changes logic here | ||
console.log('Full Name:', fullName); | ||
console.log('Email:', email); | ||
console.log('Phone Number:', phoneNumber); | ||
console.log('Address:', address); | ||
}; | ||
|
||
return ( | ||
<View style={styles.container}> | ||
<Text style={styles.title}>My Account</Text> | ||
<TextInput | ||
style={styles.input} | ||
placeholder="Full Name" | ||
onChangeText={setFullName} | ||
value={fullName} | ||
/> | ||
<TextInput | ||
style={styles.input} | ||
placeholder="Email" | ||
onChangeText={setEmail} | ||
value={email} | ||
keyboardType="email-address" | ||
/> | ||
<TextInput | ||
style={styles.input} | ||
placeholder="Phone Number" | ||
onChangeText={setPhoneNumber} | ||
value={phoneNumber} | ||
keyboardType="phone-pad" | ||
/> | ||
<TextInput | ||
style={styles.input} | ||
placeholder="Address" | ||
onChangeText={setAddress} | ||
value={address} | ||
multiline | ||
/> | ||
<TouchableOpacity style={styles.button} onPress={handleSaveChanges}> | ||
<Text style={styles.buttonText}>Save Changes</Text> | ||
</TouchableOpacity> | ||
</View> | ||
); | ||
}; | ||
|
||
const styles = StyleSheet.create({ | ||
container: { | ||
flex: 1, | ||
justifyContent: 'center', | ||
alignItems: 'center', | ||
paddingHorizontal: 20, | ||
}, | ||
title: { | ||
fontSize: 24, | ||
fontWeight: 'bold', | ||
marginBottom: 20, | ||
}, | ||
input: { | ||
width: '100%', | ||
height: 40, | ||
borderWidth: 1, | ||
borderColor: '#ccc', | ||
borderRadius: 5, | ||
paddingHorizontal: 10, | ||
marginBottom: 10, | ||
}, | ||
button: { | ||
width: '100%', | ||
height: 40, | ||
backgroundColor: 'blue', | ||
justifyContent: 'center', | ||
alignItems: 'center', | ||
borderRadius: 5, | ||
marginBottom: 10, | ||
}, | ||
buttonText: { | ||
color: 'white', | ||
fontSize: 16, | ||
fontWeight: 'bold', | ||
}, | ||
}); | ||
|
||
export default MyAccountScreen; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
redirect this page directly from
_layout.tsx that is you just need to change layout tsx one line