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

Custom field type overrides result in type error #729

Open
chrisvxd opened this issue Dec 14, 2024 Discussed in #702 · 0 comments
Open

Custom field type overrides result in type error #729

chrisvxd opened this issue Dec 14, 2024 Discussed in #702 · 0 comments

Comments

@chrisvxd
Copy link
Member

Discussed in #702

Originally posted by icedcola November 14, 2024
Hello. I'm having some trouble defining new field types with the overrides. Just wondering if I am doing something silly, or if the overrides aren't meant for this.

I have an override like so (just to test):

const overrides = {
    fieldTypes: {
      slider: ( { name, onChange, value }) => (<div>Slide!</div>),
    },

and using it in a component:

fields: {
        Sliderbar: {label: "Test", type: "slider"}
        },

gives an Uncaught TypeError: defaultFields[field.type] is not a function at AutoFieldInternal error.

The Docs mention "You can specify a custom render method for each known field type, or introduce completely new ones."

I replaced with a text or number override and that seems to work. Assuming it is only for overriding default field types, but hopefully I'm just messing something up :) Thank you for any help.

Best regards,
Matt

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

No branches or pull requests

1 participant