[FIX]: Add showInput prop to show actionSheetContent without input (#4335)

This commit is contained in:
Gleidson Daniel Silva 2022-07-05 17:41:42 -03:00 committed by GitHub
parent f5167a2c94
commit 2e8b7d7755
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 18 deletions

View File

@ -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,6 +108,7 @@ const ActionSheetContentWithInputAndSubmit = ({
<Text style={[styles.subtitleText, { color: colors.titleText }]}>{description}</Text>
{customText}
</>
{showInput ? (
<FormTextInput
value={inputValue}
placeholder={placeholder}
@ -122,13 +125,14 @@ const ActionSheetContentWithInputAndSubmit = ({
inputStyle={{ borderWidth: 2 }}
bottomSheet={isIOS}
/>
) : null}
<FooterButtons
confirmBackgroundColor={confirmBackgroundColor || colors.actionTintColor}
cancelAction={onCancel || hideActionSheet}
confirmAction={() => onSubmit(inputValue)}
cancelTitle={i18n.t('Cancel')}
confirmTitle={confirmTitle || i18n.t('Save')}
disabled={!inputValue}
disabled={!showInput ? false : !inputValue}
/>
</View>
);

View File

@ -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 && <AlertText text={changeOwnerRooms} />}