Skip to content

Commit fa734c8

Browse files
committed
refactor: check for negative regardless of decimal places
1 parent 77d1c88 commit fa734c8

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/components/AmountTextInput.js

+8-5
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,11 @@ import { COLORS } from '../styles/themes';
1616
*
1717
* @param {Object} props
1818
* @param {string} [props.value] - Initial input value
19-
* @param {Function} props.onAmountUpdate - Callback when amount changes: (text, bigIntValue) => void
20-
* where text is the formatted string and bigIntValue is the parsed BigInt
21-
* @param {boolean} [props.allowOnlyInteger=false] - If true, only allow integer values (no decimals)
19+
* @param {Function} props.onAmountUpdate - Callback when amount changes:
20+
* (text, bigIntValue) => void where text is the
21+
* formatted string and bigIntValue is the parsed BigInt
22+
* @param {boolean} [props.allowOnlyInteger=false] - If true, only allow integer values
23+
* (no decimals)
2224
* @param {Object} [props.style] - Additional styles for the TextInput
2325
* @param {boolean} [props.autoFocus] - Whether the input should be focused on mount
2426
* @param {number} [props.decimalPlaces] - Number of decimal places to use (optional)
@@ -28,8 +30,9 @@ import { COLORS } from '../styles/themes';
2830
const AmountTextInput = forwardRef((props, ref) => {
2931
const inputRef = useRef(null);
3032
const [text, setText] = useState(props.value || '');
31-
const decimalPlaces = props.decimalPlaces == null ?
32-
constants.DECIMAL_PLACES : props.decimalPlaces;
33+
const decimalPlaces = props.decimalPlaces == null
34+
? constants.DECIMAL_PLACES
35+
: props.decimalPlaces;
3336

3437
// Expose the focus method to parent components
3538
useImperativeHandle(ref, () => ({

0 commit comments

Comments
 (0)