Skip to content

Commit 016416a

Browse files
committed
Fix #105: use step=1 for ineger field
1 parent 849e736 commit 016416a

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/ui.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,14 @@ function FormField(props) {
4747
if (props.schema.handler)
4848
inputProps.handler = props.schema.handler;
4949

50+
let schemaType = normalizeKeyword(props.schema.type);
5051
let type;
5152

5253
if (props.schema.hasOwnProperty('const')) {
5354
type = actualType(props.schema.const);
5455
inputProps.readOnly = true;
5556
} else {
56-
type = normalizeKeyword(props.schema.type);
57+
type = schemaType;
5758
}
5859

5960
let choices = getKeyword(props.schema, 'choices', 'enum');
@@ -113,14 +114,16 @@ function FormField(props) {
113114
break;
114115
case 'range':
115116
case 'integer':
116-
inputProps.step = '1';
117-
// fall through
118117
case 'number':
119118
if (type === 'range')
120119
inputProps.type = 'range';
121120
else
122121
inputProps.type = 'number';
123-
inputProps.step = 'any'
122+
123+
if (schemaType === 'integer')
124+
inputProps.step = '1';
125+
else
126+
inputProps.step = 'any';
124127

125128
InputField = FormInput;
126129

0 commit comments

Comments
 (0)