diff --git a/components/TransactionForm.tsx b/components/TransactionForm.tsx index 599dedd..37e5fe9 100644 --- a/components/TransactionForm.tsx +++ b/components/TransactionForm.tsx @@ -8,18 +8,13 @@ import { ScrollView, } from 'react-native'; import { COLORS, FONTS } from '../constants/theme'; -import { Transaction } from '../types'; +import { Transaction, CATEGORIES } from '../types'; import { generateId, getCurrentDate } from '../utils/helpers'; interface TransactionFormProps { onAdd: (transaction: Transaction) => void; } -const CATEGORIES = [ - 'makanan', 'transport', 'belanja', 'hiburan', 'kesehatan', - 'pendidikan', 'investasi', 'gaji', 'lainnya' -]; - export const TransactionForm: React.FC = ({ onAdd }) => { const [amount, setAmount] = useState(''); const [description, setDescription] = useState(''); @@ -104,20 +99,20 @@ export const TransactionForm: React.FC = ({ onAdd }) => { {CATEGORIES.map((cat) => ( setCategory(cat)} + onPress={() => setCategory(cat.id)} > - {cat} + {cat.label} ))}