MM-37608 and MM-37416 issue fixes (#5592)

* Fixed the MM-37608 issue

* Fixed the MM-37416 issue
This commit is contained in:
Manoj Malik
2021-08-10 08:27:38 +05:30
committed by GitHub
parent fd0cc90160
commit 340ec81b25
4 changed files with 12 additions and 12 deletions

View File

@@ -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,
};
}

View File

@@ -49,7 +49,7 @@ export default class SettingsSidebarBase extends PureComponent {
constructor(props) {
super(props);
this.state = {
showStatus: props.isCustomStatusEnabled,
showStatus: true,
showRetryMessage: false,
};
}

View File

@@ -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<string>('');
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
/>
</View>
)}
{showExpiryTime && expiry !== '' && (
{showExpiryTime && expiryTime !== '' && (
<View style={style.rightPosition}>
<CustomStatusExpiry
theme={theme}
time={moment(expiry).toDate()}
time={moment(expiryTime).toDate()}
textStyles={style.customStatusExpiry}
showTimeCompulsory={true}
showToday={true}

View File

@@ -155,6 +155,7 @@ class ClearAfterModal extends NavigationComponent<Props, State> {
theme={theme}
separator={false}
isSelected={duration === DATE_AND_TIME && expiresAt === ''}
expiryTime={expiresAt}
showExpiryTime={showExpiryTime}
showDateTimePicker={duration === DATE_AND_TIME}
/>