Releases: gcanti/tcomb-form-native
Releases · gcanti/tcomb-form-native
v0.3.2
v0.3.1
-
New Feature
- default templates are now split in standalone files, so you can cherry pick which ones to load
- ability to customize templates, stylesheets and i18n without loading the default ones (improved docs)
- porting of tcomb-form
getValidationErrorMessage
feature
var Age = t.refinement(t.Number, function (n) { return n >= 18; }); // if you define a getValidationErrorMessage function, it will be called on validation errors Age.getValidationErrorMessage = function (value) { return 'bad age ' + value; }; var Schema = t.struct({ age: Age });
-
add support for nested forms, fix #43
- add proper support for struct refinements
- add support for struct label (bootstrap templates)
Example
var Account = t.struct({ email: t.String, profile: t.struct({ name: t.String, surname: t.String }) }); var options = { label: <Text style={{fontSize: 30}}>Account</Text>, fields: { profile: { label: <Text style={{fontSize: 20}}>Profile</Text> } } };
- add support for struct error (bootstrap templates)
-
Experimental
- add support for maybe structs
Example
var Account = t.struct({ email: t.String, profile: t.maybe(t.struct({ name: t.String, surname: t.String })) }); // user enters email: 'aaa', => result { email: 'aaa', profile: null } // user enters email: 'aaa', name: 'bbb' => validation error for surname // user enters email: 'aaa', name: 'bbb', surname: 'ccc' => result { email: 'aaa', profile: { name: 'bbb', surname: 'ccc' } }
v0.3.0
-
Breaking Change
-
Upgrade tcomb-validation to v2, fix #68
Do not worry: the migration path should be seamless since the major version bump was caused by dropping the support for bower (i.e. types and combinators are the same).
Just notice that the short type alias (t.Str
,t.Num
, ...) are deprecated in favour of the long ones (t.String
,t.Number
, ...) and thesubtype
combinator has now a more descriptive aliasrefinement
.
-
-
Bug Fix
- amend struct onChange, fix #70
the previous code would lead to bugs regarding error messages when the
type is a subtype of a struct, gcanti/tcomb-form#235 -
Internal
- move peer dependencies to dependencies