import { Motion } from "@legendapp/motion";
import * as Haptics from "expo-haptics";
import { Text, View } from "react-native";
import { isDesktop, isMobile, isNative } from "../hooks/useLayoutType";
import { Fonts, Palette } from "../styles";
import Style, { gutters, mainBorderRadius } from "../styles/Style";
export default ({
type = "primary",
theme = "default", // "default" | "radioactiv"
text,
onPress = () => console.log("null"),
isAbsoluteBottom = false,
alternateAction = {},
contentContainerStyle = {},
containerStyle = {},
textStyle = {},
isMainDesktopPanel = false,
}) => {
const buttonWidth = alternateAction?.text ? "49%" : "100%";
return (
{alternateAction?.text && alternateAction?.onPress ? (
) : null}
);
};
export const BaseButton = ({
type = "primary",
theme = "default",
text,
onPress = () => console.log("null"),
containerStyle = {},
textStyle = {},
hasShadow = false,
}) => {
const primaryColor =
theme === "radioactiv" ? Palette.radioactivGreen : Palette.primary;
const primaryTransparentColor =
theme === "radioactiv"
? Palette.transparentRadioactivGreen
: Palette.transparentPrimary;
const textColor = type === "secondary" ? primaryColor : Palette.darkPurple;
return (
{
if (isNative) {
Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Light);
}
onPress();
}}
style={{
width: "100%",
height: 50,
marginTop: gutters / 2,
...Style.containerRow,
...Style.containerCenter,
backgroundColor: primaryColor,
borderRadius: mainBorderRadius,
...(type === "secondary"
? {
backgroundColor: primaryTransparentColor,
}
: hasShadow
? { ...Style.defaultShadows }
: {}),
...containerStyle,
}}
>
{text}
);
};