MM-37608 and MM-37416 issue fixes (#5592)
* Fixed the MM-37608 issue * Fixed the MM-37416 issue
This commit is contained in:
parent
fd0cc90160
commit
340ec81b25
4 changed files with 12 additions and 12 deletions
|
|
@ -27,6 +27,8 @@ export default class SettingsDrawer extends SettingsSidebarBase {
|
||||||
this.state = {
|
this.state = {
|
||||||
deviceWidth: Dimensions.get('window').width,
|
deviceWidth: Dimensions.get('window').width,
|
||||||
openDrawerOffset: DRAWER_INITIAL_OFFSET,
|
openDrawerOffset: DRAWER_INITIAL_OFFSET,
|
||||||
|
showStatus: true,
|
||||||
|
showRetryMessage: false,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ export default class SettingsSidebarBase extends PureComponent {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
this.state = {
|
this.state = {
|
||||||
showStatus: props.isCustomStatusEnabled,
|
showStatus: true,
|
||||||
showRetryMessage: false,
|
showRetryMessage: false,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
// See LICENSE.txt for license information.
|
// See LICENSE.txt for license information.
|
||||||
|
|
||||||
import moment, {Moment} from 'moment';
|
import moment, {Moment} from 'moment';
|
||||||
import React, {useCallback, useState} from 'react';
|
import React, {useCallback} from 'react';
|
||||||
import {injectIntl, intlShape} from 'react-intl';
|
import {injectIntl, intlShape} from 'react-intl';
|
||||||
import {View, TouchableOpacity} from 'react-native';
|
import {View, TouchableOpacity} from 'react-native';
|
||||||
|
|
||||||
|
|
@ -26,6 +26,7 @@ type Props = {
|
||||||
intl: typeof intlShape;
|
intl: typeof intlShape;
|
||||||
showExpiryTime?: boolean;
|
showExpiryTime?: boolean;
|
||||||
showDateTimePicker?: boolean;
|
showDateTimePicker?: boolean;
|
||||||
|
expiryTime?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
const {
|
const {
|
||||||
|
|
@ -38,11 +39,9 @@ const {
|
||||||
DATE_AND_TIME,
|
DATE_AND_TIME,
|
||||||
} = CustomStatusDuration;
|
} = 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 style = getStyleSheet(theme);
|
||||||
|
|
||||||
const [expiry, setExpiry] = useState<string>('');
|
|
||||||
|
|
||||||
const expiryMenuItems: { [key in CustomStatusDuration]: string } = {
|
const expiryMenuItems: { [key in CustomStatusDuration]: string } = {
|
||||||
[DONT_CLEAR]: intl.formatMessage(durationValues[DONT_CLEAR]),
|
[DONT_CLEAR]: intl.formatMessage(durationValues[DONT_CLEAR]),
|
||||||
[THIRTY_MINUTES]: intl.formatMessage(durationValues[THIRTY_MINUTES]),
|
[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'}),
|
[DATE_AND_TIME]: intl.formatMessage({id: 'custom_status.expiry_dropdown.custom', defaultMessage: 'Custom'}),
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleClick = useCallback(
|
const handleClick = preventDoubleTap(() => {
|
||||||
preventDoubleTap(() => {
|
handleItemClick(duration, expiryTime);
|
||||||
handleItemClick(duration, '');
|
});
|
||||||
}), [handleItemClick, duration]);
|
|
||||||
|
|
||||||
const handleCustomExpiresAtChange = useCallback((expiresAt: Moment) => {
|
const handleCustomExpiresAtChange = useCallback((expiresAt: Moment) => {
|
||||||
setExpiry(expiresAt.toISOString());
|
|
||||||
handleItemClick(duration, expiresAt.toISOString());
|
handleItemClick(duration, expiresAt.toISOString());
|
||||||
}, [handleItemClick, duration]);
|
}, [handleItemClick, duration]);
|
||||||
|
|
||||||
|
|
@ -85,11 +82,11 @@ const ClearAfterMenuItem = ({handleItemClick, duration, theme, separator, isSele
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
)}
|
)}
|
||||||
{showExpiryTime && expiry !== '' && (
|
{showExpiryTime && expiryTime !== '' && (
|
||||||
<View style={style.rightPosition}>
|
<View style={style.rightPosition}>
|
||||||
<CustomStatusExpiry
|
<CustomStatusExpiry
|
||||||
theme={theme}
|
theme={theme}
|
||||||
time={moment(expiry).toDate()}
|
time={moment(expiryTime).toDate()}
|
||||||
textStyles={style.customStatusExpiry}
|
textStyles={style.customStatusExpiry}
|
||||||
showTimeCompulsory={true}
|
showTimeCompulsory={true}
|
||||||
showToday={true}
|
showToday={true}
|
||||||
|
|
|
||||||
|
|
@ -155,6 +155,7 @@ class ClearAfterModal extends NavigationComponent<Props, State> {
|
||||||
theme={theme}
|
theme={theme}
|
||||||
separator={false}
|
separator={false}
|
||||||
isSelected={duration === DATE_AND_TIME && expiresAt === ''}
|
isSelected={duration === DATE_AND_TIME && expiresAt === ''}
|
||||||
|
expiryTime={expiresAt}
|
||||||
showExpiryTime={showExpiryTime}
|
showExpiryTime={showExpiryTime}
|
||||||
showDateTimePicker={duration === DATE_AND_TIME}
|
showDateTimePicker={duration === DATE_AND_TIME}
|
||||||
/>
|
/>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue