cosmo-ui
Version:
Common React components
39 lines • 1.89 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var React = require("react");
var react_redux_1 = require("react-redux");
var react_native_1 = require("react-native");
var form_field_1 = require("../abstract/form-field");
var form_field_2 = require("./form-field");
var reducers_1 = require("../reducers");
var selectors_1 = require("../selectors");
var actions_1 = require("../actions");
var _TextInput = (function (_super) {
tslib_1.__extends(_TextInput, _super);
function _TextInput() {
return _super !== null && _super.apply(this, arguments) || this;
}
_TextInput.prototype.renderField = function () {
var _a = this.props, name = _a.name, disabled = _a.disabled, placeholder = _a.placeholder;
return (React.createElement(react_native_1.TextInput, { ref: this.setFieldRef, style: this.styles(), placeholder: placeholder, onChange: this.onChange, value: this.getValueFromState() }));
};
return _TextInput;
}(form_field_2.MobileFormField));
var mapStateToProps = function (state, ownProps) { return (tslib_1.__assign({}, ownProps, { field: selectors_1.mapStateToField(state[reducers_1.FORM_REDUCER_KEY], ownProps) })); };
var mapDispatchToProps = {
setFormField: actions_1.setFormField,
};
var ConnectedTextInput = react_redux_1.connect(mapStateToProps, mapDispatchToProps)(_TextInput);
var TextInput = (function (_super) {
tslib_1.__extends(TextInput, _super);
function TextInput() {
return _super !== null && _super.apply(this, arguments) || this;
}
TextInput.prototype.render = function () {
return React.createElement(ConnectedTextInput, tslib_1.__assign({}, this.props, { formName: this.formName }));
};
return TextInput;
}(form_field_1.FormFieldWrapper));
exports.TextInput = TextInput;
//# sourceMappingURL=text-input.js.map