Skip to content

Unable to override (global) templates #3

@ArneMis

Description

@ArneMis

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions