3
0

Form.js 3.0 KB

1
  1. "use strict";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\\modules\\Form.js";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,inputsNum=_this$props.inputsNum,ButtonText=_this$props.ButtonText,ButtonColor=_this$props.ButtonColor,container=_this$props.container;if(!inputsNum)inputsNum=2;var Inputs=[];var _loop=function _loop(i){var key=i+1;var state={};var input=_react["default"].createElement(_reactNative.TextInput,{key:i,style:{height:20,borderColor:'gray',borderWidth:1,marginBottom:5},onChangeText:function onChangeText(text){state[key]=text;_this2.setState(state);},value:_this2.state.key,placeholder:'placeholder',__source:{fileName:_jsxFileName,lineNumber:32}});Inputs.push(input);};for(var i=0;i<inputsNum;i++){_loop(i);}var fn=this.props.submit||this.submit;return _react["default"].createElement(_reactNative.View,{style:{backgroundColor:"#f7e6ff",width:250,height:100,padding:10},__source:{fileName:_jsxFileName,lineNumber:44}},Inputs,_react["default"].createElement(_reactNative.Button,{onPress:function onPress(e){return fn(e);},title:this.props.title||"Submit",color:this.props.ButtonColor||"#008CBA",accessibilityLabel:"Learn more about this purple button",__source:{fileName:_jsxFileName,lineNumber:46}}));}}]);return FormComp;}(_Module2["default"]);exports["default"]=FormComp;FormComp.Inputs={inputsNum:new _Types["default"].Integer().require()["default"](2),ButtonText:new _Types["default"].Text().require()["default"]('Submit'),ButtonColor:new _Types["default"].Text().require().color()["default"]('#008CBA')};