* Polishing post draft to comply with design specs * changed maxHeight in landscape mode, fixed icon sizes - Refactored code so that post draft icon sizes are taken from same constant value - Set maxHeight value in landscape mode to be smaller (tests pending) - Removed repeated styles for button wrappers (passing them down as props to child components) - Increased size of image attachment remote icon, and increased tappable area * Removing repeated logic for file upload * Fixing failed snapshot tests / style checks * Fixing file upload remove icon to have 64% opacity * post draft UX/UI improvements * Fix input box extra spacing * input box line height and attachment border * Animate to original state even if error is showing * Fix permissions * Improve attachment error animation * Fix iOS post input height * Update snapshots
78 lines
2.1 KiB
JavaScript
78 lines
2.1 KiB
JavaScript
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
// See LICENSE.txt for license information.
|
|
|
|
import React, {memo} from 'react';
|
|
import {View} from 'react-native';
|
|
import PropTypes from 'prop-types';
|
|
|
|
import TouchableWithFeedback from 'app/components/touchable_with_feedback';
|
|
import {changeOpacity, makeStyleSheetFromTheme} from 'app/utils/theme';
|
|
|
|
let PaperPlane = null;
|
|
|
|
function SendButton(props) {
|
|
const {theme} = props;
|
|
const style = getStyleSheet(theme);
|
|
|
|
if (!PaperPlane) {
|
|
PaperPlane = require('app/components/paper_plane').default;
|
|
}
|
|
|
|
if (props.disabled) {
|
|
return (
|
|
<View style={style.sendButtonContainer}>
|
|
<View style={[style.sendButton, style.disableButton]}>
|
|
<PaperPlane
|
|
height={16}
|
|
width={19}
|
|
color={changeOpacity(theme.buttonColor, 0.5)}
|
|
/>
|
|
</View>
|
|
</View>
|
|
);
|
|
}
|
|
|
|
return (
|
|
<TouchableWithFeedback
|
|
onPress={props.handleSendMessage}
|
|
style={style.sendButtonContainer}
|
|
type={'opacity'}
|
|
>
|
|
<View style={style.sendButton}>
|
|
<PaperPlane
|
|
height={16}
|
|
width={19}
|
|
color={theme.buttonColor}
|
|
/>
|
|
</View>
|
|
</TouchableWithFeedback>
|
|
);
|
|
}
|
|
|
|
SendButton.propTypes = {
|
|
handleSendMessage: PropTypes.func.isRequired,
|
|
disabled: PropTypes.bool.isRequired,
|
|
theme: PropTypes.object.isRequired,
|
|
};
|
|
|
|
const getStyleSheet = makeStyleSheetFromTheme((theme) => {
|
|
return {
|
|
disableButton: {
|
|
backgroundColor: changeOpacity(theme.buttonBg, 0.3),
|
|
},
|
|
sendButtonContainer: {
|
|
justifyContent: 'flex-end',
|
|
paddingRight: 8,
|
|
},
|
|
sendButton: {
|
|
backgroundColor: theme.buttonBg,
|
|
borderRadius: 4,
|
|
height: 32,
|
|
width: 80,
|
|
alignItems: 'center',
|
|
justifyContent: 'center',
|
|
},
|
|
};
|
|
});
|
|
|
|
export default memo(SendButton);
|