Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
fix: correct input.value type for useField and Field (#947)
- Loading branch information
1 parent
4217772
commit 45cc144
Showing
3 changed files
with
26 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,18 +1,18 @@ | ||
| /* eslint-disable @typescript-eslint/no-unused-vars */ | ||
| import * as React from 'react'; | ||
| import { useField } from 'react-final-form'; | ||
| import * as React from "react"; | ||
| import { useField } from "react-final-form"; | ||
|
|
||
| const NumberInput: React.FC<{ value?: number }> = () => null; | ||
|
|
||
| function NumberFieldValue() { | ||
| const { input } = useField<number>('numberField'); | ||
| const { input } = useField<number>("numberField"); | ||
| return <NumberInput value={input.value} />; | ||
| } | ||
|
|
||
| function NumberInputValue() { | ||
| const { input } = useField('numberField', { | ||
| const { input } = useField("numberField", { | ||
| format: (value: string) => Number(value), | ||
| parse: (value: number) => String(value) | ||
| parse: (value: number) => String(value), | ||
| }); | ||
| return <NumberInput value={input.value} />; | ||
| } |

