diff --git a/packages/tsukota/App.tsx b/packages/tsukota/App.tsx index 74b74ef..9d06839 100644 --- a/packages/tsukota/App.tsx +++ b/packages/tsukota/App.tsx @@ -20,6 +20,7 @@ import { Text, } from "react-native-paper"; import { AccountIndex } from "./app/index"; +import { AccountEdit } from "./app/accounts/[id]/edit"; import { AccountNew } from "./app/accounts/new"; import { AccountShow } from "./app/accounts/[id]"; import { CategoryEdit } from "./app/accounts/[id]/categories/[categoryId]/edit"; @@ -41,7 +42,14 @@ function Home(): JSX.Element { const navigation = useNavigation>(); const { t } = useTranslation(); return ( - + + (); + const { accountId, name } = route.params; + const nameDefault = decodeURIComponent(name); const { account, handleAccountCommand } = useAccount(accountId, []); - const router = useRouter(); const { control, - formState: { isSubmitSuccessful, isSubmitting }, + formState: { isSubmitting }, handleSubmit, } = useForm
({ defaultValues: { @@ -35,6 +35,22 @@ export default function CategoryEdit(): JSX.Element { }); const { t } = useTranslation(); + useEffect(() => { + navigation.setOptions({ + headerRight: () => + isSubmitting ? ( + + ) : ( + + ), + }); + }, [isSubmitting, navigation]); + if (account === null) return ; @@ -43,27 +59,11 @@ export default function CategoryEdit(): JSX.Element { oldAccount === null ? err("account not found") : updateAccount(oldAccount, name) - ).match(() => router.back(), showErrorMessage); + ).match(() => navigation.goBack(), showErrorMessage); }; return ( - - isSubmitting ? ( - - ) : ( - - ), - }} - > +