index.js 3.5 KB

1
  1. var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;var _classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));var _createClass2=_interopRequireDefault(require("@babel/runtime/helpers/createClass"));var _possibleConstructorReturn2=_interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));var _getPrototypeOf2=_interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));var _assertThisInitialized2=_interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));var _inherits2=_interopRequireDefault(require("@babel/runtime/helpers/inherits"));var _react=_interopRequireDefault(require("react"));var _Module2=_interopRequireDefault(require("../../lib/Module"));var _reactNative=require("react-native");var _Types=_interopRequireDefault(require("../../lib/Types"));var _jsxFileName="C:\\Users\\Karteri\\Desktop\\Development\\TrapiLib\\src\\modules\\Form\\index.js";var Inp=[{textContentType:"username",placeholder:"username"},{textContentType:"password",placeholder:"password"}];var FormComp=function(_Module){(0,_inherits2.default)(FormComp,_Module);function FormComp(props){var _this;(0,_classCallCheck2.default)(this,FormComp);_this=(0,_possibleConstructorReturn2.default)(this,(0,_getPrototypeOf2.default)(FormComp).call(this,props));_this.state={};_this.submit=_this.submit.bind((0,_assertThisInitialized2.default)(_this));return _this;}(0,_createClass2.default)(FormComp,[{key:"submit",value:function submit(e){e.preventDefault();return this.state;}},{key:"display",value:function display(){var _this2=this;var _this$props=this.props,inputs=_this$props.inputs,inputsMargin=_this$props.inputsMargin,ButtonText=_this$props.ButtonText,ButtonColor=_this$props.ButtonColor,backgroundColor=_this$props.backgroundColor,Formtitle=_this$props.Formtitle;if(!inputsMargin)inputsMargin=7;var Inputs=(inputs||[]).map(function(item,indx){var state={};return _react.default.createElement(_reactNative.TextInput,{key:indx,style:[{height:20,borderColor:'gray',borderWidth:1,marginBottom:inputsMargin},StaticRules.text],onChangeText:function onChangeText(text){state[indx]=text;_this2.setState(state);},value:_this2.state.key,placeholder:item.placeholder,textContentType:item.textContentType,secureTextEntry:item.textContentType==="password"?true:false,__source:{fileName:_jsxFileName,lineNumber:45}});});var fn=this.props.submit||this.submit;return _react.default.createElement(_reactNative.View,{style:[{backgroundColor:backgroundColor},StaticRules.container],__source:{fileName:_jsxFileName,lineNumber:59}},this.props.Formtitle?_react.default.createElement(_reactNative.Text,{__source:{fileName:_jsxFileName,lineNumber:61}},this.props.Formtitle):null,Inputs,_react.default.createElement(_reactNative.Button,{onPress:function onPress(e){return fn(e);},title:this.props.ButtonText,color:this.props.ButtonColor,accessibilityLabel:"Learn more about this purple button",__source:{fileName:_jsxFileName,lineNumber:66}}));}}]);return FormComp;}(_Module2.default);exports.default=FormComp;var StaticRules=_reactNative.StyleSheet.create({container:{padding:10},text:{fontSize:7}});FormComp.Inputs={inputs:new _Types.default.Array().require().default(Inp),ButtonText:new _Types.default.Text().require().default('Submit'),ButtonColor:new _Types.default.Text().require().color().default('rgba(3, 218, 198, 1)'),backgroundColor:new _Types.default.Text().require().color().default('rgba(0, 140, 186, 1)'),Formtitle:new _Types.default.Text().require()};