kjanoudi / joiful-react-forms

Automatically generate validated React forms using the Joi schema!
10 stars 1 forks source link

0.1.2 - joifulReactForms context props api proposal #12

Closed bentatum closed 8 years ago

bentatum commented 8 years ago

with this, a user would be able to define element types globally.

static childContextTypes = {
    joifulReactForms: PropTypes.object
};

getChildContext() {
    return {
        joifulReactForms: {
            JoifulInput: {
                types: {
                    text: ...,
                    select: ...,
                    dateTime: ...,
                    ...
                }
            }
        }
    }
}
bentatum commented 8 years ago

If the elementTypes prop on a JoifulForm instance is set, that is currently set to override the context setting. Thoughts on that approach?