// NumericStepper.tsx import React, { useMemo } from "react"; import { View, Text, TouchableOpacity, StyleSheet, StyleProp, ViewStyle, TextStyle, } from "react-native"; import { ThemeType, useTheme } from "../../theme"; export interface NumericStepperProps { value: number; minValue?: number; maxValue?: number; step?: number; onIncrement: () => void; onDecrement: () => void; isRTL?: boolean; style?: StyleProp; buttonStyle?: StyleProp; buttonTextStyle?: StyleProp; valueTextStyle?: StyleProp; disabledOpacity?: number; } const NumericStepper: React.FC = ({ value, minValue = 0, maxValue = Number.MAX_SAFE_INTEGER, onIncrement, onDecrement, isRTL: isRTLProp, style, buttonStyle, buttonTextStyle, valueTextStyle, disabledOpacity = 0.5, }) => { const { theme, isRTL: themeRTL } = useTheme(); const isRTL = isRTLProp ?? themeRTL; const styles = useMemo(() => themedStyles(theme, isRTL), [theme, isRTL]); const isDecrementDisabled = value <= minValue; const isIncrementDisabled = value >= maxValue; return ( - {value} + ); }; const themedStyles = (theme: ThemeType, isRTL: boolean) => StyleSheet.create({ container: { flexDirection: isRTL ? "row-reverse" : "row", alignItems: "center", }, button: { backgroundColor: theme.secondary, width: 36, height: 36, borderRadius: 18, justifyContent: "center", alignItems: "center", }, buttonText: { // fontSize: 20, fontWeight: "bold", color: theme.onSecondary }, valueText: { fontSize: 16, minWidth: 50, textAlign: "center", marginHorizontal: 8, color: theme.onSurface }, }); export default NumericStepper;