diff --git a/README.md b/README.md index 5aab72e..ac3d1c1 100644 --- a/README.md +++ b/README.md @@ -5,9 +5,29 @@ - 📫 How to reach me **kushenthimira@gmail.com** +

Features

+ +- [x] Create Account +- [x] Login +- [x] Reset Password +- [x] UAC (Account Types - Regular, Rider, Agent) +- [x] Dark Theme +- [x] New Request (Cash on Delivery) +- [x] List Requests (With Queries) +- [x] Select Date & Time +- [x] List Requests (With Queries) +- [x] Track Status of Requests +- [x] Get Current Location +- [ ] Select / Change Location +- [ ] Navigation Support (Pickup Location & Drop Location) +- [ ] Track Requests / Deliveries +- [ ] Price Estimation +- [ ] Add Payment Methods +- [ ] Manage Payment Methods +

Resources

-- 📱 Downloadable APK available **here** +- 📱 Downloadable APK available **here** | | | | | :---------------------------------------------------------------: | :---------------------------------------------------------------: | :---------------------------------------------------------------: | diff --git a/app.json b/app.json index b6b7ff6..7b5ee45 100644 --- a/app.json +++ b/app.json @@ -3,7 +3,7 @@ "name": "Pick & Go", "slug": "pickngo", "owner": "kushenthimira", - "version": "1.1.0", + "version": "2.0.0", "orientation": "portrait", "icon": "./assets/icon.png", "splash": { @@ -20,7 +20,7 @@ "permissions": ["LOCATION"], "adaptiveIcon": { "foregroundImage": "./assets/icon.png", - "backgroundColor": "#ffffff" + "backgroundColor": "#262E48" }, "config": { "googleMaps": { "apiKey": "AIzaSyD87ToWqo4Y8vIjlgURucGldvbD5h44l3k" } diff --git a/assets/icon.png b/assets/icon.png index 79ba7cc..fc699f4 100644 Binary files a/assets/icon.png and b/assets/icon.png differ diff --git a/assets/previews/10.png b/assets/previews/10.png index 2bc581c..bc4d156 100644 Binary files a/assets/previews/10.png and b/assets/previews/10.png differ diff --git a/assets/previews/12.png b/assets/previews/12.png index 0382b2c..bd49928 100644 Binary files a/assets/previews/12.png and b/assets/previews/12.png differ diff --git a/assets/previews/5.png b/assets/previews/5.png index 568611c..a3cff61 100644 Binary files a/assets/previews/5.png and b/assets/previews/5.png differ diff --git a/assets/previews/6.png b/assets/previews/6.png index 8d43c61..3a1c405 100644 Binary files a/assets/previews/6.png and b/assets/previews/6.png differ diff --git a/assets/previews/7.png b/assets/previews/7.png index d56dc11..3f8c1ad 100644 Binary files a/assets/previews/7.png and b/assets/previews/7.png differ diff --git a/src/components/InfoCard.js b/src/components/InfoCard.js index e3bfe76..294e05c 100644 --- a/src/components/InfoCard.js +++ b/src/components/InfoCard.js @@ -26,6 +26,9 @@ export const InfoCard = ({ Drop Location: {drop} + + Payment Method: Cash on Delivery + } > diff --git a/src/components/LocationCard.js b/src/components/LocationCard.js index e861abc..c07ef45 100644 --- a/src/components/LocationCard.js +++ b/src/components/LocationCard.js @@ -7,6 +7,7 @@ import { useTheme, Button, } from "@ui-kitten/components"; +import { MaterialCommunityIcons } from "@expo/vector-icons"; export const LocationCard = ({ title = "Pickup Location", @@ -14,6 +15,8 @@ export const LocationCard = ({ onPress, style, icon = "pin", + btnText = "Change", + vector = false, }) => { const theme = useTheme(); return ( @@ -49,11 +52,21 @@ export const LocationCard = ({ backgroundColor: theme["color-info-100"], }} > - + {vector == false ? ( + + ) : ( + + )} + diff --git a/src/components/NewCard.js b/src/components/NewCard.js index 43b9fe1..855ef99 100644 --- a/src/components/NewCard.js +++ b/src/components/NewCard.js @@ -2,7 +2,7 @@ import React, { useContext } from "react"; import { Text, Card, useTheme, Button } from "@ui-kitten/components"; import { ThemeContext } from "../configs/Theme"; -export const NewCard = ({ onPress }) => { +export const NewCard = ({ onPress, isProfile = false }) => { const themeContext = useContext(ThemeContext); const theme = useTheme(); return ( @@ -37,12 +37,22 @@ export const NewCard = ({ onPress }) => { are ready to deliver fast and first-rate customer service. + {isProfile && ( + + )} ); }; diff --git a/src/components/OngoingCard.js b/src/components/OngoingCard.js index 7fac763..248d0ef 100644 --- a/src/components/OngoingCard.js +++ b/src/components/OngoingCard.js @@ -57,12 +57,12 @@ export const OngoingCard = ({ onPress, style }) => { color: theme["color-info-default"], }} > - Ongoing Deliveries + Ongoing Requests diff --git a/src/components/PaymentCard.js b/src/components/PaymentCard.js index ee203e3..df6c92a 100644 --- a/src/components/PaymentCard.js +++ b/src/components/PaymentCard.js @@ -14,7 +14,7 @@ export const PaymentCard = ({ type, number, onPress, style }) => { const themeContext = useContext(ThemeContext); const TrashIcon = (props) => ; return ( - + { const themeContext = useContext(ThemeContext); const LogoutIcon = (props) => ; @@ -35,47 +36,67 @@ export const ProfileCard = ({ flexDirection: "row", }} > - - - + + + + + ) : ( + + - + )} {addName == true ? ( ) : ( diff --git a/src/navigation/AppNavigator.js b/src/navigation/AppNavigator.js index c6787ab..03548a3 100644 --- a/src/navigation/AppNavigator.js +++ b/src/navigation/AppNavigator.js @@ -13,6 +13,7 @@ import { AuthContext } from "../provider/AuthProvider"; //Screens import Home from "../screens/Home"; import NewRequest from "../screens/NewRequest"; +import NewRider from "../screens/NewRider"; import Confirmation from "../screens/Confirmation"; import Ongoing from "../screens/Ongoing"; import PaymentMethods from "../screens/PaymentMethods"; @@ -71,6 +72,7 @@ const Main = () => { > + diff --git a/src/screens/Confirmation.js b/src/screens/Confirmation.js index 15b61f4..f904558 100644 --- a/src/screens/Confirmation.js +++ b/src/screens/Confirmation.js @@ -14,6 +14,8 @@ export default function ({ navigation, route }) { date: request.date, time: request.time, user: request.user, + name: request.name, + phone: request.phone, id, pickAd: request.pickAd, pickLat: request.pickLat, @@ -24,6 +26,7 @@ export default function ({ navigation, route }) { lat: request.lat, long: request.long, delivered: false, + rider: null, }); navigation.navigate("MainTabs"); }; diff --git a/src/screens/Help.js b/src/screens/Help.js index 0eb0fa5..fb282be 100644 --- a/src/screens/Help.js +++ b/src/screens/Help.js @@ -28,10 +28,10 @@ export default function ({ navigation }) { const handleGHPress = useCallback(async () => { await Linking.openURL("https://github.com/kushenthimira/posify/releases"); }, []); - const FacebookIcon = (props) => ; - const GoogleIcon = (props) => ; - const TwitterIcon = (props) => ; - const GithubIcon = (props) => ; + const FacebookIcon = (props) => ; + const GoogleIcon = (props) => ; + const TwitterIcon = (props) => ; + const GithubIcon = (props) => ; return ( { + getNote(); + }, []); + + const getNote = async () => { + const docSnap = await getDoc(doc(db, "users", user)); + if (docSnap.exists()) { + const userData = docSnap.data(); + setProfile(userData); + } else { + const userData = { name: "", phone: "" }; + setProfile(userData); + } + }; + + const [refreshing, setRefreshing] = useState(true); + const [agentList, setAgentList] = useState([]); + useEffect(() => { + getAgentList(); + }, []); + + const getAgentList = async () => { + const q = query(collection(db, "requests"), where("rider", "==", null)); + const querySnapshot = await getDocs(q); + setAgentList( + querySnapshot.docs.map((doc) => ({ ...doc.data(), id: doc.id })) + ); + setRefreshing(false); + if (querySnapshot.empty) { + setAgentList(null); + } + }; + + const [riderList, setRiderList] = useState([]); + useEffect(() => { + getRiderList(); + }, []); + + const getRiderList = async () => { + const q = query(collection(db, "requests"), where("riderID", "==", user)); + const querySnapshot = await getDocs(q); + setRiderList( + querySnapshot.docs.map((doc) => ({ ...doc.data(), id: doc.id })) + ); + setRefreshing(false); + if (querySnapshot.empty) { + setRiderList(null); + } + }; + return ( - - { - navigation.navigate("ChangeLocation", { - location: { - mapMarker: mapMarker, - mapRegion: mapRegion, - address: address, - }, - }); - }} - /> - { - navigation.navigate("OngoingRequests"); - }} - /> - { - navigation.navigate("NewRequest", { - request: { - user, - pickAd: address, - pickLat: lat, - pickLong: long, - lat: 6.870622, - long: 79.9216138, - }, - }); - }} - /> - + <> + {RenderIf( + profile.type == null, + + { + navigation.navigate("ChangeLocation", { + location: { + mapMarker: mapMarker, + mapRegion: mapRegion, + address: address, + }, + }); + }} + /> + { + navigation.navigate("OngoingRequests"); + }} + /> + {profile.name == "" || profile.phone == "" ? ( + + navigation.navigate("ProfileInformation", { + user: { + email: auth.currentUser.email, + id: auth.currentUser.uid, + name: profile.name, + phone: profile.phone, + }, + }) + } + /> + ) : ( + { + navigation.navigate("NewRequest", { + request: { + user, + pickAd: address, + pickLat: lat, + pickLong: long, + lat: 6.870622, + long: 79.9216138, + name: profile.name, + phone: profile.phone, + }, + }); + }} + /> + )} + + )} + {RenderIf( + profile.type == "rider", + + + {riderList == null && ( + + + + + No Requests Available, Pull to Refresh... + + + + )} + + } + refreshControl={ + + } + data={riderList} + keyExtractor={(item) => `${item.id}`} + renderItem={({ item }) => + item.delivered == false && ( + { + navigation.navigate("Ongoing", { + request: { + id: item.id, + pickAd: item.pickAd, + dropAd: item.dropAd, + date: item.date, + time: item.time, + pickLat: item.pickLat, + pickLong: item.pickLong, + dropLat: item.dropLat, + dropLong: item.dropLong, + lat: item.lat, + long: item.long, + phone: item.phone, + name: item.name, + rider: item.name, + riderPhone: item.phone, + price: item.price, + type: "rider", + }, + }); + }} + /> + ) + } + /> + + )} + {RenderIf( + profile.type == "agent", + + + {agentList == null && ( + + + + + No Requests Available, Pull to Refresh... + + + + )} + + } + refreshControl={ + + } + data={agentList} + keyExtractor={(item) => `${item.id}`} + renderItem={({ item }) => ( + { + navigation.navigate("Ongoing", { + request: { + id: item.id, + pickAd: item.pickAd, + dropAd: item.dropAd, + date: item.date, + time: item.time, + pickLat: item.pickLat, + pickLong: item.pickLong, + dropLat: item.dropLat, + dropLong: item.dropLong, + lat: item.lat, + long: item.long, + phone: item.phone, + name: item.name, + rider: item.name, + riderPhone: item.phone, + price: item.price, + type: "agent", + }, + }); + }} + /> + )} + /> + + )} + ); } diff --git a/src/screens/NewRequest.js b/src/screens/NewRequest.js index 4b3d277..f1cc123 100644 --- a/src/screens/NewRequest.js +++ b/src/screens/NewRequest.js @@ -95,6 +95,8 @@ export default function ({ navigation, route }) { date, time, user: request.user, + name: request.name, + phone: request.phone, pickAd: request.pickAd, pickLat: request.pickLat, pickLong: request.pickLong, diff --git a/src/screens/NewRider.js b/src/screens/NewRider.js new file mode 100644 index 0000000..a60686e --- /dev/null +++ b/src/screens/NewRider.js @@ -0,0 +1,69 @@ +import React, { useState, useEffect } from "react"; +import { FlatList, RefreshControl } from "react-native"; +import { + getFirestore, + query, + where, + collection, + getDocs, + doc, + updateDoc, +} from "firebase/firestore/lite"; +import Screen from "../components/Screen"; +import { LocationCard } from "../components/LocationCard"; + +export default function ({ navigation, route }) { + const { requestID, price } = route.params; + const db = getFirestore(); + const [refreshing, setRefreshing] = useState(true); + const [agentList, setAgentList] = useState([]); + + useEffect(() => { + getAgentList(); + }, []); + + const getAgentList = async () => { + const q = query(collection(db, "users"), where("type", "==", "rider")); + const querySnapshot = await getDocs(q); + setAgentList( + querySnapshot.docs.map((doc) => ({ ...doc.data(), id: doc.id })) + ); + setRefreshing(false); + }; + + return ( + { + navigation.goBack(); + }} + headerTitle="Select Rider" + > + + } + data={agentList} + keyExtractor={(item) => `${item.id}`} + renderItem={({ item }) => ( + { + const requestDoc = doc(db, "requests", requestID); + const newFields = { + rider: item.name, + riderID: item.id, + riderPhone: item.phone, + price, + }; + await updateDoc(requestDoc, newFields); + navigation.navigate("MainTabs"); + }} + /> + )} + /> + + ); +} diff --git a/src/screens/Ongoing.js b/src/screens/Ongoing.js index 44bb556..3b7e8d2 100644 --- a/src/screens/Ongoing.js +++ b/src/screens/Ongoing.js @@ -1,10 +1,30 @@ -import React from "react"; -import { StyleSheet } from "react-native"; -import { Button, Card, Layout, Text } from "@ui-kitten/components"; +import React, { useCallback, useState } from "react"; +import { StyleSheet, Linking } from "react-native"; +import { + Button, + Layout, + Text, + Icon, + Card, + Input, + OverflowMenu, + TopNavigationAction, + TopNavigation, + MenuItem, +} from "@ui-kitten/components"; +import { doc, updateDoc, getFirestore } from "firebase/firestore/lite"; import Screen from "../components/Screen"; export default function ({ navigation, route }) { const { request } = route.params; + const db = getFirestore(); + const handleCall = useCallback(async () => { + await Linking.openURL("tel:" + request.riderPhone); + }, []); + const MapIcon = (props) => ; + const CallIcon = (props) => ; + const [price, setPrice] = useState(""); + return ( { @@ -17,15 +37,37 @@ export default function ({ navigation, route }) { style={styles.card} header={ - - #{request.id} - - + + + #{request.id} + + {request.rider && ( + + ({request.rider}) + + )} + + + Pickup Location: {request.pickAd} Drop Location: {request.dropAd} + + Payment Type: Cash on Delivery + + {request.price && ( + + Price: Rs.{request.price} + + )} } > @@ -40,24 +82,82 @@ export default function ({ navigation, route }) { Time: {request.time} + + + + {request.riderPhone && ( + + )} + + + {request.type == "rider" && ( - + )} + {request.type == "agent" && ( + <> + setPrice(nextValue)} + /> + + + )} ); diff --git a/src/screens/OngoingRequests.js b/src/screens/OngoingRequests.js index 1ae9137..0139931 100644 --- a/src/screens/OngoingRequests.js +++ b/src/screens/OngoingRequests.js @@ -1,4 +1,4 @@ -import React, { useState, useEffect } from "react"; +import React, { useState, useEffect, useContext } from "react"; import { FlatList, RefreshControl } from "react-native"; import { query, @@ -8,13 +8,16 @@ import { getFirestore, } from "firebase/firestore/lite"; import { getAuth } from "firebase/auth"; +import { Icon, Layout, Text, Card, useTheme } from "@ui-kitten/components"; +import { ThemeContext } from "../configs/Theme"; import Screen from "../components/Screen"; import { RequestCard } from "../components/RequestCard"; export default function ({ navigation }) { const auth = getAuth(); const db = getFirestore(); - + const themeContext = useContext(ThemeContext); + const theme = useTheme(); const [refreshing, setRefreshing] = useState(true); const [list, setList] = useState([]); @@ -30,6 +33,9 @@ export default function ({ navigation }) { const querySnapshot = await getDocs(q); setList(querySnapshot.docs.map((doc) => ({ ...doc.data(), id: doc.id }))); setRefreshing(false); + if (querySnapshot.empty) { + setList(null); + } }; return ( @@ -37,9 +43,56 @@ export default function ({ navigation }) { backAction={() => { navigation.goBack(); }} - headerTitle={"Ongoing Deliveries"} + headerTitle={"Ongoing Requests"} > + {list == null && ( + + + + + No Requests Available, Pull to Refresh... + + + + )} + + } refreshControl={ } @@ -65,6 +118,10 @@ export default function ({ navigation }) { dropLong: item.dropLong, lat: item.lat, long: item.long, + phone: item.phone, + name: item.name, + rider: item.rider, + riderPhone: item.riderPhone, }, }); }} diff --git a/src/screens/PaymentMethods.js b/src/screens/PaymentMethods.js index 2d4cf35..3ce5103 100644 --- a/src/screens/PaymentMethods.js +++ b/src/screens/PaymentMethods.js @@ -3,6 +3,7 @@ import Screen from "../components/Screen"; import { PaymentCard } from "../components/PaymentCard"; import { Icon, Button } from "@ui-kitten/components"; import { ThemeContext } from "../configs/Theme"; +import { LocationCard } from "../components/LocationCard"; export default function ({ navigation }) { const themeContext = useContext(ThemeContext); @@ -29,6 +30,13 @@ export default function ({ navigation }) { navigation.navigate("NewPayment"); }} /> + diff --git a/src/screens/Profile.js b/src/screens/Profile.js index 604eaf5..e5462a9 100644 --- a/src/screens/Profile.js +++ b/src/screens/Profile.js @@ -11,7 +11,7 @@ export default function ({ navigation }) { const db = getFirestore(); const themeContext = useContext(ThemeContext); - const [user, setUser] = useState([]); + const [user, setUser] = useState({ name: "", phone: "" }); useEffect(() => { getNote(); @@ -23,34 +23,57 @@ export default function ({ navigation }) { const userData = docSnap.data(); setUser(userData); } else { - const userData = null; + const userData = { name: "", phone: "" }; setUser(userData); } }; return ( - {user.name == null || user.phone == null ? ( - { - signOut(auth); - }} - onEditPress={() => - navigation.navigate("ProfileInformation", { - user: { - email: auth.currentUser.email, - id: auth.currentUser.uid, - name: user.name, - phone: user.phone, - }, - }) - } - addName - /> + {user.type == null ? ( + user.name == "" || user.phone == "" ? ( + { + signOut(auth); + }} + onEditPress={() => + navigation.navigate("ProfileInformation", { + user: { + email: auth.currentUser.email, + id: auth.currentUser.uid, + name: user.name, + phone: user.phone, + }, + }) + } + addName + /> + ) : ( + { + signOut(auth); + }} + onEditPress={() => + navigation.navigate("ProfileInformation", { + user: { + name: user.name, + phone: user.phone, + email: auth.currentUser.email, + id: auth.currentUser.uid, + }, + }) + } + name={user.name} + /> + ) ) : ( + )} + {user.type == null && ( + { + navigation.navigate("PaymentMethods"); + }} /> )} - - { - navigation.navigate("PaymentMethods"); - }} - /> - - #{request.id} - - + + + #{request.id} + + {request.rider && ( + + ({request.rider}) + + )} + + Pickup Location: {request.pickAd} Drop Location: {request.dropAd} + + Payment Type: Cash on Delivery + + {request.price && ( + + Price: Rs.{request.price} + + )} } > diff --git a/src/screens/Requests.js b/src/screens/Requests.js index afe6609..e3fc10e 100644 --- a/src/screens/Requests.js +++ b/src/screens/Requests.js @@ -1,4 +1,4 @@ -import React, { useState, useEffect } from "react"; +import React, { useState, useEffect, useContext } from "react"; import { FlatList, RefreshControl } from "react-native"; import { query, @@ -6,14 +6,21 @@ import { collection, getDocs, getFirestore, + getDoc, + doc, } from "firebase/firestore/lite"; import { getAuth } from "firebase/auth"; +import { Icon, Layout, Text, Card, useTheme } from "@ui-kitten/components"; import Screen from "../components/Screen"; import { RequestCard } from "../components/RequestCard"; +import RenderIf from "../configs/RenderIf"; +import { ThemeContext } from "../configs/Theme"; export default function ({ navigation }) { const auth = getAuth(); const db = getFirestore(); + const themeContext = useContext(ThemeContext); + const theme = useTheme(); const [refreshing, setRefreshing] = useState(true); @@ -30,59 +37,376 @@ export default function ({ navigation }) { const querySnapshot = await getDocs(q); setList(querySnapshot.docs.map((doc) => ({ ...doc.data(), id: doc.id }))); setRefreshing(false); + if (querySnapshot.empty) { + setList(null); + } + }; + + const [riderList, setRiderList] = useState([]); + useEffect(() => { + getRiderList(); + }, []); + + const getRiderList = async () => { + const q = query( + collection(db, "requests"), + where("riderID", "==", auth.currentUser.uid) + ); + const querySnapshot = await getDocs(q); + setRiderList( + querySnapshot.docs.map((doc) => ({ ...doc.data(), id: doc.id })) + ); + setRefreshing(false); + if (querySnapshot.empty) { + setRiderList(null); + } + }; + + const [agentList, setAgentList] = useState([]); + useEffect(() => { + getAgentList(); + }, []); + + const getAgentList = async () => { + const q = query(collection(db, "requests"), where("rider", "!=", null)); + const querySnapshot = await getDocs(q); + setAgentList( + querySnapshot.docs.map((doc) => ({ ...doc.data(), id: doc.id })) + ); + setRefreshing(false); + if (querySnapshot.empty) { + setAgentList(null); + } + }; + + const [profile, setProfile] = useState({ name: "", phone: "" }); + + useEffect(() => { + getNote(); + }, []); + + const getNote = async () => { + const docSnap = await getDoc(doc(db, "users", auth.currentUser.uid)); + if (docSnap.exists()) { + const userData = docSnap.data(); + setProfile(userData); + } else { + const userData = { name: "", phone: "" }; + setProfile(userData); + } }; return ( - - - } - data={list} - keyExtractor={(item) => `${item.id}`} - renderItem={({ item }) => - item.delivered == true ? ( - { - navigation.navigate("Request", { - request: { - id: item.id, - pickAd: item.pickAd, - dropAd: item.dropAd, - date: item.date, - time: item.time, - }, - }); - }} - /> - ) : ( - { - navigation.navigate("Ongoing", { - request: { - id: item.id, - pickAd: item.pickAd, - dropAd: item.dropAd, - date: item.date, - time: item.time, - pickLat: item.pickLat, - pickLong: item.pickLong, - dropLat: item.dropLat, - dropLong: item.dropLong, - lat: item.lat, - long: item.long, - }, - }); - }} - /> - ) - } - /> - + <> + {RenderIf( + profile.type == null, + + + {list == null && ( + + + + + No Requests Available, Pull to Refresh... + + + + )} + + } + refreshControl={ + + } + data={list} + keyExtractor={(item) => `${item.id}`} + renderItem={({ item }) => + item.delivered == true ? ( + { + navigation.navigate("Request", { + request: { + id: item.id, + pickAd: item.pickAd, + dropAd: item.dropAd, + date: item.date, + time: item.time, + phone: item.phone, + name: item.name, + rider: item.rider, + riderPhone: item.riderPhone, + price: item.price, + }, + }); + }} + /> + ) : ( + { + navigation.navigate("Ongoing", { + request: { + id: item.id, + pickAd: item.pickAd, + dropAd: item.dropAd, + date: item.date, + time: item.time, + pickLat: item.pickLat, + pickLong: item.pickLong, + dropLat: item.dropLat, + dropLong: item.dropLong, + lat: item.lat, + long: item.long, + phone: item.phone, + name: item.name, + rider: item.rider, + riderPhone: item.riderPhone, + price: item.price, + }, + }); + }} + /> + ) + } + /> + + )} + {RenderIf( + profile.type == "rider", + + + {riderList == null && ( + + + + + No Requests Available, Pull to Refresh... + + + + )} + + } + refreshControl={ + + } + data={riderList} + keyExtractor={(item) => `${item.id}`} + renderItem={({ item }) => + item.delivered == true && ( + { + navigation.navigate("Request", { + request: { + id: item.id, + pickAd: item.pickAd, + dropAd: item.dropAd, + date: item.date, + time: item.time, + name: item.name, + rider: item.name, + price: item.price, + }, + }); + }} + /> + ) + } + /> + + )} + {RenderIf( + profile.type == "agent", + + + {agentList == null && ( + + + + + No Requests Available, Pull to Refresh... + + + + )} + + } + refreshControl={ + + } + data={agentList} + keyExtractor={(item) => `${item.id}`} + renderItem={({ item }) => + item.delivered == true ? ( + { + navigation.navigate("Request", { + request: { + id: item.id, + pickAd: item.pickAd, + dropAd: item.dropAd, + date: item.date, + time: item.time, + phone: item.phone, + name: item.name, + rider: item.name, + riderPhone: item.phone, + price: item.price, + }, + }); + }} + /> + ) : ( + { + navigation.navigate("Ongoing", { + request: { + id: item.id, + pickAd: item.pickAd, + dropAd: item.dropAd, + date: item.date, + time: item.time, + pickLat: item.pickLat, + pickLong: item.pickLong, + dropLat: item.dropLat, + dropLong: item.dropLong, + lat: item.lat, + long: item.long, + phone: item.phone, + name: item.name, + rider: item.name, + riderPhone: item.phone, + price: item.price, + }, + }); + }} + /> + ) + } + /> + + )} + ); }