gcanti / tcomb-form-native

Forms library for react-native
MIT License
3.15k stars 458 forks source link

Access parent locals? #467

Open compojoom opened 6 years ago

compojoom commented 6 years ago

I'm trying to do something that is driving me mad.

I have the following model

t.struct({ name: t.string, t.fields: t.Object views: t.struct({ fields:t.Boolean, something: t.Boolean }) }}

Now when I display my form I want to order it like this: name, views.fields t.fields

the conditional on views.fields should render the parent fields.

I tried with a custom template, but I cannot show views.fields {locals.input.views.fields} doesn't render anything. I can only do {locals.input.views}, but this renders all elements within views.

I did a child template for views, but then I cannot access the parent? Any idea how to trick this into working without changing my model?

compojoom commented 5 years ago

anyone? @alvaromb @gcanti ?