import React from 'react';
import { TouchableOpacity, Platform } from 'react-native';
import { VStack, Box } from '../../primitives';
import { useThemeProps } from '../../../hooks';
import type { INumberInputSteppersProps, INumberInputContext } from './types';
import { NumberInputContext } from './Context';
import { ChevronUpIcon, ChevronDownIcon } from '../../primitives/Icon/Icons';
export const NBStepper = React.forwardRef(
({ children, ...props }: any, ref?: any) => {
const {
style,
isIncrement,
disablitityCheck,
_active,
_disabled,
isDisabled,
accessibilityLabel,
pressHandler,
iconColor,
...newProps
} = useThemeProps('NumberInputStepper', props);
return (
{children || isIncrement ? (
) : (
)}
);
}
);
const NumberInputStepper = (
{ children, ...props }: INumberInputSteppersProps,
ref?: any
) => {
const {
numberInputStepper,
setNumberInputStepper,
}: INumberInputContext = React.useContext(NumberInputContext);
React.useEffect(() => {
!numberInputStepper &&
setNumberInputStepper(
{children}
);
}, [numberInputStepper, setNumberInputStepper, props, children, ref]);
return null;
};
export default React.memo(React.forwardRef(NumberInputStepper));