import React from 'react'; import { View, Text, TouchableOpacity } from 'react-native'; import { useAppTheme } from '@theme'; import { getStyles } from './numericKeypad.styles'; interface NumericKeypadProps { onPress: (digit: string) => void; onBackspace: () => void; disabled?: boolean; } export const NumericKeypad: React.FC = ({ onPress, onBackspace, disabled = false, }) => { const { colors } = useAppTheme(); const styles = getStyles(colors); const keys = [ ['1', '2', '3'], ['4', '5', '6'], ['7', '8', '9'], ['', '0', '⌫'], ]; const handlePress = (val: string) => { if (disabled) return; if (val === '⌫') { onBackspace(); } else if (val !== '') { onPress(val); } }; return ( {keys.map((row, rIndex) => ( {row.map((val, cIndex) => { if (val === '') { return ; } return ( handlePress(val)} disabled={disabled} > {val} ); })} ))} ); }; export default NumericKeypad;