Skip to content
This repository was archived by the owner on Sep 26, 2022. It is now read-only.

Commit 4c5fa3c

Browse files
committed
fix(TextField): Fix displaying numeric value
1 parent 02cf91e commit 4c5fa3c

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

packages/svelte-materialify/src/components/TextField/TextField.svelte

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<script>
2+
import { afterUpdate } from 'svelte';
23
import Input from '../Input';
34
import Icon from '../Icon';
45
import uid from '../../internal/uid';
@@ -34,6 +35,12 @@
3435
$: labelActive = !!placeholder || value || focused;
3536
let errorMessages = [];
3637
38+
afterUpdate(() => {
39+
if (typeof value !== 'string') {
40+
value = (value ?? '').toString();
41+
}
42+
});
43+
3744
export function validate() {
3845
errorMessages = rules.map((r) => r(value)).filter((r) => typeof r === 'string');
3946
if (errorMessages.length) error = true;

0 commit comments

Comments
 (0)