You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Mobile/components/BackButton.tsx

29 lines
722 B

import { AntDesign } from "@expo/vector-icons";
import { router } from "expo-router";
import React from "react";
import { AntDesignIconNames } from "./Icons";
import Button, { ButtonProps } from "./ui/Button";
interface Props extends ButtonProps {
icon?: AntDesignIconNames;
}
export default React.forwardRef<any, Props>(
({ icon, onPress, className, ...props }, ref): React.ReactElement => {
const defaultOnPress = () => {
router.back();
};
return (
<Button
className={"h-16 w-16 mb-4" + " " + className}
onPress={onPress ?? defaultOnPress}
{...ref}
{...props}
>
<AntDesign name={icon ?? "arrowleft"} size={24} />
</Button>
);
}
);