* added MENU_ITEM_HEIGHT to constant/view * fix user presence and your profile * added MENU_ITEM_HEIGHT to constant/view * fix user presence and your profile * UI Polish - Custom Status * UI Polish - Settings * UI Polish - logout * refactored styles * removed 'throws DataOperatorException' from './database/` * fix for copy link option * fix autoresponder 1. user should be allowed to enter paragraph 2. the OOO was not immediately being updated on the notification main screen. The fix is to cal fetchStatusInBatch after the updateMe operation * About Screen - code clean up * removed MenuItem component from common_post_options * removed MenuItem from Settings * refactored show_more and recent_item * removed menu_item component * Update setting_container.tsx * PR review correction * Update setting_container.tsx * Update recent_item.tsx
68 lines
2.1 KiB
TypeScript
68 lines
2.1 KiB
TypeScript
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
// See LICENSE.txt for license information.
|
|
|
|
import React from 'react';
|
|
import {useIntl} from 'react-intl';
|
|
import {Platform} from 'react-native';
|
|
|
|
import OptionItem, {OptionItemProps} from '@components/option_item';
|
|
import {useTheme} from '@context/theme';
|
|
import SettingSeparator from '@screens/settings/settings_separator';
|
|
import {changeOpacity, makeStyleSheetFromTheme} from '@utils/theme';
|
|
import {typography} from '@utils/typography';
|
|
|
|
import Options, {DisplayOptionConfig, NotificationsOptionConfig, SettingOptionConfig} from './config';
|
|
|
|
type SettingsConfig = keyof typeof SettingOptionConfig | keyof typeof NotificationsOptionConfig| keyof typeof DisplayOptionConfig
|
|
type SettingOptionProps = {
|
|
optionName: SettingsConfig;
|
|
onPress: () => void;
|
|
separator?: boolean;
|
|
} & Partial<OptionItemProps>;
|
|
|
|
const getStyleSheet = makeStyleSheetFromTheme((theme: Theme) => {
|
|
return {
|
|
menuLabel: {
|
|
color: theme.centerChannelColor,
|
|
...typography('Body', 200, 'Regular'),
|
|
},
|
|
chevronStyle: {
|
|
marginRight: 14,
|
|
color: changeOpacity(theme.centerChannelColor, 0.32),
|
|
},
|
|
};
|
|
});
|
|
|
|
const SettingItem = ({
|
|
info,
|
|
onPress,
|
|
optionName,
|
|
separator = true,
|
|
...props
|
|
}: SettingOptionProps) => {
|
|
const theme = useTheme();
|
|
const intl = useIntl();
|
|
const styles = getStyleSheet(theme);
|
|
const config = Options[optionName];
|
|
|
|
const label = props.label || intl.formatMessage({id: config.i18nId, defaultMessage: config.defaultMessage});
|
|
|
|
return (
|
|
<>
|
|
<OptionItem
|
|
action={onPress}
|
|
arrowStyle={styles.chevronStyle}
|
|
containerStyle={{marginLeft: 16}}
|
|
icon={config.icon}
|
|
info={info}
|
|
label={label}
|
|
optionLabelTextStyle={[styles.menuLabel, props.optionLabelTextStyle]}
|
|
type={Platform.select({ios: 'arrow', default: 'default'})}
|
|
{...props}
|
|
/>
|
|
{separator && <SettingSeparator/>}
|
|
</>
|
|
);
|
|
};
|
|
|
|
export default SettingItem;
|