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

inputMaxLength type error #15

Open
lilyzhaoyilu opened this issue Jan 21, 2021 · 1 comment
Open

inputMaxLength type error #15

lilyzhaoyilu opened this issue Jan 21, 2021 · 1 comment

Comments

@lilyzhaoyilu
Copy link

lilyzhaoyilu commented Jan 21, 2021

Hi,

I am using React & Redux. I copied your sample code from Readme and got this error message saying

#index.js:1 Warning: Failed prop type: Invalid prop inputMaxLength of type string supplied to EditableLabel, expected number.
at EditableLabel (http://localhost:3000/static/js/0.chunk.js:150704:7)
at CommentDetailForMedia (http://localhost:3000/static/js/main.chunk.js:2201:5

my code is

          <EditableLabel text={this.props.comment.text}
              labelClassName='media-comments-detail'
              inputClassName='media-comments-detail-edit'
              inputMaxLength='144'
              onFocus={this._handleFocus}
              onFocusOut={this._handleFocusOut}
          />

The functionality works, it is just the console has error messages.
I have also tried to

  1. change it to inputMaxLength=144 (did not work)
  2. delete " inputMaxLength='144" and add maxLength in corresponding CSS (did not work)

I think it is because you set the type of inputMaxLength to number but it is reading as a string...?

Appreciate if you can help!

@fa11enangel
Copy link

Just change the output to this: inputMaxLength={144}. Your example aligned:

          <EditableLabel text={this.props.comment.text}
              labelClassName='media-comments-detail'
              inputClassName='media-comments-detail-edit'
              inputMaxLength={144}
              onFocus={this._handleFocus}
              onFocusOut={this._handleFocusOut}
          />

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

2 participants