From cb761fecfa0887b48923838543d840f596bf434d Mon Sep 17 00:00:00 2001 From: Mohamad Date: Sat, 28 Dec 2024 17:26:18 -0800 Subject: [PATCH 1/9] fix spacing --- src/components/PaymentCard.tsx | 10 +++++----- src/pages/card.tsx | 9 +++++---- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/components/PaymentCard.tsx b/src/components/PaymentCard.tsx index 10227df..3311155 100644 --- a/src/components/PaymentCard.tsx +++ b/src/components/PaymentCard.tsx @@ -13,6 +13,7 @@ import { import { SvgUri, SvgXml } from "react-native-svg"; import Card from "../lib/types/Card"; +import GrantCard from "../lib/types/GrantCard"; import { CardDetails } from "../lib/useStripeCardDetails"; import { palette } from "../theme"; import { redactedCardNumber, renderCardNumber } from "../util"; @@ -20,7 +21,6 @@ import { redactedCardNumber, renderCardNumber } from "../util"; import CardChip from "./cards/CardChip"; import CardFrozen from "./cards/CardFrozen"; import CardHCB from "./cards/CardHCB"; -import GrantCard from "../lib/types/GrantCard"; // const transition = SharedTransition.custom((values) => { // "worklet"; @@ -168,7 +168,7 @@ export default function PaymentCard({ {card.user ? card.user.name : card.organization.name} - + setCardLoaded(true)} style={{ marginBottom: 20 }} /> @@ -125,7 +126,7 @@ export default function CardPage({ gap: 20, }} > - {(!card.status == "expired" || !(card as GrantCard).amount_cents) && ( + {(!card.status == "expired" || !isGrantCard) && ( - {/* - - Transactions - - */} + {isLoading && } )} diff --git a/src/pages/organization/transfer.tsx b/src/pages/organization/transfer.tsx new file mode 100644 index 0000000..06f0867 --- /dev/null +++ b/src/pages/organization/transfer.tsx @@ -0,0 +1,67 @@ +import { NativeStackScreenProps } from "@react-navigation/native-stack"; +import { useEffect, useState } from "react"; +import { Button as NativeButton, View } from "react-native"; + +import Button from "../../components/Button"; +import { StackParamList } from "../../lib/NavigatorParamList"; +import { palette } from "../../theme"; + +type Props = NativeStackScreenProps; + +export default function TransferPage({ navigation }: Props) { + useEffect(() => { + navigation.setOptions({ + headerLeft: () => ( + navigation.goBack()} + /> + ), + }); + }, []); + + const [transferType, setTransferType] = useState<"ach" | "check" | "account">( + "ach", + ); + + return ( + + + + + + + + ); +} \ No newline at end of file From 7cf0b81d0025ff5247bbd73e1b047b1c41fda89f Mon Sep 17 00:00:00 2001 From: thedev132 Date: Tue, 31 Dec 2024 12:45:26 -0800 Subject: [PATCH 3/9] transfer ui --- package-lock.json | 13 ++ package.json | 1 + src/Navigator.tsx | 1 + .../organizations/transfer/HCBTransfer.tsx | 183 ++++++++++++++++++ src/pages/index.tsx | 4 + src/pages/organization/index.tsx | 29 ++- src/pages/organization/transfer.tsx | 107 +++++----- 7 files changed, 285 insertions(+), 53 deletions(-) create mode 100644 src/components/organizations/transfer/HCBTransfer.tsx diff --git a/package-lock.json b/package-lock.json index e17273b..659ae9c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,6 +14,7 @@ "@expo/vector-icons": "^14.0.0", "@react-native-async-storage/async-storage": "1.23.1", "@react-native-menu/menu": "^1.1.6", + "@react-native-picker/picker": "^2.10.2", "@react-navigation/bottom-tabs": "^6.5.8", "@react-navigation/native": "^6.1.10", "@react-navigation/native-stack": "^6.9.13", @@ -5431,6 +5432,18 @@ "react-native": "*" } }, + "node_modules/@react-native-picker/picker": { + "version": "2.10.2", + "resolved": "https://registry.npmjs.org/@react-native-picker/picker/-/picker-2.10.2.tgz", + "integrity": "sha512-kr3OvCRwTYjR/OKlb52k4xmQVU7dPRIALqpyiihexdJxEgvc1smnepgqCeM9oXmNSG4YaV5/RSxFlLC5Z/T/Eg==", + "workspaces": [ + "example" + ], + "peerDependencies": { + "react": "*", + "react-native": "*" + } + }, "node_modules/@react-native/assets-registry": { "version": "0.75.4", "resolved": "https://registry.npmjs.org/@react-native/assets-registry/-/assets-registry-0.75.4.tgz", diff --git a/package.json b/package.json index fee9695..88a8f50 100644 --- a/package.json +++ b/package.json @@ -19,6 +19,7 @@ "@expo/vector-icons": "^14.0.0", "@react-native-async-storage/async-storage": "1.23.1", "@react-native-menu/menu": "^1.1.6", + "@react-native-picker/picker": "^2.10.2", "@react-navigation/bottom-tabs": "^6.5.8", "@react-navigation/native": "^6.1.10", "@react-navigation/native-stack": "^6.9.13", diff --git a/src/Navigator.tsx b/src/Navigator.tsx index d7be3f3..58d4950 100644 --- a/src/Navigator.tsx +++ b/src/Navigator.tsx @@ -70,6 +70,7 @@ export default function Navigator() { // headerStyle: { backgroundColor: themeColors.background }, headerShown: false, tabBarStyle: { position: "absolute" }, + tabBarHideOnKeyboard: true, tabBarBackground: () => ( { + const [amount, setAmount] = useState('$0.00'); + const [chosenOrg, setOrganization] = useState(''); + const { colors: themeColors } = useTheme(); + const { data: organizations } = useSWR('user/organizations'); + const { token } = useContext(AuthContext); + + console.log(token) + const handleTransfer = async () => { + console.log(chosenOrg) + console.log(organization.id) + const response = await fetch(`https://hcb.hackclub.com/api/v4/organizations/org_dku3wo/transfers`, { + method: 'POST', + headers: { + 'Authorization': `Bearer hcb_T8OBkVIsd0MzaGxPgfebcwP0X6c5h_Xm4PC13uTaToo`, + 'Content-Type': 'application/json', + }, + body: JSON.stringify({ + event_id: "org_dku3wo", + to_organization_id: "org_9rud56", + // amount in cents , + amount_cents: 500, + //Number(amount.replace('$', '')) * 100, + name: "org_dku3wo" + }), + }) + console.log(response.status) + console.log(await response.text()); + }; + + useEffect(() => { + if (chosenOrg === '') { + setAmount('$0.00'); + } + }, [chosenOrg]); + + if (!organizations) { + return + + ; + } + + return ( + + {/* From Section */} + + From + + + + {organization.name} ({renderMoney(organization.balance_cents)}) + + + + {/* To Section */} + + To + + + setOrganization(itemValue)} + style={{ color: themeColors.text }} + dropdownIconColor={themeColors.text} + > + + {organizations.map((org) => ( + + ))} + + + + You can transfer to any organization you're a part of. + + + {/* Amount Section */} + + Amount + + { + if (text === '') { + setAmount('$0.00'); + } else { + setAmount(`$${text.replace('$', '')}`); + } + }} + placeholder="$0.00" + placeholderTextColor={themeColors.text} + keyboardType="numeric" + /> + + {/* Purpose Section */} + + What is the transfer for? + + setOrganization({ ...organization, name: text })} // or another suitable update + placeholder="Donating extra funds to another organization" + placeholderTextColor={palette.muted} + /> + + This is to help HCB keep record of our transactions. + + + {/* Transfer Button */} + + + Make Transfer + + + + ); +}; + +export default HCBTransferScreen; diff --git a/src/pages/index.tsx b/src/pages/index.tsx index d847e72..a838099 100644 --- a/src/pages/index.tsx +++ b/src/pages/index.tsx @@ -228,6 +228,10 @@ export default function App({ navigation }: Props) { preload("user", fetcher!); // eslint-disable-next-line @typescript-eslint/no-non-null-assertion preload("user/cards", fetcher!); + // prefetch all user organization details + for (const org of organizations || []) { + preload(`organizations/${org.id}`, fetcher!); + } }, []); if (error) { diff --git a/src/pages/organization/index.tsx b/src/pages/organization/index.tsx index 0019683..26bc3ae 100644 --- a/src/pages/organization/index.tsx +++ b/src/pages/organization/index.tsx @@ -71,6 +71,9 @@ export default function OrganizationPage({ const { data: organization, isLoading: organizationLoading } = useSWR< Organization | OrganizationExpanded >(`organizations/${orgId}`, { fallbackData: _organization }); + + const { data: user, isLoading: userLoading } = useSWR("user"); + console.log(organization) const { transactions: _transactions, isLoadingMore, @@ -79,7 +82,12 @@ export default function OrganizationPage({ } = useTransactions(orgId); useEffect(() => { - if (organization) { + if (organization && user) { + const isManager = "users" in organization && + organization.users.some( + (u) => u.id === user?.id && u.role === "manager", + ); + navigation.setOptions({ title: organization.name, // headerTitle: () => , @@ -97,12 +105,21 @@ export default function OrganizationPage({ }); } + if (isManager) { + menuActions.push({ + id: "transfer", + title: "Transfer Money", + image: "dollarsign.circle", + }); + } + menuActions.push({ id: "settings", title: "Manage Organization", - image: "gearshape", + image: "gearshape", }); + navigation.setOptions({ headerRight: () => ( @@ -154,7 +173,7 @@ export default function OrganizationPage({ [transactions], ); - if (organizationLoading) { + if (organizationLoading || userLoading) { return ; } @@ -207,7 +226,7 @@ export default function OrganizationPage({ renderMoney(organization.balance_cents)} - + */} {isLoading && } diff --git a/src/pages/organization/transfer.tsx b/src/pages/organization/transfer.tsx index 06f0867..cd3f3c8 100644 --- a/src/pages/organization/transfer.tsx +++ b/src/pages/organization/transfer.tsx @@ -1,67 +1,78 @@ import { NativeStackScreenProps } from "@react-navigation/native-stack"; +import Constants from "expo-constants"; import { useEffect, useState } from "react"; -import { Button as NativeButton, View } from "react-native"; +import { KeyboardAvoidingView, Button as NativeButton, View, ScrollView, Platform } from "react-native"; import Button from "../../components/Button"; +import HCBTransferScreen from "../../components/organizations/transfer/HCBTransfer"; import { StackParamList } from "../../lib/NavigatorParamList"; +import { OrganizationExpanded } from "../../lib/types/Organization"; import { palette } from "../../theme"; type Props = NativeStackScreenProps; -export default function TransferPage({ navigation }: Props) { +export default function TransferPage({ navigation, route }: Props) { + const { organization } = route.params as { organization: OrganizationExpanded }; // Grab the organization value from the route params + useEffect(() => { navigation.setOptions({ headerLeft: () => ( - navigation.goBack()} - /> + + navigation.goBack()} + /> + ), }); }, []); - const [transferType, setTransferType] = useState<"ach" | "check" | "account">( - "ach", - ); + const [transferType, setTransferType] = useState<"ach" | "check" | "hcb">("hcb"); return ( - - - - - - - + + + {/* Transfer Type Buttons */} + + + + + + + {/* Display transfer screen based on transfer type */} + {transferType === "hcb" && } + + ); -} \ No newline at end of file +} From 70669d930bb5259c917c635392cbf86a36fad7ba Mon Sep 17 00:00:00 2001 From: thedev132 Date: Wed, 1 Jan 2025 00:10:35 -0800 Subject: [PATCH 4/9] small change --- .../organizations/transfer/HCBTransfer.tsx | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/components/organizations/transfer/HCBTransfer.tsx b/src/components/organizations/transfer/HCBTransfer.tsx index 5cf1d69..3e02123 100644 --- a/src/components/organizations/transfer/HCBTransfer.tsx +++ b/src/components/organizations/transfer/HCBTransfer.tsx @@ -20,23 +20,19 @@ const HCBTransferScreen = ({ organization }: HCBTransferScreenProps) => { const { data: organizations } = useSWR('user/organizations'); const { token } = useContext(AuthContext); - console.log(token) const handleTransfer = async () => { - console.log(chosenOrg) - console.log(organization.id) - const response = await fetch(`https://hcb.hackclub.com/api/v4/organizations/org_dku3wo/transfers`, { + const response = await fetch (process.env.EXPO_PUBLIC_API_BASE + `/organizations/${organization.id}/transfers`, { method: 'POST', headers: { - 'Authorization': `Bearer hcb_T8OBkVIsd0MzaGxPgfebcwP0X6c5h_Xm4PC13uTaToo`, + 'Authorization': `Bearer ${token}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ - event_id: "org_dku3wo", - to_organization_id: "org_9rud56", + event_id: organization.id, + to_organization_id: chosenOrg, // amount in cents , - amount_cents: 500, - //Number(amount.replace('$', '')) * 100, - name: "org_dku3wo" + amount_cents: Number(amount.replace('$', '')) * 100, + name: organization.name, }), }) console.log(response.status) From 9eb6809ed176c322bd860a95831be3fdcc4be172 Mon Sep 17 00:00:00 2001 From: thedev132 Date: Wed, 1 Jan 2025 13:33:37 -0800 Subject: [PATCH 5/9] Finished HCB Transfer! --- package.json | 1 - .../organizations/transfer/HCBTransfer.tsx | 142 ++++++++++-------- src/pages/organization/index.tsx | 4 +- src/pages/organization/transfer.tsx | 4 +- 4 files changed, 81 insertions(+), 70 deletions(-) diff --git a/package.json b/package.json index 889eac4..cef3f56 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,6 @@ "expo-linear-gradient": "~13.0.2", "expo-linking": "~6.3.1", "expo-local-authentication": "~14.0.1", - "expo-notifications": "~0.29.11", "expo-secure-store": "~14.0.0", "expo-splash-screen": "~0.27.7", "expo-status-bar": "~1.12.1", diff --git a/src/components/organizations/transfer/HCBTransfer.tsx b/src/components/organizations/transfer/HCBTransfer.tsx index 3e02123..7955cf3 100644 --- a/src/components/organizations/transfer/HCBTransfer.tsx +++ b/src/components/organizations/transfer/HCBTransfer.tsx @@ -1,7 +1,7 @@ import { Picker } from '@react-native-picker/picker'; import { useTheme } from '@react-navigation/native'; import { useContext, useEffect, useState } from 'react'; -import { View, Text, TextInput, TouchableOpacity, ActivityIndicator } from 'react-native'; +import { View, Text, TextInput, TouchableOpacity, ActivityIndicator, Alert } from 'react-native'; import useSWR from 'swr'; import AuthContext from '../../../auth'; @@ -12,31 +12,70 @@ import { renderMoney } from '../../../util'; type HCBTransferScreenProps = { organization: OrganizationExpanded; }; - + const HCBTransferScreen = ({ organization }: HCBTransferScreenProps) => { const [amount, setAmount] = useState('$0.00'); const [chosenOrg, setOrganization] = useState(''); + const [reason, setReason] = useState(''); + const [isLoading, setIsLoading] = useState(false); const { colors: themeColors } = useTheme(); const { data: organizations } = useSWR('user/organizations'); const { token } = useContext(AuthContext); + const validateInputs = () => { + const numericAmount = Number(amount.replace('$', '').replace(',', '')); + if (!chosenOrg) { + Alert.alert('Error', 'Please select an organization to transfer to.'); + return false; + } + if (numericAmount <= 0 || isNaN(numericAmount)) { + Alert.alert('Error', 'Please enter a valid amount greater than $0.'); + return false; + } + if (numericAmount * 100 > organization.balance_cents) { + Alert.alert('Error', 'Insufficient balance for this transfer.'); + return false; + } + if (!reason.trim()) { + Alert.alert('Error', 'Please provide a reason for the transfer.'); + return false; + } + return true; + }; + const handleTransfer = async () => { - const response = await fetch (process.env.EXPO_PUBLIC_API_BASE + `/organizations/${organization.id}/transfers`, { + if (!validateInputs()) return; + + setIsLoading(true); + try { + const response = await fetch(process.env.EXPO_PUBLIC_API_BASE + `/organizations/${organization.id}/transfers`, { method: 'POST', headers: { - 'Authorization': `Bearer ${token}`, - 'Content-Type': 'application/json', + 'Authorization': `Bearer ${token}`, + 'Content-Type': 'application/json', }, body: JSON.stringify({ - event_id: organization.id, - to_organization_id: chosenOrg, - // amount in cents , - amount_cents: Number(amount.replace('$', '')) * 100, - name: organization.name, + event_id: organization.id, + to_organization_id: chosenOrg, + amount_cents: Number(amount.replace('$', '').replace(',', '')) * 100, + name: reason, }), - }) - console.log(response.status) - console.log(await response.text()); + }); + + if (!response.ok) { + const errorData = await response.json(); + Alert.alert('Error', errorData.message || 'Failed to complete the transfer. Please try again.'); + } else { + Alert.alert('Success', 'Transfer completed successfully!'); + setOrganization(''); + setAmount('$0.00'); + setReason(''); + } + } catch (error) { + Alert.alert('Error', 'An unexpected error occurred. Please try again.'); + } finally { + setIsLoading(false); + } }; useEffect(() => { @@ -46,47 +85,26 @@ const HCBTransferScreen = ({ organization }: HCBTransferScreenProps) => { }, [chosenOrg]); if (!organizations) { - return + return ( + - ; + + ); } return ( - + {/* From Section */} - - From - - + From + {organization.name} ({renderMoney(organization.balance_cents)}) {/* To Section */} - - To - - + To + setOrganization(itemValue)} @@ -104,9 +122,7 @@ const HCBTransferScreen = ({ organization }: HCBTransferScreenProps) => { {/* Amount Section */} - - Amount - + Amount { }} value={amount} onChangeText={(text) => { - if (text === '') { - setAmount('$0.00'); - } else { - setAmount(`$${text.replace('$', '')}`); + const sanitizedText = text.replace(/[^\d.]/g, ''); + // remove 0.00 if user enters a new number + if (sanitizedText.startsWith('0.00')) { + setAmount(text.replace('0.00', '')); + return; } + setAmount(sanitizedText ? `$${sanitizedText}` : '$0.00'); }} placeholder="$0.00" placeholderTextColor={themeColors.text} @@ -130,9 +148,7 @@ const HCBTransferScreen = ({ organization }: HCBTransferScreenProps) => { /> {/* Purpose Section */} - - What is the transfer for? - + What is the transfer for? { fontSize: 16, marginBottom: 10, }} - value={organization.name} // or change this to the desired value - onChangeText={(text) => setOrganization({ ...organization, name: text })} // or another suitable update + value={reason} + onChangeText={(text) => setReason(text)} placeholder="Donating extra funds to another organization" placeholderTextColor={palette.muted} /> @@ -159,18 +175,16 @@ const HCBTransferScreen = ({ organization }: HCBTransferScreenProps) => { borderRadius: 8, marginTop: 20, alignItems: 'center', + opacity: isLoading ? 0.7 : 1, }} onPress={handleTransfer} + disabled={isLoading} > - - Make Transfer - + {isLoading ? ( + + ) : ( + Make Transfer + )} ); diff --git a/src/pages/organization/index.tsx b/src/pages/organization/index.tsx index 26bc3ae..9a593b0 100644 --- a/src/pages/organization/index.tsx +++ b/src/pages/organization/index.tsx @@ -16,7 +16,6 @@ import { import useSWR from "swr"; // import OrganizationTitle from "../../components/organizations/OrganizationTitle"; -import Button from "../../components/Button"; import PlaygroundBanner from "../../components/organizations/PlaygroundBanner"; import Transaction from "../../components/Transaction"; import { StackParamList } from "../../lib/NavigatorParamList"; @@ -73,7 +72,6 @@ export default function OrganizationPage({ >(`organizations/${orgId}`, { fallbackData: _organization }); const { data: user, isLoading: userLoading } = useSWR("user"); - console.log(organization) const { transactions: _transactions, isLoadingMore, @@ -150,7 +148,7 @@ export default function OrganizationPage({ ), }); } - }, [organization, scheme, navigation]); + }, [organization, scheme, navigation, user]); const tabBarSize = useBottomTabBarHeight(); const { colors: themeColors } = useTheme(); diff --git a/src/pages/organization/transfer.tsx b/src/pages/organization/transfer.tsx index cd3f3c8..3a54f0e 100644 --- a/src/pages/organization/transfer.tsx +++ b/src/pages/organization/transfer.tsx @@ -37,7 +37,7 @@ export default function TransferPage({ navigation, route }: Props) { > {/* Transfer Type Buttons */} - + {/* - + */} {/* Display transfer screen based on transfer type */} {transferType === "hcb" && } From 076238dc74d6a1d213e7f0155f6da887771e22b5 Mon Sep 17 00:00:00 2001 From: thedev132 Date: Thu, 2 Jan 2025 14:05:30 -0800 Subject: [PATCH 6/9] changes requested --- package.json | 1 + .../transfer/{HCBTransfer.tsx => Disbursement.tsx} | 0 src/pages/organization/index.tsx | 2 +- src/pages/organization/transfer.tsx | 2 +- 4 files changed, 3 insertions(+), 2 deletions(-) rename src/components/organizations/transfer/{HCBTransfer.tsx => Disbursement.tsx} (100%) diff --git a/package.json b/package.json index cef3f56..c34b0a9 100644 --- a/package.json +++ b/package.json @@ -41,6 +41,7 @@ "expo-linear-gradient": "~13.0.2", "expo-linking": "~6.3.1", "expo-local-authentication": "~14.0.1", + "expo-notifications": "^0.28.18", "expo-secure-store": "~14.0.0", "expo-splash-screen": "~0.27.7", "expo-status-bar": "~1.12.1", diff --git a/src/components/organizations/transfer/HCBTransfer.tsx b/src/components/organizations/transfer/Disbursement.tsx similarity index 100% rename from src/components/organizations/transfer/HCBTransfer.tsx rename to src/components/organizations/transfer/Disbursement.tsx diff --git a/src/pages/organization/index.tsx b/src/pages/organization/index.tsx index 9a593b0..d58f811 100644 --- a/src/pages/organization/index.tsx +++ b/src/pages/organization/index.tsx @@ -114,7 +114,7 @@ export default function OrganizationPage({ menuActions.push({ id: "settings", title: "Manage Organization", - image: "gearshape", + image: "gearshape", }); diff --git a/src/pages/organization/transfer.tsx b/src/pages/organization/transfer.tsx index 3a54f0e..6222a5b 100644 --- a/src/pages/organization/transfer.tsx +++ b/src/pages/organization/transfer.tsx @@ -4,7 +4,7 @@ import { useEffect, useState } from "react"; import { KeyboardAvoidingView, Button as NativeButton, View, ScrollView, Platform } from "react-native"; import Button from "../../components/Button"; -import HCBTransferScreen from "../../components/organizations/transfer/HCBTransfer"; +import HCBTransferScreen from "../../components/organizations/transfer/Disbursement"; import { StackParamList } from "../../lib/NavigatorParamList"; import { OrganizationExpanded } from "../../lib/types/Organization"; import { palette } from "../../theme"; From 3c9af7d228bb44cfe04067fdc204fa0aaf68a5ac Mon Sep 17 00:00:00 2001 From: thedev132 Date: Thu, 2 Jan 2025 14:18:11 -0800 Subject: [PATCH 7/9] more changes requested --- src/components/organizations/transfer/Disbursement.tsx | 8 ++++---- src/pages/organization/transfer.tsx | 5 ++--- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/components/organizations/transfer/Disbursement.tsx b/src/components/organizations/transfer/Disbursement.tsx index 7955cf3..e409782 100644 --- a/src/components/organizations/transfer/Disbursement.tsx +++ b/src/components/organizations/transfer/Disbursement.tsx @@ -9,11 +9,11 @@ import { OrganizationExpanded } from '../../../lib/types/Organization'; import { palette } from '../../../theme'; import { renderMoney } from '../../../util'; -type HCBTransferScreenProps = { +type DisbursementScreenProps = { organization: OrganizationExpanded; }; -const HCBTransferScreen = ({ organization }: HCBTransferScreenProps) => { +const DisbursementScreen = ({ organization }: DisbursementScreenProps) => { const [amount, setAmount] = useState('$0.00'); const [chosenOrg, setOrganization] = useState(''); const [reason, setReason] = useState(''); @@ -107,7 +107,7 @@ const HCBTransferScreen = ({ organization }: HCBTransferScreenProps) => { setOrganization(itemValue)} + onValueChange={(itemValue: string) => setOrganization(itemValue)} style={{ color: themeColors.text }} dropdownIconColor={themeColors.text} > @@ -190,4 +190,4 @@ const HCBTransferScreen = ({ organization }: HCBTransferScreenProps) => { ); }; -export default HCBTransferScreen; +export default DisbursementScreen; diff --git a/src/pages/organization/transfer.tsx b/src/pages/organization/transfer.tsx index 6222a5b..f4ceb30 100644 --- a/src/pages/organization/transfer.tsx +++ b/src/pages/organization/transfer.tsx @@ -3,8 +3,7 @@ import Constants from "expo-constants"; import { useEffect, useState } from "react"; import { KeyboardAvoidingView, Button as NativeButton, View, ScrollView, Platform } from "react-native"; -import Button from "../../components/Button"; -import HCBTransferScreen from "../../components/organizations/transfer/Disbursement"; +import DisbursementScreen from "../../components/organizations/transfer/Disbursement"; import { StackParamList } from "../../lib/NavigatorParamList"; import { OrganizationExpanded } from "../../lib/types/Organization"; import { palette } from "../../theme"; @@ -71,7 +70,7 @@ export default function TransferPage({ navigation, route }: Props) { */} {/* Display transfer screen based on transfer type */} - {transferType === "hcb" && } + {transferType === "hcb" && } ); From 0f758b5d7a09c0655108c07ca8f6e02d5dccbbe9 Mon Sep 17 00:00:00 2001 From: thedev132 Date: Thu, 2 Jan 2025 14:31:41 -0800 Subject: [PATCH 8/9] space fix --- src/components/Transaction.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Transaction.tsx b/src/components/Transaction.tsx index 6639521..5af5f14 100644 --- a/src/components/Transaction.tsx +++ b/src/components/Transaction.tsx @@ -198,4 +198,4 @@ function Transaction({ ); } -export default memo(Transaction); +export default memo(Transaction); \ No newline at end of file From 663f747ae8c2cb6f5e9c5127884fd01405592449 Mon Sep 17 00:00:00 2001 From: Mohamad Mortada Date: Thu, 2 Jan 2025 19:38:48 -0800 Subject: [PATCH 9/9] minor ios changes --- package.json | 23 ++++++++++--------- .../organizations/transfer/Disbursement.tsx | 17 ++++++-------- 2 files changed, 19 insertions(+), 21 deletions(-) diff --git a/package.json b/package.json index c34b0a9..65de1a4 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ "@expo/vector-icons": "^14.0.0", "@react-native-async-storage/async-storage": "1.23.1", "@react-native-menu/menu": "^1.1.6", - "@react-native-picker/picker": "^2.10.2", + "@react-native-picker/picker": "2.7.5", "@react-navigation/bottom-tabs": "^6.5.8", "@react-navigation/native": "^6.1.10", "@react-navigation/native-stack": "^6.9.13", @@ -33,32 +33,33 @@ "expo-constants": "~16.0.2", "expo-crypto": "~13.0.2", "expo-dev-client": "~4.0.29", - "expo-device": "~7.0.1", + "expo-device": "~6.0.2", "expo-haptics": "~13.0.1", "expo-image": "~1.13.0", "expo-image-picker": "~15.0.7", - "expo-insights": "~0.8.1", + "expo-insights": "~0.7.0", "expo-linear-gradient": "~13.0.2", "expo-linking": "~6.3.1", "expo-local-authentication": "~14.0.1", "expo-notifications": "^0.28.18", - "expo-secure-store": "~14.0.0", + "expo-secure-store": "~13.0.2", "expo-splash-screen": "~0.27.7", "expo-status-bar": "~1.12.1", "expo-system-ui": "~3.0.7", - "expo-web-browser": "~14.0.1", + "expo-web-browser": "~13.0.3", "geopattern": "github:thedev132/geopattern", "humanize-string": "^3.0.0", "ky": "^1.2.3", "lodash": "^4.17.21", - "react": "18.3.1", - "react-native": "0.75", - "react-native-gesture-handler": "~2.21.2", + "react": "18.2.0", + "react-native": "0.74.5", + "react-native-gesture-handler": "~2.16.1", "react-native-image-viewing": "^0.2.2", - "react-native-pager-view": "6.5.1", - "react-native-reanimated": "~3.16.3", + "react-native-pager-view": "6.3.0", + "react-native-picker-select": "^9.3.1", + "react-native-reanimated": "~3.10.1", "react-native-safe-area-context": "4.10.5", - "react-native-screens": "4.3.0", + "react-native-screens": "3.31.1", "react-native-svg": "15.2.0", "react-native-web": "~0.19.10", "swr": "^2.2.1", diff --git a/src/components/organizations/transfer/Disbursement.tsx b/src/components/organizations/transfer/Disbursement.tsx index e409782..7a7f4ac 100644 --- a/src/components/organizations/transfer/Disbursement.tsx +++ b/src/components/organizations/transfer/Disbursement.tsx @@ -2,6 +2,7 @@ import { Picker } from '@react-native-picker/picker'; import { useTheme } from '@react-navigation/native'; import { useContext, useEffect, useState } from 'react'; import { View, Text, TextInput, TouchableOpacity, ActivityIndicator, Alert } from 'react-native'; +import RNPickerSelect from 'react-native-picker-select'; import useSWR from 'swr'; import AuthContext from '../../../auth'; @@ -105,17 +106,13 @@ const DisbursementScreen = ({ organization }: DisbursementScreenProps) => { {/* To Section */} To - setOrganization(itemValue)} - style={{ color: themeColors.text }} - dropdownIconColor={themeColors.text} - > - - {organizations.map((org) => ( - - ))} - + style={{ inputIOS: { color: themeColors.text, padding: 15, fontSize: 16 }, inputAndroid: { color: themeColors.text, padding: 15, fontSize: 16 } }} + items={[ + ...organizations.map((org) => ({ label: org.name, value: org.id })), + ]} + /> You can transfer to any organization you're a part of.