Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to override (global) templates #3

Open
ArneMis opened this issue Dec 22, 2017 · 0 comments
Open

Unable to override (global) templates #3

ArneMis opened this issue Dec 22, 2017 · 0 comments

Comments

@ArneMis
Copy link

ArneMis commented Dec 22, 2017

I do not know how to create a pull request, so adding this to issues:

It would be nice to add a "templates" property to allow the user to override the global templates for some types.

Code change in FormSchema.js

var defaultTemplates = require('tcomb-form-native/lib/templates/bootstrap'); // -> NEW

type Props = {
data: Object,
schema: Object,
stylesheet?: Object,
templates?: Object // -> NEW
};

options: {
...getFormOptions(props.schema),
stylesheet: props.stylesheet,
templates: Object.assign(defaultTemplates, props.templates) // -> NEW
}

This is just an example how to implement this, maybe there is an even better solution.

const templates = {"select":select};
...

Thanks in advance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant