import React from 'react'; import Module from '../lib/Module'; import {StyleSheet ,TextInput, View, Button , Text } from 'react-native'; import Types from '../lib/Types'; const Inp = [ { textContentType :"username", placeholder:"username" }, { textContentType :"password", placeholder:"password" }] export default class FormComp extends Module { constructor(props) { super(props); this.state = { } this.submit = this.submit.bind(this) } submit(e){ e.preventDefault() return this.state } display() { let { inputs, // number of inputs this must be Object inputsMargin, ButtonText, ButtonColor, backgroundColor, Formtitle } = this.props //Init if(!inputsMargin) inputsMargin = 7 console.log("@@@@@") console.log(this.props) let Inputs = (inputs || []).map((item,indx) => { let state = {} return ( { state[indx] = text; this.setState(state)}} value={this.state.key} placeholder={item.placeholder} textContentType={item.textContentType} secureTextEntry={ item.textContentType === "password" ? true :false} />) }) let fn = this.props.submit || this.submit return ( {this.props.Formtitle ? ( {this.props.Formtitle} ):(null)} {Inputs}