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

Search: invalid PropType noResultMessage #1664

Closed
jptissot opened this issue May 9, 2017 · 4 comments
Closed

Search: invalid PropType noResultMessage #1664

jptissot opened this issue May 9, 2017 · 4 comments

Comments

@jptissot
Copy link

jptissot commented May 9, 2017

Steps

When using the Search component, I want to be able to pass a react component as a noResultMessage to allow for localization / links. This works as expected (It displays fine) but i get a proptype warning in the console.

Expected Result

No warning in console

Actual Result

Invalid prop noResultsMessage of type object supplied to Search, expected string.

Version

0.68.3

Testcase

<Search
  noResultsMessage={<FormattedMessage {...messages.NoSurveysFound} values={{ link: <Link to="/" onClick={() => clear()}>{formatMessage(messages.ViewAllSurveys)}</Link> }} />}
/>
@jptissot
Copy link
Author

jptissot commented May 9, 2017

Just a side note: I did try this

<Search
  noResultsMessage={formatMessage(messages.NoSurveysFound, {link: <Link to="/" onClick={() => clear()}>{formatMessage(messages.ViewAllSurveys)}</Link> })}
/>

Doing this makes the <Link /> element display as Object [object] instead of displaying a link.

@levithomason
Copy link
Member

I believe we made the same updates to the Dropdown. We simply need to relax the prop type validation here. PRs welcome.

@levithomason
Copy link
Member

Fixed in #1683

@lazazivkovic
Copy link
Contributor

lazazivkovic commented Oct 8, 2018

I believe we made the same updates to the Dropdown. We simply need to relax the prop type validation here. PRs welcome.

@levithomason Could you please take a look at #3177 ? Thanks 😃

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

3 participants