From 12789d2fbc42fe4239a19eae86f27097f62a69fd Mon Sep 17 00:00:00 2001 From: Ulric Date: Tue, 30 Jan 2024 16:41:25 +0100 Subject: [PATCH] :bug: SORD - rewrite props --- src/components/modifyQuantity/ModifyQuantity.tsx | 16 +++++++++------- src/components/numberSelector/NumberSelector.tsx | 5 +---- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src/components/modifyQuantity/ModifyQuantity.tsx b/src/components/modifyQuantity/ModifyQuantity.tsx index dd2b250b..85edc7ce 100644 --- a/src/components/modifyQuantity/ModifyQuantity.tsx +++ b/src/components/modifyQuantity/ModifyQuantity.tsx @@ -63,6 +63,13 @@ export const ModifyQuantity = ({ justifyContent: 'center', }, }); + + const onEndEditing = (value: string | undefined) => { + if (value) { + onValueChange(Number(value)); + } + }; + return ( @@ -76,15 +83,10 @@ export const ModifyQuantity = ({ {text} ); diff --git a/src/components/numberSelector/NumberSelector.tsx b/src/components/numberSelector/NumberSelector.tsx index f068703c..e1d633c8 100644 --- a/src/components/numberSelector/NumberSelector.tsx +++ b/src/components/numberSelector/NumberSelector.tsx @@ -9,17 +9,13 @@ export interface Props { validator: NumberValidator; initialValue: number | undefined; value: number | undefined; - onValueChange?: (value: number) => void; onEndEditing: (value: string | undefined) => void; - minValue: number; - maxValue: number; style?: ViewStyle; minusIcon?: IconName; plusIcon?: IconName; showSoftInputOnFocus?: boolean; variant?: 'filled' | 'outlined'; size?: 'm' | 's'; - decimal?: boolean; placeholder?: string; incrementStep?: number; decrementStep?: number; @@ -28,6 +24,7 @@ export interface Props { export const RoundValue = (val: number): number => { return Math.round(val * 10) / 10; }; + export const ComputeCrementedValue = ( value: number, step: number,