mattermost-mobile/app/screens/bottom_sheet/button.tsx
Matthew Birtch 9753334ff2
[Gekidou MM-46365] fix reaction bar space and update bottom sheet styles (#6634)
* updated styles for reaction bar and made pick reaction pressable

* removed unused style import

* removed unused style import

* updated user avatars, user presence, thread options bottom sheets to new style also

* updated status bottom sheet, thread options, and some tweaks to the bottom sheet main file

* fixed a few minor styling issues

* used proper bottom inset in user presence bottom sheet

* various updates to bottom sheets

* used negative top position instead of negative margin

* updated camera type bottom sheet

* further refinements to bottom sheets

* updates to emoji bar and profile image picker

Co-authored-by: Elias Nahum <nahumhbl@gmail.com>
2022-12-23 14:08:51 +02:00

67 lines
2 KiB
TypeScript

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import React from 'react';
import {GestureResponderEvent, StyleSheet, Text, View} from 'react-native';
import CompassIcon from '@components/compass_icon';
import TouchableWithFeedback from '@components/touchable_with_feedback';
import {useTheme} from '@context/theme';
import {buttonBackgroundStyle, buttonTextStyle} from '@utils/buttonStyles';
import {changeOpacity} from '@utils/theme';
type Props = {
disabled?: boolean;
onPress?: (e: GestureResponderEvent) => void;
icon?: string;
testID?: string;
text?: string;
}
const styles = StyleSheet.create({
button: {
display: 'flex',
flexDirection: 'row',
},
icon_container: {
width: 24,
height: 24,
top: -1,
marginRight: 4,
},
});
export default function BottomSheetButton({disabled = false, onPress, icon, testID, text}: Props) {
const theme = useTheme();
const buttonType = disabled ? 'disabled' : 'default';
const styleButtonText = buttonTextStyle(theme, 'lg', 'primary', buttonType);
const styleButtonBackground = buttonBackgroundStyle(theme, 'lg', 'primary', buttonType);
const iconColor = disabled ? changeOpacity(theme.centerChannelColor, 0.32) : theme.buttonColor;
return (
<TouchableWithFeedback
onPress={onPress}
type='opacity'
style={[styles.button, styleButtonBackground]}
testID={testID}
>
{icon && (
<View style={styles.icon_container}>
<CompassIcon
size={24}
name={icon}
color={iconColor}
/>
</View>
)}
{text && (
<Text
style={styleButtonText}
>{text}</Text>
)}
</TouchableWithFeedback>
);
}