From dd4759b8c7d9956a7a7055c8a05ff2b5ad089961 Mon Sep 17 00:00:00 2001 From: Mike Turley Date: Thu, 3 Feb 2022 11:16:09 -0500 Subject: [PATCH] feat(validatedtextinput): default field label to label defined in schema if present (#85) If the yup schema of a text field contains a `.label()` (needed for good error messages), ValidatedTextInput will use it as a default for the `label` prop so the consumer doesn't have to duplicate it. --- src/components/ValidatedTextInput/ValidatedTextInput.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/ValidatedTextInput/ValidatedTextInput.tsx b/src/components/ValidatedTextInput/ValidatedTextInput.tsx index 483f535..b431933 100644 --- a/src/components/ValidatedTextInput/ValidatedTextInput.tsx +++ b/src/components/ValidatedTextInput/ValidatedTextInput.tsx @@ -32,7 +32,7 @@ interface IValidatedTextInputProps export const ValidatedTextInput: React.FunctionComponent = ({ field, component = TextInput, - label, + label = field.schema.describe().label, fieldId, isRequired, type = 'text',