Files
mattermost-mobile/app/screens/bottom_sheet/button.tsx
Joseph Baylon 1d9c371bfb Detox/E2E: Migrate e2e javascript to typescript (#6059)
* Detox/E2E: Migrate to typescript

* Add jest.config.js

* Add moduleMapper to config.json

* Add cookie jar to axios client, fix tsconfig.json and default_config.json

* Take keyboard into consideration; clean test for now for this migration PR

* Revert changes on path_builder

* Attempt to fix dep issues

* Update detox dep

* Added missing @type dev dependencies

* Fix dep order

* Fix unit tests

* Added dynamic year to email.ts
2022-03-17 17:35:26 -07:00

75 lines
2.0 KiB
TypeScript

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import React from 'react';
import {GestureResponderEvent, Text, View} from 'react-native';
import CompassIcon from '@components/compass_icon';
import TouchableWithFeedback from '@components/touchable_with_feedback';
import {useTheme} from '@context/theme';
import {makeStyleSheetFromTheme} from '@utils/theme';
type Props = {
onPress?: (e: GestureResponderEvent) => void;
icon?: string;
testID?: string;
text?: string;
}
export default function BottomSheetButton({onPress, icon, testID, text}: Props) {
const theme = useTheme();
const styles = getStyleSheet(theme);
return (
<TouchableWithFeedback
onPress={onPress}
type='opacity'
style={styles.button}
testID={testID}
>
{icon && (
<View style={styles.icon_container}>
<CompassIcon
size={24}
name={icon}
color={theme.buttonColor}
/>
</View>
)}
{text && (
<Text
style={styles.text}
>{text}</Text>
)}
</TouchableWithFeedback>
);
}
const getStyleSheet = makeStyleSheetFromTheme((theme: Theme) => {
return {
button: {
backgroundColor: theme.buttonBg,
display: 'flex',
flexDirection: 'row',
paddingVertical: 14,
paddingHorizontal: 24,
borderRadius: 4,
alignItems: 'center',
justifyContent: 'center',
height: 48,
},
text: {
color: theme.buttonColor,
fontWeight: 'bold',
fontSize: 16,
lineHeight: 18,
paddingHorizontal: 1,
},
icon_container: {
width: 24,
height: 24,
marginBottom: 1,
},
};
});