This repository was archived by the owner on Aug 12, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathSend.js
71 lines (70 loc) · 2.2 KB
/
Send.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import PropTypes from 'prop-types';
import React, { Component } from 'react';
import { StyleSheet, Text, TouchableOpacity, View, ViewPropTypes, } from 'react-native';
import Color from './Color';
import MaterialIcons from 'react-native-vector-icons/MaterialIcons';
import Ionicons from 'react-native-vector-icons/Ionicons';
const styles = StyleSheet.create({
container: {
height: 44,
justifyContent: 'flex-end',
},
text: {
color: Color.defaultBlue,
fontWeight: '600',
fontSize: 17,
backgroundColor: Color.backgroundTransparent,
marginBottom: 12,
marginLeft: 10,
marginRight: 10,
},
icon: {
color: Color.defaultBlue,
fontWeight: '600',
fontSize: 20,
backgroundColor: Color.backgroundTransparent,
marginBottom: 16,
marginLeft: 10,
marginRight: 10,
},
});
export default class Send extends Component {
render() {
const { text, containerStyle, onSend, children, textStyle, label, alwaysShowSend, disabled, sendButtonProps, } = this.props;
if (alwaysShowSend || (text && text.trim().length > 0)) {
return (<TouchableOpacity testID='send' accessible accessibilityLabel='send' style={[styles.container, containerStyle]} onPress={() => {
if (text && onSend) {
onSend({ text: text.trim() }, true);
}
}} accessibilityTraits='button' disabled={disabled} {...sendButtonProps}>
<View>
<MaterialIcons style={styles.icon} name={'send'} />
</View>
</TouchableOpacity>);
}
return <View />;
}
}
Send.defaultProps = {
text: '',
onSend: () => { },
label: '送信',
containerStyle: {},
textStyle: {},
children: null,
alwaysShowSend: false,
disabled: false,
sendButtonProps: null,
};
Send.propTypes = {
text: PropTypes.string,
onSend: PropTypes.func,
label: PropTypes.string,
containerStyle: ViewPropTypes.style,
textStyle: PropTypes.any,
children: PropTypes.element,
alwaysShowSend: PropTypes.bool,
disabled: PropTypes.bool,
sendButtonProps: PropTypes.object,
};
//# sourceMappingURL=Send.js.map