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

30 lines
734 B

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