From a778e1f76191aea7c1a18d60a23ffbd6d3dec0eb Mon Sep 17 00:00:00 2001 From: Avinash Lingaloo Date: Tue, 30 Nov 2021 14:46:21 +0400 Subject: [PATCH] ts fixes --- app/components/error_text/index.tsx | 2 +- .../floating_text_input_label/index.tsx | 4 +++- .../edit_profile/components/email_field.tsx | 3 ++- app/screens/edit_profile/components/field.tsx | 2 +- .../components/field_description.tsx | 2 +- app/screens/edit_profile/edit_profile.tsx | 5 ++--- package-lock.json | 20 ------------------- types/utils/index.d.ts | 1 + 8 files changed, 11 insertions(+), 28 deletions(-) diff --git a/app/components/error_text/index.tsx b/app/components/error_text/index.tsx index 2db198ec84..647f0a7276 100644 --- a/app/components/error_text/index.tsx +++ b/app/components/error_text/index.tsx @@ -8,7 +8,7 @@ import FormattedText from '@components/formatted_text'; import {makeStyleSheetFromTheme} from '@utils/theme'; type ErrorProps = { - error: Partial | string; + error: ErrorText; testID?: string; textStyle?: StyleProp | StyleProp; theme: Theme; diff --git a/app/components/floating_text_input_label/index.tsx b/app/components/floating_text_input_label/index.tsx index 4c11bdce30..e5a0bc7117 100644 --- a/app/components/floating_text_input_label/index.tsx +++ b/app/components/floating_text_input_label/index.tsx @@ -240,7 +240,6 @@ const FloatingTextInput = forwardRef } {Boolean(error) && ( diff --git a/app/screens/edit_profile/components/email_field.tsx b/app/screens/edit_profile/components/email_field.tsx index 4343fcbb18..2a27a3ef85 100644 --- a/app/screens/edit_profile/components/email_field.tsx +++ b/app/screens/edit_profile/components/email_field.tsx @@ -64,13 +64,14 @@ const EmailField = ({authService, email, onChange}: EmailSettingsProps) => { return ( ); }; diff --git a/app/screens/edit_profile/components/field.tsx b/app/screens/edit_profile/components/field.tsx index ca384d4975..a6c1331efb 100644 --- a/app/screens/edit_profile/components/field.tsx +++ b/app/screens/edit_profile/components/field.tsx @@ -80,7 +80,7 @@ const Field = ({ theme={theme} value={value} /> - {isDisabled && ( + {isDisabled && fieldDescription && ( diff --git a/app/screens/edit_profile/components/field_description.tsx b/app/screens/edit_profile/components/field_description.tsx index 406a646249..4577abed08 100644 --- a/app/screens/edit_profile/components/field_description.tsx +++ b/app/screens/edit_profile/components/field_description.tsx @@ -9,7 +9,7 @@ import {useTheme} from '@context/theme'; import {changeOpacity, makeStyleSheetFromTheme} from '@utils/theme'; type HelpContentProps = { - text?: string; + text: string; }; const Description = ({text}: HelpContentProps) => { diff --git a/app/screens/edit_profile/edit_profile.tsx b/app/screens/edit_profile/edit_profile.tsx index 7616d0ecbd..ca82a3dd51 100644 --- a/app/screens/edit_profile/edit_profile.tsx +++ b/app/screens/edit_profile/edit_profile.tsx @@ -84,7 +84,7 @@ const EditProfile = ({ username: currentUser.username, }); const [canSave, setCanSave] = useState(false); - const [error, setError] = useState(); + const [error, setError] = useState(); const [profileImage] = useState(); @@ -180,7 +180,6 @@ const EditProfile = ({ } catch (e) { resetScreen(e as Error); } - }; const resetScreen = (resetError: Error) => { @@ -242,7 +241,7 @@ const EditProfile = ({ innerRef={setScrollViewRef} testID='edit_profile.scroll_view' > - {Boolean(error) && } + {Boolean(error) && } {renderProfilePicture()} = { [key: string]: T; }; +type ErrorText = Partial | string;