Skip to content

Commit 87e2176

Browse files
committed
Fix Tests
1 parent 97f242e commit 87e2176

3 files changed

Lines changed: 255 additions & 265 deletions

File tree

components/native/NativeNumberOnlyInput.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,23 +28,23 @@ export default function NativeNumberOnlyInput(
2828
maxValue?: number;
2929
},
3030
) {
31-
const textColor = props.textColor ?? colors.primary;
32-
3331
const {
3432
onChange,
35-
textColor: _,
33+
textColor: propTextColor,
3634
value,
3735
minValue,
3836
maxValue,
3937
...restProps
4038
} = props;
4139

42-
function onTextChanged(value: string) {
43-
if (!props.onChange) return;
44-
const numValue = parseInt(value.replace(/[^0-9]/g, ''));
40+
const textColor = propTextColor ?? colors.primary;
41+
42+
function onTextChanged(strValue: string) {
43+
if (!onChange) return;
44+
const numValue = parseInt(strValue.replace(/[^0-9]/g, ''));
4545
if (minValue !== undefined && numValue <= minValue) return;
4646
if (maxValue !== undefined && numValue >= maxValue) return;
47-
props.onChange(numValue);
47+
onChange(numValue);
4848
}
4949

5050
return (
@@ -69,7 +69,7 @@ export default function NativeNumberOnlyInput(
6969
}}
7070
keyboardType="numeric"
7171
onChangeText={(value) => onTextChanged(value)}
72-
value={props.value.toString()}
72+
value={value.toString()}
7373
{...restProps}
7474
/>
7575
<TouchableHighlight

0 commit comments

Comments
 (0)