import React from "react";
import { View, Pressable, useColorScheme, useWindowDimensions } from "react-native";
import { Text } from "@/components/ui/text";
import { ChevronLeft } from "@/lib/icons";
interface KeypadProps {
onPress: (value: string) => void;
onDelete: () => void;
disabled?: boolean;
}
const GAP = 10;
const H_PADDING = 16;
export function Keypad({ onPress, onDelete, disabled }: KeypadProps) {
const { width: screenWidth } = useWindowDimensions();
const isDark = useColorScheme() === "dark";
const keyBg = isDark ? "rgba(255,255,255,0.12)" : "#F4F0EE";
const iconColor = isDark ? "#f1f5f9" : "#251615";
const keyW = (screenWidth - H_PADDING * 2 - GAP * 2) / 3;
const renderNumKey = (label: string) => (
onPress(label)}
disabled={disabled}
className="items-center justify-center active:opacity-60"
style={{ width: keyW, height: 55, borderRadius: 10, backgroundColor: keyBg }}
>
{label}
);
return (
{renderNumKey("1")}
{renderNumKey("2")}
{renderNumKey("3")}
{renderNumKey("4")}
{renderNumKey("5")}
{renderNumKey("6")}
{renderNumKey("7")}
{renderNumKey("8")}
{renderNumKey("9")}
onPress("0")}
disabled={disabled}
className="items-center justify-center active:opacity-60"
style={{ width: keyW, height: 55, borderRadius: 10, backgroundColor: keyBg }}
>
0
);
}