diff --git a/apps/mobile/app/(app)/new-record.tsx b/apps/mobile/app/(app)/new-record.tsx
index 415ec63a..e2d19a51 100644
--- a/apps/mobile/app/(app)/new-record.tsx
+++ b/apps/mobile/app/(app)/new-record.tsx
@@ -1,18 +1,30 @@
import { TransactionForm } from '@/components/transaction/transaction-form'
import { useWallets } from '@/queries/wallet'
import { useRouter } from 'expo-router'
+import { LoaderIcon } from 'lucide-react-native'
+import { View } from 'react-native'
export default function NewRecordScreen() {
const router = useRouter()
const { data: walletAccounts } = useWallets()
+ const defaultWallet = walletAccounts?.[0]
+
+ if (!defaultWallet) {
+ return (
+
+
+
+ )
+ }
+
return (
console.log('submit', values)}
onCancel={router.back}
defaultValues={{
- walletAccountId: walletAccounts?.[0].id,
- currency: walletAccounts?.[0].preferredCurrency,
+ walletAccountId: defaultWallet.id,
+ currency: defaultWallet.preferredCurrency ?? 'USD',
}}
/>
)
diff --git a/apps/mobile/components/transaction/select-account-field.tsx b/apps/mobile/components/transaction/select-account-field.tsx
new file mode 100644
index 00000000..1e62ea96
--- /dev/null
+++ b/apps/mobile/components/transaction/select-account-field.tsx
@@ -0,0 +1,121 @@
+import { sleep } from '@/lib/utils'
+import { useWallets } from '@/queries/wallet'
+import type { UserWalletAccount } from '@6pm/validation'
+import {
+ BottomSheetBackdrop,
+ BottomSheetFlatList,
+ BottomSheetModal,
+} from '@gorhom/bottom-sheet'
+import { t } from '@lingui/macro'
+import { useLingui } from '@lingui/react'
+import { useRef } from 'react'
+import { useController } from 'react-hook-form'
+import { Keyboard } from 'react-native'
+import { useSafeAreaInsets } from 'react-native-safe-area-context'
+import { FullWindowOverlay } from 'react-native-screens'
+import GenericIcon from '../common/generic-icon'
+import { Button } from '../ui/button'
+import { Text } from '../ui/text'
+
+export function SelectAccountField({
+ onSelect,
+}: {
+ onSelect?: (walletAccount: UserWalletAccount) => void
+}) {
+ const { bottom } = useSafeAreaInsets()
+ const { data: walletAccounts, isLoading } = useWallets()
+
+ const sheetRef = useRef(null)
+ const { i18n } = useLingui()
+ const {
+ field: { onChange, onBlur, value },
+ } = useController({ name: 'walletAccountId' })
+
+ const selectedWalletAccount = walletAccounts?.find(
+ (walletAccount) => walletAccount.id === value,
+ )
+
+ return (
+ <>
+
+ (
+
+ )}
+ containerComponent={(props) => (
+ {props.children}
+ )}
+ >
+ i.id}
+ contentContainerClassName="px-4 gap-4"
+ columnWrapperClassName="gap-2"
+ showsVerticalScrollIndicator={false}
+ showsHorizontalScrollIndicator={false}
+ keyboardShouldPersistTaps="handled"
+ keyboardDismissMode="on-drag"
+ ListHeaderComponent={
+
+ {t(i18n)`Wallet Accounts`}
+
+ }
+ contentContainerStyle={{ paddingBottom: bottom + 16 }}
+ renderItem={({ item }) => (
+
+ )}
+ />
+
+ >
+ )
+}
diff --git a/apps/mobile/components/transaction/transaction-form.tsx b/apps/mobile/components/transaction/transaction-form.tsx
index 089866cd..1f4fa16b 100644
--- a/apps/mobile/components/transaction/transaction-form.tsx
+++ b/apps/mobile/components/transaction/transaction-form.tsx
@@ -5,13 +5,7 @@ import {
import { zodResolver } from '@hookform/resolvers/zod'
import { t } from '@lingui/macro'
import { useLingui } from '@lingui/react'
-import {
- Calendar,
- CreditCard,
- LandPlot,
- ShapesIcon,
- XIcon,
-} from 'lucide-react-native'
+import { Calendar, LandPlot, ShapesIcon, XIcon } from 'lucide-react-native'
import { Controller, FormProvider, useForm } from 'react-hook-form'
import { ScrollView, View } from 'react-native'
import Animated, {
@@ -24,6 +18,7 @@ import { NumericPad } from '../numeric-pad'
import { TextTicker } from '../text-ticker'
import { Button } from '../ui/button'
import { Text } from '../ui/text'
+import { SelectAccountField } from './select-account-field'
type TransactionFormProps = {
onSubmit: (data: TransactionFormValues) => void
@@ -50,7 +45,7 @@ export const TransactionForm = ({
defaultValues: {
date: new Date(),
amount: 0,
- currency: 'VND',
+ currency: 'USD',
note: '',
...defaultValues,
},
@@ -102,13 +97,14 @@ export const TransactionForm = ({
-
+ {
+ transactionForm.setValue(
+ 'currency',
+ walletAccount.preferredCurrency,
+ )
+ }}
+ />