Tcomb-form-native: Date in tcomb-form-native

Created on 9 Feb 2017  路  4Comments  路  Source: gcanti/tcomb-form-native

I'm having a form with dateControl. The date Control is optional. I'm loading form with
default value. If i set the value for my date control as undefinedor null it showing current date. I need to manually select the date. I don't need default value to assign.
If i have not picked the date, its value should have undefinednot with default value(i.e. Today's Date).
How to do this?
If i set empty string value '' for date control it doesn't diplaying today's date. but when i submit form it show red border around date control.

Most helpful comment

You can add this in your field definition (options.fields.yourDateInput):

transformer: {
      format: (value) => value,
      parse: (value) => value,
},

The default transformer format function inserts today as the default value so it just overrides this behavior.

This solution gives me a display problem though, since there's no date anymore, the touchable is only the size of the label, it's really not convenient, I'd like to be able to put a border and increase the height like a textbox but I haven't found a way to do it yet.

All 4 comments

@gcanti , @alvaromb I need your help

I have the same problem. If you could fix it let me know

You can add this in your field definition (options.fields.yourDateInput):

transformer: {
      format: (value) => value,
      parse: (value) => value,
},

The default transformer format function inserts today as the default value so it just overrides this behavior.

This solution gives me a display problem though, since there's no date anymore, the touchable is only the size of the label, it's really not convenient, I'd like to be able to put a border and increase the height like a textbox but I haven't found a way to do it yet.

Hi guys!

Sorry for the delay answering, I have tons of work. How do you feel about sending a PR for this?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

pgmemk picture pgmemk  路  4Comments

chauthai picture chauthai  路  4Comments

scarlac picture scarlac  路  4Comments

abdelghafourzguindou picture abdelghafourzguindou  路  4Comments

sibelius picture sibelius  路  4Comments