"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.prototype.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 });
const prop_types_1 = __importDefault(require("prop-types"));
const react_1 = __importStar(require("react"));
const react_native_1 = require("react-native");
const dayjs_1 = __importDefault(require("dayjs"));
const Color_1 = __importDefault(require("./Color"));
const utils_1 = require("./utils");
const Constant_1 = require("./Constant");
const styles = react_native_1.StyleSheet.create({
    container: {
        alignItems: 'center',
        justifyContent: 'center',
        marginTop: 5,
        marginBottom: 10,
    },
    text: {
        backgroundColor: Color_1.default.backgroundTransparent,
        color: Color_1.default.defaultColor,
        fontSize: 12,
        fontWeight: '600',
    },
});
class Day extends react_1.PureComponent {
    render() {
        const { dateFormat, currentMessage, previousMessage, containerStyle, wrapperStyle, textStyle, textProps, } = this.props;
        if (currentMessage && !utils_1.isSameDay(currentMessage, previousMessage)) {
            return (react_1.default.createElement(react_native_1.View, { style: [styles.container, containerStyle] },
                react_1.default.createElement(react_native_1.View, { style: wrapperStyle },
                    react_1.default.createElement(react_native_1.Text, Object.assign({ style: [styles.text, textStyle] }, textProps), dayjs_1.default(currentMessage.createdAt)
                        .locale(this.context.getLocale())
                        .format(dateFormat)))));
        }
        return null;
    }
}
exports.default = Day;
Day.contextTypes = {
    getLocale: prop_types_1.default.func,
};
Day.defaultProps = {
    currentMessage: {
        createdAt: null,
    },
    previousMessage: {},
    nextMessage: {},
    containerStyle: {},
    wrapperStyle: {},
    textStyle: {},
    textProps: {},
    dateFormat: Constant_1.DATE_FORMAT,
};
Day.propTypes = {
    currentMessage: prop_types_1.default.object,
    previousMessage: prop_types_1.default.object,
    nextMessage: prop_types_1.default.object,
    inverted: prop_types_1.default.bool,
    containerStyle: utils_1.StylePropType,
    wrapperStyle: utils_1.StylePropType,
    textStyle: utils_1.StylePropType,
    textProps: prop_types_1.default.object,
    dateFormat: prop_types_1.default.string,
};
//# sourceMappingURL=Day.js.map