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

Warning while trying to replace default component #284

Closed
matheusjardimb opened this issue Apr 28, 2017 · 4 comments
Closed

Warning while trying to replace default component #284

matheusjardimb opened this issue Apr 28, 2017 · 4 comments
Assignees
Labels
Type: Bug Bug reports and their fixes

Comments

@matheusjardimb
Copy link

Hello there,

I'm trying to replace the default TextField by a LongTextField directly into the schema, by using this (as pointed @ https://github.com/vazco/uniforms/blob/master/INTRODUCTION.md#simpleschema-definition):

import LongTextField from 'uniforms-material/LongTextField';
import { Mongo } from 'meteor/mongo';
import SimpleSchema from 'simpl-schema';
...
Projects.schema = new SimpleSchema({
  name: {
    type: String,
    label: 'The name of the project.',
  },
  description: {
    type: String,
    label: 'The description of the project.',
    uniforms: {
      component: LongTextField,
      propA: 1
    }
  },
/// ...
});

but I'm getting this (annoying) warning in chrome's console:

printer.js:170 Warning: Unknown props `component`, `propA` on <textarea> tag. Remove these props from the element. For details, see https://fb.me/react-unknown-prop
    in textarea (created by EnhancedTextarea)
    in div (created by EnhancedTextarea)
    in EnhancedTextarea (created by TextField)
    in div (created by TextField)
    in TextField (created by LongText)
    in LongText (created by LongTextField)
    in LongTextField (created by AutoField)
    in AutoField (created by AutoFields)
    in div (created by AutoFields)
    in AutoFields (created by ProjectPage)
    in form (created by AutoValidatedQuickMaterialForm)
    in AutoValidatedQuickMaterialForm (created by ProjectPage)
    in div (created by Paper)
    in Paper (created by PageBase)
    in div (created by PageBase)
    in PageBase (created by ProjectPage)
    in ProjectPage (created by MeteorDataContainer)
    in MeteorDataContainer (created by RouterContext)
    in div (created by App)
    in div (created by App)
    in MuiThemeProvider (created by App)
    in App (created by WithWidth)
    in EventListener (created by WithWidth)
    in WithWidth (created by MeteorDataContainer)
    in MeteorDataContainer (created by RouterContext)
    in RouterContext (created by Router)
    in Router

Instead, when I try the following alternative, I get no warning:

        <AutoForm
              model={project}
              showInlineError={true}
              schema={Projects.schema}
              onSubmit={

              <LongTextField name='description'/>
              <AutoFields omitFields={['description',]}/>

              <div><SubmitField /></div>
            </AutoForm>

Am I doing something wrong? I'd really appreciate an alternative to get rid off this warning :)

Thanks a lot! (BTW: great project!)

@janowsiany janowsiany self-assigned this Apr 28, 2017
@janowsiany janowsiany added the Type: Question Questions and other discussions label Apr 28, 2017
@janowsiany
Copy link
Contributor

janowsiany commented Apr 28, 2017

Just remove propA: 1 from uniforms definition on field description. All unhandled props are very likely to be passed down to HTML element which can not handle them, that is why you see this warning.
IF you really need it you can also try with:
EDIT:

filterDOMProps.register('propA');
filterDOMProps.register('component');

@matheusjardimb
Copy link
Author

@janowsiany unfortunately that's not the case.
By removing 'propA', I'm still getting the warning (slightly different):

Warning: Unknown prop `component` on <textarea> tag. Remove this prop from the element. For details, see https://fb.me/react-unknown-prop
    in textarea (created by EnhancedTextarea)
    in div (created by EnhancedTextarea)
    in EnhancedTextarea (created by TextField)
    in div (created by TextField)
    in TextField (created by LongText)
    in LongText (created by LongTextField)
    in LongTextField (created by AutoField)
    in AutoField (created by AutoFields)
    in div (created by AutoFields)
    in AutoFields (created by ProjectPage)
    in form (created by AutoValidatedQuickMaterialForm)
    in AutoValidatedQuickMaterialForm (created by ProjectPage)
    in div (created by Paper)
    in Paper (created by PageBase)
    in div (created by PageBase)
    in PageBase (created by ProjectPage)
    in ProjectPage (created by MeteorDataContainer)
    in MeteorDataContainer (created by RouterContext)
    in div (created by App)
    in div (created by App)
    in MuiThemeProvider (created by App)
    in App (created by WithWidth)
    in EventListener (created by WithWidth)
    in WithWidth (created by MeteorDataContainer)
    in MeteorDataContainer (created by RouterContext)
    in RouterContext (created by Router)
    in Router

Please consider re-opening the issue.

@matheusjardimb
Copy link
Author

@janowsiany I have also tested this alternative definition in my schema and the warning persists:

  description: {
    type: String,
    label: 'The description of the project.',
    uniforms:  LongTextField,
  },

@radekmie
Copy link
Contributor

Yep, it's a bug. I'll handle it tomorrow.

@radekmie radekmie reopened this Apr 28, 2017
@radekmie radekmie added Type: Bug Bug reports and their fixes and removed Type: Question Questions and other discussions labels Apr 28, 2017
@radekmie radekmie moved this to Closed in Open Source Nov 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Bug reports and their fixes
Projects
Archived in project
Development

No branches or pull requests

3 participants