Open mayanksahai opened 7 years ago
Tell us which versions you are using:
tcomb-form@0.9.10 └─┬ tcomb-form-templates-bootstrap@0.2.2 └── classnames@2.2.5 react-native-cli: 2.0.1 react-native: 0.40.0
i am trying to use tomb-form for the first time and using ES6 features and having issues. can you please tell me what is wrong with code.
import React, {Component} from 'react' import t from 'tcomb-form' var Form = t.form.Form;
// define a model const Expense = t.struct({ description: t.Str, // two string properties comments: t.Str });
export default class ExpenseFormView extends Component{
constructor(props){ super(props); this.state = { value: { description: 'Giulio', comments: 'Canti' } } }
onClick() { var value = this.refs.form.getValue(); // getValue returns null if validation failed if (value) { console.log(value); } }
onSubmit(){ console.log('submitted..'+ this.refs.form.getValue()); }
render() { return (
);
} }
module.exports = ExpenseFormView;
Version
Tell us which versions you are using:
tcomb-form@0.9.10 └─┬ tcomb-form-templates-bootstrap@0.2.2 └── classnames@2.2.5 react-native-cli: 2.0.1 react-native: 0.40.0
i am trying to use tomb-form for the first time and using ES6 features and having issues. can you please tell me what is wrong with code.
import React, {Component} from 'react' import t from 'tcomb-form' var Form = t.form.Form;
// define a model const Expense = t.struct({ description: t.Str, // two string properties comments: t.Str });
export default class ExpenseFormView extends Component{
onClick() { var value = this.refs.form.getValue(); // getValue returns null if validation failed if (value) { console.log(value); } }
onSubmit(){ console.log('submitted..'+ this.refs.form.getValue()); }
render() { return (
} }
module.exports = ExpenseFormView;