-
Notifications
You must be signed in to change notification settings - Fork 734
TextField - new features: helperText and validationIcon #3097
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
3fdb304
2e17924
d2834d0
5fae584
7687107
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,6 +61,8 @@ const TextField = (props: InternalTextFieldProps) => { | |
floatOnFocus, | ||
placeholderTextColor, | ||
hint, | ||
helperText, | ||
validationIcon, | ||
// Label | ||
label, | ||
labelColor, | ||
|
@@ -74,7 +76,7 @@ const TextField = (props: InternalTextFieldProps) => { | |
enableErrors, // TODO: rename to enableValidation | ||
validationMessageStyle, | ||
validationMessagePosition = ValidationMessagePosition.BOTTOM, | ||
retainValidationSpace = true, | ||
retainValidationSpace = !helperText, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just to make sure I understand There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes. Otherwise there will be a gap btw the input and the helperText |
||
// Char Counter | ||
showCharCounter, | ||
charCounterStyle, | ||
|
@@ -107,6 +109,8 @@ const TextField = (props: InternalTextFieldProps) => { | |
} | ||
}, [leadingAccessory]); | ||
|
||
const _helperText = <Text $textNeutralHeavy subtext>{helperText}</Text>; | ||
ethanshar marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
const {margins, paddings, typography, positionStyle, color} = modifiers; | ||
const typographyStyle = useMemo(() => omit(typography, 'lineHeight'), [typography]); | ||
const colorStyle = useMemo(() => color && {color}, [color]); | ||
|
@@ -206,6 +210,7 @@ const TextField = (props: InternalTextFieldProps) => { | |
enableErrors={enableErrors} | ||
validate={others.validate} | ||
validationMessage={others.validationMessage} | ||
validationIcon={validationIcon} | ||
validationMessageStyle={_validationMessageStyle} | ||
retainValidationSpace={retainValidationSpace} | ||
testID={`${props.testID}.validationMessage`} | ||
|
@@ -220,6 +225,7 @@ const TextField = (props: InternalTextFieldProps) => { | |
/> | ||
)} | ||
</View> | ||
{_helperText} | ||
</View> | ||
</FieldContext.Provider> | ||
); | ||
|
Uh oh!
There was an error while loading. Please reload this page.