"use strict";
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 = __importDefault(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: {
        alignItems: 'center',
        marginTop: 5,
        marginBottom: 10,
    },
    wrapper: {
        alignItems: 'center',
        justifyContent: 'center',
        backgroundColor: Color_1.default.defaultColor,
        borderRadius: 15,
        height: 30,
        paddingLeft: 10,
        paddingRight: 10,
    },
    text: {
        backgroundColor: Color_1.default.backgroundTransparent,
        color: Color_1.default.white,
        fontSize: 12,
    },
    activityIndicator: {
        marginTop: react_native_1.Platform.select({
            ios: -14,
            android: -16,
            default: -15,
        }),
    },
});
class LoadEarlier extends react_1.default.Component {
    renderLoading() {
        if (this.props.isLoadingEarlier === false) {
            return (react_1.default.createElement(react_native_1.Text, { style: [styles.text, this.props.textStyle] }, this.props.label));
        }
        return (react_1.default.createElement(react_native_1.View, null,
            react_1.default.createElement(react_native_1.Text, { style: [styles.text, this.props.textStyle, { opacity: 0 }] }, this.props.label),
            react_1.default.createElement(react_native_1.ActivityIndicator, { color: this.props.activityIndicatorColor, size: this.props.activityIndicatorSize, style: [
                    styles.activityIndicator,
                    this.props.activityIndicatorStyle,
                ] })));
    }
    render() {
        return (react_1.default.createElement(react_native_1.TouchableOpacity, { style: [styles.container, this.props.containerStyle], onPress: () => {
                if (this.props.onLoadEarlier) {
                    this.props.onLoadEarlier();
                }
            }, disabled: this.props.isLoadingEarlier === true, accessibilityTraits: "button" },
            react_1.default.createElement(react_native_1.View, { style: [styles.wrapper, this.props.wrapperStyle] }, this.renderLoading())));
    }
}
exports.default = LoadEarlier;
LoadEarlier.defaultProps = {
    onLoadEarlier: () => { },
    isLoadingEarlier: false,
    label: 'Load earlier messages',
    containerStyle: {},
    wrapperStyle: {},
    textStyle: {},
    activityIndicatorStyle: {},
    activityIndicatorColor: 'white',
    activityIndicatorSize: 'small',
};
LoadEarlier.propTypes = {
    onLoadEarlier: prop_types_1.default.func,
    isLoadingEarlier: prop_types_1.default.bool,
    label: prop_types_1.default.string,
    containerStyle: utils_1.StylePropType,
    wrapperStyle: utils_1.StylePropType,
    textStyle: utils_1.StylePropType,
    activityIndicatorStyle: utils_1.StylePropType,
    activityIndicatorColor: prop_types_1.default.string,
    activityIndicatorSize: prop_types_1.default.string,
};
//# sourceMappingURL=LoadEarlier.js.map