"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
    __setModuleDefault(result, mod);
    return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
// @ts-nocheck
const prop_types_1 = __importDefault(require("prop-types"));
const react_1 = __importStar(require("react"));
const react_native_1 = require("react-native");
const Color_1 = __importDefault(require("./Color"));
const utils_1 = require("./utils");
const styles = react_native_1.StyleSheet.create({
    container: {
        height: 44,
        justifyContent: 'flex-end',
    },
    text: {
        color: Color_1.default.defaultBlue,
        fontWeight: '600',
        fontSize: 17,
        backgroundColor: Color_1.default.backgroundTransparent,
        marginBottom: 12,
        marginLeft: 10,
        marginRight: 10,
    },
});
class Send extends react_1.Component {
    constructor() {
        super(...arguments);
        this.handleOnPress = () => {
            const { text, onSend } = this.props;
            if (text && onSend) {
                onSend({ text: text.trim() }, true);
            }
        };
    }
    render() {
        const { text, containerStyle, children, textStyle, label, alwaysShowSend, disabled, sendButtonProps, } = this.props;
        if (alwaysShowSend || (text && text.trim().length > 0)) {
            return (react_1.default.createElement(react_native_1.TouchableOpacity, Object.assign({ testID: "send", accessible: true, accessibilityLabel: "send", style: [styles.container, containerStyle], onPress: this.handleOnPress, accessibilityTraits: "button", disabled: disabled }, sendButtonProps),
                react_1.default.createElement(react_native_1.View, null, children || react_1.default.createElement(react_native_1.Text, { style: [styles.text, textStyle] }, label))));
        }
        return react_1.default.createElement(react_native_1.View, null);
    }
}
exports.default = Send;
Send.defaultProps = {
    text: '',
    onSend: () => { },
    label: 'Send',
    containerStyle: {},
    textStyle: {},
    children: null,
    alwaysShowSend: false,
    disabled: false,
    sendButtonProps: null,
};
Send.propTypes = {
    text: prop_types_1.default.string,
    onSend: prop_types_1.default.func,
    label: prop_types_1.default.string,
    containerStyle: utils_1.StylePropType,
    textStyle: utils_1.StylePropType,
    children: prop_types_1.default.element,
    alwaysShowSend: prop_types_1.default.bool,
    disabled: prop_types_1.default.bool,
    sendButtonProps: prop_types_1.default.object,
};
//# sourceMappingURL=Send.js.map