Skip to content

Commit

Permalink
fix: Textboxes with masks don't display prefix, suffix, icon
Browse files Browse the repository at this point in the history
  • Loading branch information
lo5 committed Jul 11, 2022
1 parent aa7ffe0 commit 3e148b5
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions web/src/textbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import React from 'react';
import { isN, isS, S } from './core';
import { BoxProps, make } from './ui';


export const Textbox = make(({ context, box }: BoxProps) => {
const
{ text, value, placeholder, icon, mask, prefix, suffix, error, lines, required, password } = box,
Expand All @@ -32,6 +31,9 @@ export const Textbox = make(({ context, box }: BoxProps) => {
label: text,
defaultValue: isS(value) ? value : isN(value) ? String(value) : undefined,
placeholder: placeholder ?? (text ? undefined : 'Enter some text...'),
iconProps: icon ? { iconName: icon } : undefined,
prefix,
suffix,
errorMessage: error,
required: required === true,
onChange,
Expand All @@ -42,7 +44,7 @@ export const Textbox = make(({ context, box }: BoxProps) => {
? <MaskedTextField {...field} mask={mask} />
: lines && (lines >= 1)
? <TextField {...field} multiline resizable autoAdjustHeight rows={lines} />
: <TextField {...field} iconProps={icon ? { iconName: icon } : undefined} prefix={prefix} suffix={suffix} />
: <TextField {...field} />
}

context.record((value as any) ?? '')
Expand Down

0 comments on commit 3e148b5

Please sign in to comment.