themed style

This commit is contained in:
Jaanu423
2025-09-26 18:13:59 +05:30
parent 3f49c28371
commit b248e5578f
+76 -78
View File
@@ -19,7 +19,6 @@ import type { StackNavigationProp } from "@react-navigation/stack";
import { RootStackParamList } from "../navigation/AppNavigator"; import { RootStackParamList } from "../navigation/AppNavigator";
import { CustomButton, CustomInput } from "../components/common/Custom"; import { CustomButton, CustomInput } from "../components/common/Custom";
import colors from "../components/colors"; import colors from "../components/colors";
import AnimatedText from "../components/common/AnimatedText";
const theme = { const theme = {
primary: "#111111", primary: "#111111",
@@ -50,91 +49,90 @@ export default function LoginScreen() {
]).start(); ]).start();
}, []); }, []);
const handleContinue = async () => { const handleContinue = async () => {
if (mobile.length === 10) { if (mobile.length === 10) {
setLoading(true); setLoading(true);
try { try {
const res = await axios.get(LOGIN_URL, { const res = await axios.get(LOGIN_URL, {
params: { mobile }, params: { mobile },
}); });
console.log("OTP sent response:", res.data); console.log("OTP sent response:", res.data);
if (res.data.statusCode === 200) { if (res.data.statusCode === 200) {
navigation.navigate("OtpVarify", { mobile }); navigation.navigate("OtpVarify", { mobile });
} else { } else {
Alert.alert("Error", res.data.message || "Failed to send OTP"); Alert.alert("Error", res.data.message || "Failed to send OTP");
}
} catch (error: any) {
console.error("Login error:", error);
if (axios.isAxiosError(error)) {
console.log("Error message:", error.message);
console.log("Error response:", error.response?.data);
console.log("Error status:", error.response?.status);
console.log("Error headers:", error.response?.headers);
} else {
console.log("Unexpected error:", error);
}
Alert.alert("Error", "Failed to send OTP. Please try again.");
} finally {
setLoading(false);
} }
} catch (error: any) { } else {
console.error("Login error:", error); Alert.alert("Please enter a valid 10-digit mobile number");
if (axios.isAxiosError(error)) {
console.log("Error message:", error.message);
console.log("Error response:", error.response?.data);
console.log("Error status:", error.response?.status);
console.log("Error headers:", error.response?.headers);
} else {
console.log("Unexpected error:", error);
}
Alert.alert("Error", "Failed to send OTP. Please try again.");
} finally {
setLoading(false);
} }
} else { };
Alert.alert("Please enter a valid 10-digit mobile number");
}
};
return ( return (
<KeyboardAvoidingView <KeyboardAvoidingView
style={styles.container} style={styles.container}
behavior={Platform.OS === "ios" ? "padding" : undefined} behavior={Platform.OS === "ios" ? "padding" : undefined}
>
<StatusBar barStyle="dark-content" backgroundColor={theme.background} />
{/* Top content */}
<View style={styles.topSection}>
{/* <AnimatedText text="Welcome to Reanimated" style={styles.subtitle} delay={200} /> */}
<Text style={styles.brand}>CircleCollect</Text>
<Text style={styles.title}>Welcome Back 👋</Text>
<Text style={styles.subtitle}>
Enter your mobile number to sign in and continue.
</Text>
<Animated.View
style={[
styles.inputWrapper,
{ opacity: fade, transform: [{ translateY: slide }] },
]}
>
<CustomInput
label="Mobile Number"
placeholder="Enter Mobile Number"
value={mobile}
onChangeText={setMobile}
keyboardType="phone-pad"
maxLength={10}
icon="call-outline"
/>
</Animated.View>
</View>
{/* Bottom Button */}
<Animated.View
style={[styles.bottomSection, { transform: [{ scale: ctaScale }] }]}
> >
<CustomButton title={loading ? "Loading..." : "Continue"} onPress={handleContinue} icon="arrow-forward" /> <StatusBar barStyle="dark-content" backgroundColor={theme.background} />
<Text style={styles.footerText}> {/* Top content */}
By continuing, you agree to our{" "} <View style={styles.topSection}>
<Text style={{ color: theme.accent, fontWeight: "600" }}> <Text style={styles.brand}>CircleCollect</Text>
Terms & Privacy <Text style={styles.title}>Welcome Back 👋</Text>
<Text style={styles.subtitle}>
Enter your mobile number to sign in and continue.
</Text> </Text>
</Text>
</Animated.View> <Animated.View
</KeyboardAvoidingView> style={[
); styles.inputWrapper,
{ opacity: fade, transform: [{ translateY: slide }] },
]}
>
<CustomInput
label="Mobile Number"
placeholder="Enter Mobile Number"
value={mobile}
onChangeText={setMobile}
keyboardType="phone-pad"
maxLength={10}
icon="call-outline"
/>
</Animated.View>
</View>
{/* Bottom Button */}
<Animated.View
style={[styles.bottomSection, { transform: [{ scale: ctaScale }] }]}
>
<CustomButton title={loading ? "Loading..." : "Continue"} onPress={handleContinue} icon="arrow-forward" />
<Text style={styles.footerText}>
By continuing, you agree to our{" "}
<Text style={{ color: theme.accent, fontWeight: "600" }}>
Terms & Privacy
</Text>
</Text>
</Animated.View>
</KeyboardAvoidingView>
);
} }
const styles = StyleSheet.create({ const styles = StyleSheet.create({