From 340ec81b25d472c02027687a5d8a5b3047281ffd Mon Sep 17 00:00:00 2001 From: Manoj Malik Date: Tue, 10 Aug 2021 08:27:38 +0530 Subject: [PATCH] MM-37608 and MM-37416 issue fixes (#5592) * Fixed the MM-37608 issue * Fixed the MM-37416 issue --- .../sidebars/settings/settings_sidebar.ios.js | 2 ++ .../settings/settings_sidebar_base.js | 2 +- .../clear_after_menu_item.tsx | 19 ++++++++----------- .../clear_after_modal.tsx | 1 + 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/app/components/sidebars/settings/settings_sidebar.ios.js b/app/components/sidebars/settings/settings_sidebar.ios.js index 7e23318f4d..ca2d69c31d 100644 --- a/app/components/sidebars/settings/settings_sidebar.ios.js +++ b/app/components/sidebars/settings/settings_sidebar.ios.js @@ -27,6 +27,8 @@ export default class SettingsDrawer extends SettingsSidebarBase { this.state = { deviceWidth: Dimensions.get('window').width, openDrawerOffset: DRAWER_INITIAL_OFFSET, + showStatus: true, + showRetryMessage: false, }; } diff --git a/app/components/sidebars/settings/settings_sidebar_base.js b/app/components/sidebars/settings/settings_sidebar_base.js index 4212ad3c4a..8aa3da8ad3 100644 --- a/app/components/sidebars/settings/settings_sidebar_base.js +++ b/app/components/sidebars/settings/settings_sidebar_base.js @@ -49,7 +49,7 @@ export default class SettingsSidebarBase extends PureComponent { constructor(props) { super(props); this.state = { - showStatus: props.isCustomStatusEnabled, + showStatus: true, showRetryMessage: false, }; } diff --git a/app/screens/custom_status_clear_after/clear_after_menu_item.tsx b/app/screens/custom_status_clear_after/clear_after_menu_item.tsx index b4b4982ea2..6fa22b4ca6 100644 --- a/app/screens/custom_status_clear_after/clear_after_menu_item.tsx +++ b/app/screens/custom_status_clear_after/clear_after_menu_item.tsx @@ -2,7 +2,7 @@ // See LICENSE.txt for license information. import moment, {Moment} from 'moment'; -import React, {useCallback, useState} from 'react'; +import React, {useCallback} from 'react'; import {injectIntl, intlShape} from 'react-intl'; import {View, TouchableOpacity} from 'react-native'; @@ -26,6 +26,7 @@ type Props = { intl: typeof intlShape; showExpiryTime?: boolean; showDateTimePicker?: boolean; + expiryTime?: string; }; const { @@ -38,11 +39,9 @@ const { DATE_AND_TIME, } = CustomStatusDuration; -const ClearAfterMenuItem = ({handleItemClick, duration, theme, separator, isSelected, intl, showExpiryTime = false, showDateTimePicker = false}: Props) => { +const ClearAfterMenuItem = ({handleItemClick, duration, theme, separator, isSelected, intl, showExpiryTime = false, showDateTimePicker = false, expiryTime = ''}: Props) => { const style = getStyleSheet(theme); - const [expiry, setExpiry] = useState(''); - const expiryMenuItems: { [key in CustomStatusDuration]: string } = { [DONT_CLEAR]: intl.formatMessage(durationValues[DONT_CLEAR]), [THIRTY_MINUTES]: intl.formatMessage(durationValues[THIRTY_MINUTES]), @@ -53,13 +52,11 @@ const ClearAfterMenuItem = ({handleItemClick, duration, theme, separator, isSele [DATE_AND_TIME]: intl.formatMessage({id: 'custom_status.expiry_dropdown.custom', defaultMessage: 'Custom'}), }; - const handleClick = useCallback( - preventDoubleTap(() => { - handleItemClick(duration, ''); - }), [handleItemClick, duration]); + const handleClick = preventDoubleTap(() => { + handleItemClick(duration, expiryTime); + }); const handleCustomExpiresAtChange = useCallback((expiresAt: Moment) => { - setExpiry(expiresAt.toISOString()); handleItemClick(duration, expiresAt.toISOString()); }, [handleItemClick, duration]); @@ -85,11 +82,11 @@ const ClearAfterMenuItem = ({handleItemClick, duration, theme, separator, isSele /> )} - {showExpiryTime && expiry !== '' && ( + {showExpiryTime && expiryTime !== '' && ( { theme={theme} separator={false} isSelected={duration === DATE_AND_TIME && expiresAt === ''} + expiryTime={expiresAt} showExpiryTime={showExpiryTime} showDateTimePicker={duration === DATE_AND_TIME} />