diff --git a/app/AddCard.tsx b/app/AddCard.tsx
new file mode 100644
index 0000000..dbfea4c
--- /dev/null
+++ b/app/AddCard.tsx
@@ -0,0 +1,53 @@
+import { SafeAreaView, StyleSheet, View } from "react-native";
+import React, { useState } from "react";
+import { SB_COLOR_SCHEME } from "@/constants";
+import { router } from "expo-router";
+import { Button } from "@swift-byte/switftbytecomponents";
+import { KeyboardAwareScrollView } from "react-native-keyboard-aware-scroll-view";
+import AddCardDetails from "@/components/AddCardDetails";
+
+export default function AddCard() {
+ return (
+
+
+
+
+
+
+
+
+
+
+
+ );
+}
+
+const styles = StyleSheet.create({
+ container: {
+ padding: 32,
+ flex: 1,
+ },
+ scrollView: {
+ backgroundColor: "white",
+ },
+ title: {
+ fontSize: 20,
+ fontWeight: "bold",
+ color: SB_COLOR_SCHEME.SB_PRIMARY,
+ },
+ dFlex: {
+ display: "flex",
+ flexDirection: "row",
+ justifyContent: "space-between",
+ alignItems: "center",
+ },
+ subtitle: {
+ fontSize: 15,
+ fontWeight: "bold",
+ color: SB_COLOR_SCHEME.SB_PRIMARY,
+ },
+});
diff --git a/app/PaymentMethod.tsx b/app/PaymentMethod.tsx
index daf9539..196b273 100644
--- a/app/PaymentMethod.tsx
+++ b/app/PaymentMethod.tsx
@@ -7,13 +7,13 @@ import {
View,
TouchableOpacity,
} from "react-native";
-import React, { useState } from "react";
+import React, { useEffect, useState } from "react";
import { SB_COLOR_SCHEME } from "@/constants";
import { Card, myCards } from "@/mock_data";
import RadioOutline from "../assets/icons/icon-radio-outline.svg";
import RadioFilled from "../assets/icons/icon-radio-filled.svg";
import AddCard from "../assets/icons/logo-add-card.svg";
-import { Link } from "expo-router";
+import { Link, router } from "expo-router";
import { Button } from "@swift-byte/switftbytecomponents";
import {
NavigationProp,
@@ -30,15 +30,20 @@ interface PaymentProps {
}
export default function PaymentMethod({ route, navigation }: PaymentProps) {
+ const [cards, setCards] = useState(myCards);
const [selectedCard, setSelectedCard] = useState(myCards[0]);
+ useEffect(() => {
+ setCards(myCards)
+ }, [])
+
return (
- {myCards.map((card) => {
+ {cards.map((card: Card) => {
return (
)}
- **** {card.last3Digits}
+
+ {card.cardNumber.toString().replace(/.(?=.{3})/g, "*")}
+
setSelectedCard(card)}>
-
+ router.navigate("/AddCard")}
+ >
New payment method
-
+
@@ -88,7 +98,7 @@ export default function PaymentMethod({ route, navigation }: PaymentProps) {
text={"Pay Now"}
type={"primary"}
onPress={function (): void {
- console.log("pressed");
+ // router.navigate({ pathname: '/success', params: { type: ''}})
}}
>
diff --git a/app/_layout.tsx b/app/_layout.tsx
index ec3de00..287e31b 100644
--- a/app/_layout.tsx
+++ b/app/_layout.tsx
@@ -54,19 +54,13 @@ function RootLayoutNav() {
return (
-
-
+
+
-
-
-
- {/* */}
+
+
+
+
+
-
+
+
{
+ return (
+
+ Name
+
+ Card Number
+ setCardNumber(parseInt(input))}
+ />
+
+
+ CVV
+
+
+
+ Expiry Date
+
+
+
+
+ );
+};
+
+const styles = StyleSheet.create({
+ card: {
+ backgroundColor: "#fff",
+ borderRadius: 10,
+ flex: 1,
+ },
+ label: {
+ fontSize: 15,
+ fontWeight: "bold",
+ color: SB_COLOR_SCHEME.SB_PRIMARY,
+ marginBottom: 10,
+ },
+ input: {
+ fontSize: 16,
+ padding: 15,
+ borderRadius: 10,
+ marginBottom: 20,
+ borderColor: "#BBC5C1",
+ borderWidth: 1,
+ },
+ row: {
+ flexDirection: "row",
+ gap: 10,
+ flex: 1,
+ },
+ smallInput: {
+ fontSize: 16,
+ padding: 15,
+ borderRadius: 10,
+ borderColor: "#BBC5C1",
+ borderWidth: 1,
+ },
+});
+
+export default AddCardDetails;
diff --git a/mock_data.ts b/mock_data.ts
index 494e6e7..21a49d5 100644
--- a/mock_data.ts
+++ b/mock_data.ts
@@ -46,6 +46,18 @@ export interface Customer {
phone: string;
}
+export interface User {
+ id: string;
+ firstName: string;
+ lastName: string;
+ email: string;
+ phone: string;
+ address: string;
+ password: string;
+ isMember: string;
+ cards: Card[];
+}
+
export interface Payment {
id: string;
amount: number;
@@ -64,9 +76,11 @@ export interface Cart {
export interface Card {
id: number,
- type: string,
- last3Digits: number,
- title: string
+ name: string;
+ cardNumber: number;
+ cvv: number;
+ expiryDate: string; // dd/mm/yyyy
+ type: 'visa' | 'master' | 'paypal' // visa, master, or paypal
}
export interface Order {
@@ -286,23 +300,29 @@ export const promoCode = [
export const myCards: Card[] = [
{
id: 1,
- type: 'visa',
- last3Digits: 4567,
- title: ''
+ name: "John Doe",
+ cardNumber: 1234567890123456,
+ cvv: 123,
+ expiryDate: "12/25/2024",
+ type: "visa"
},
{
id: 2,
- type: 'master',
- last3Digits: 7890,
- title: 'Credit Card'
+ name: "Alice Smith",
+ cardNumber: 9876543210987654,
+ cvv: 456,
+ expiryDate: "06/27/2023",
+ type: "master"
},
{
id: 3,
- type: 'paypal',
- last3Digits: 2345,
- title: 'Paypal'
+ name: "Bob Johnson",
+ cardNumber: 4567890123456789,
+ cvv: 789,
+ expiryDate: "09/30/2025",
+ type: "paypal"
}
-]
+];
export const customers: Customer[] = [
{
@@ -402,4 +422,8 @@ export const notifications = [
isNew: true,
},
-]
\ No newline at end of file
+]
+
+// export currentUser: User = {
+
+// }
\ No newline at end of file