mirror of
https://github.com/zhigang1992/react-native-gifted-chat.git
synced 2026-01-12 17:42:27 +08:00
feat: can disable send button (#1042)
This commit is contained in:
committed by
Xavier Carpentier
parent
5f33b90fcd
commit
5d088ae263
@@ -5,7 +5,7 @@ import React from 'react';
|
||||
import { StyleSheet, Text, TouchableOpacity, View, ViewPropTypes } from 'react-native';
|
||||
import Color from './Color';
|
||||
|
||||
export default function Send({ text, containerStyle, onSend, children, textStyle, label, alwaysShowSend }) {
|
||||
export default function Send({ text, containerStyle, onSend, children, textStyle, label, alwaysShowSend, disabled }) {
|
||||
if (alwaysShowSend || text.trim().length > 0) {
|
||||
return (
|
||||
<TouchableOpacity
|
||||
@@ -17,6 +17,7 @@ export default function Send({ text, containerStyle, onSend, children, textStyle
|
||||
onSend({ text: text.trim() }, true);
|
||||
}}
|
||||
accessibilityTraits="button"
|
||||
disabled={disabled}
|
||||
>
|
||||
<View>{children || <Text style={[styles.text, textStyle]}>{label}</Text>}</View>
|
||||
</TouchableOpacity>
|
||||
@@ -49,6 +50,7 @@ Send.defaultProps = {
|
||||
textStyle: {},
|
||||
children: null,
|
||||
alwaysShowSend: false,
|
||||
disabled: false,
|
||||
};
|
||||
|
||||
Send.propTypes = {
|
||||
@@ -59,4 +61,5 @@ Send.propTypes = {
|
||||
textStyle: Text.propTypes.style,
|
||||
children: PropTypes.element,
|
||||
alwaysShowSend: PropTypes.bool,
|
||||
disabled: PropTypes.bool,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user