gcanti / tcomb-form

Forms library for react
https://gcanti.github.io/tcomb-form
MIT License
1.16k stars 136 forks source link

How can i make transparent layer for t.struct({}) #413

Open MomenYasser opened 6 years ago

MomenYasser commented 6 years ago

Version

Expected behavior

I need to make this Schema:

const schema = t.struct({
    section1: t.struct({
        name: t.String,
        phone: t.Number
    }),
    section2: t.struct({
        email: t.String,
        address: t.String
    })
});

And after submitting the form i'm expecting this value object:

{
    name: 'bla',
    phone: '123456'
    email: 'bla@bla.com',
    address: 'blabla'
}

Actual behavior

{
   section1: {
    name: 'bla',
    phone: '123456'
    },
    section2: {
    email: 'bla@bla.com',
    address: 'blabla'
    }
}

Is there's anyway to make sections transparent Just UI layer ?

Thanks