mattermost-mobile/app/screens/settings/display/display.tsx
Avinash Lingaloo c1a39094c6
MM-39711 Gekidou Settings - Display Main Screen (#6287)
* added chevron to menu item component

* starting with the skeleton

* starting with the skeleton

* starting with the skeleton

* starting with the skeleton

* remove extra line

* tested on tablets

* some corrections

* corrections as per review

* starting with notification skeleton

* attached notification settings to navigation

* added auto responder

* update translation

* update snapshot

* updated snapshot

* correction after review

* removed unnecessary screen

* refactored

* updated the testIDs

* Update Package.resolved

* refactor

* removed Mattermost as default server name

* fix ts

* refactored settings constant

* display settings skeleton

- pending: query for allowed themes

* added 'allowedThemes' query

* correction after review

* correction after review

* removed extra notification_settings line

* Update en.json

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2022-05-19 17:14:29 +04:00

82 lines
2.5 KiB
TypeScript

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import React from 'react';
import {Alert, Platform, ScrollView, View} from 'react-native';
import {SafeAreaView} from 'react-native-safe-area-context';
import {changeOpacity, makeStyleSheetFromTheme} from '@app/utils/theme';
import {useTheme} from '@context/theme';
import SettingOption from '@screens/settings/setting_option';
const getStyleSheet = makeStyleSheetFromTheme((theme) => {
return {
container: {
flex: 1,
backgroundColor: theme.centerChannelBg,
},
wrapper: {
backgroundColor: changeOpacity(theme.centerChannelColor, 0.06),
...Platform.select({
ios: {
flex: 1,
paddingTop: 35,
},
}),
},
divider: {
backgroundColor: changeOpacity(theme.centerChannelColor, 0.1),
height: 1,
width: '100%',
},
};
});
type DisplayProps = {
isTimezoneEnabled: boolean;
isThemeSwitchingEnabled: boolean;
}
const Display = ({isTimezoneEnabled, isThemeSwitchingEnabled}: DisplayProps) => {
const theme = useTheme();
const styles = getStyleSheet(theme);
const onPressHandler = () => {
return Alert.alert(
'The functionality you are trying to use has not yet been implemented.',
);
};
return (
<SafeAreaView
edges={['left', 'right']}
testID='notification_settings.screen'
style={styles.container}
>
<ScrollView
contentContainerStyle={styles.wrapper}
alwaysBounceVertical={false}
>
<View style={styles.divider}/>
{isThemeSwitchingEnabled && (
<SettingOption
optionName='theme'
onPress={onPressHandler}
/>
)}
<SettingOption
optionName='clock'
onPress={onPressHandler}
/>
{isTimezoneEnabled && (
<SettingOption
optionName='timezone'
onPress={onPressHandler}
/>
)}
<View style={styles.divider}/>
</ScrollView>
</SafeAreaView>
);
};
export default Display;