From 2e8b7d77554191e5291294ce0e4d413bdbd107e3 Mon Sep 17 00:00:00 2001 From: Gleidson Daniel Silva Date: Tue, 5 Jul 2022 17:41:42 -0300 Subject: [PATCH] [FIX]: Add showInput prop to show actionSheetContent without input (#4335) --- .../index.tsx | 40 ++++++++++--------- .../DeleteAccountActionSheetContent/index.tsx | 1 + 2 files changed, 23 insertions(+), 18 deletions(-) diff --git a/app/containers/ActionSheet/ActionSheetContentWithInputAndSubmit/index.tsx b/app/containers/ActionSheet/ActionSheetContentWithInputAndSubmit/index.tsx index 95de597f8..a3fbc973a 100644 --- a/app/containers/ActionSheet/ActionSheetContentWithInputAndSubmit/index.tsx +++ b/app/containers/ActionSheet/ActionSheetContentWithInputAndSubmit/index.tsx @@ -75,7 +75,8 @@ const ActionSheetContentWithInputAndSubmit = ({ iconName, iconColor, customText, - confirmBackgroundColor + confirmBackgroundColor, + showInput = true }: { onSubmit: (inputValue: string) => void; onCancel?: () => void; @@ -89,6 +90,7 @@ const ActionSheetContentWithInputAndSubmit = ({ iconColor?: string; customText?: React.ReactElement; confirmBackgroundColor?: string; + showInput?: boolean; }): React.ReactElement => { const { colors } = useTheme(); const [inputValue, setInputValue] = useState(''); @@ -106,29 +108,31 @@ const ActionSheetContentWithInputAndSubmit = ({ {description} {customText} - setInputValue(value)} - onSubmitEditing={() => { - // fix android animation - setTimeout(() => { - hideActionSheet(); - }, 100); - if (inputValue) onSubmit(inputValue); - }} - testID={testID} - secureTextEntry={secureTextEntry} - inputStyle={{ borderWidth: 2 }} - bottomSheet={isIOS} - /> + {showInput ? ( + setInputValue(value)} + onSubmitEditing={() => { + // fix android animation + setTimeout(() => { + hideActionSheet(); + }, 100); + if (inputValue) onSubmit(inputValue); + }} + testID={testID} + secureTextEntry={secureTextEntry} + inputStyle={{ borderWidth: 2 }} + bottomSheet={isIOS} + /> + ) : null} onSubmit(inputValue)} cancelTitle={i18n.t('Cancel')} confirmTitle={confirmTitle || i18n.t('Save')} - disabled={!inputValue} + disabled={!showInput ? false : !inputValue} /> ); diff --git a/app/views/ProfileView/components/DeleteAccountActionSheetContent/index.tsx b/app/views/ProfileView/components/DeleteAccountActionSheetContent/index.tsx index d1d2ce0eb..77ab5e33c 100644 --- a/app/views/ProfileView/components/DeleteAccountActionSheetContent/index.tsx +++ b/app/views/ProfileView/components/DeleteAccountActionSheetContent/index.tsx @@ -97,6 +97,7 @@ function ConfirmDeleteAccountActionSheetContent({ changeOwnerRooms = '', removed testID='room-info-edit-view-name' confirmTitle={i18n.t('Delete_Account_confirm')} confirmBackgroundColor={colors.dangerColor} + showInput={false} customText={ <> {!!changeOwnerRooms && }