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

shouldForwardProp should be used for passing transient props in styled-components #223

Closed
EgleJuske opened this issue Jan 22, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@EgleJuske
Copy link

While rendering PDF document, we get:
console warning:
styled-components: it looks like an unknown prop "last" is being sent through to the DOM, which will likely trigger a React console error. If you would like automatic filtering of unknown props, you can opt-into that behavior via"<StyleSheetManager shouldForwardProp={...}>" (connect an API like "@emotion/is-prop-valid") or consider using transient props ("$" prefix for automatic filtering.)
console error:
Warning: Received "true" for a non-boolean attribute "last".

Solution:
shouldForwardProp (https://styled-components.com/docs/api#shouldforwardprop) should be used for passing transient props
The current problem is in:
PDFSingePage line 23 where last prop is being passed to PageWrapper

@cyntler cyntler added the bug Something isn't working label Jan 28, 2024
@edavalosanaya
Copy link

I'm also encountering this issue.

@sujithmathewthomas
Copy link

Any update on this issue?

@Gregorio-Sanchez
Copy link

Gregorio-Sanchez commented Apr 18, 2024

shouldForwardProp (https://styled-components.com/docs/api#shouldforwardprop) should be used for passing transient props

I think know its related to line 44 but can not figure out how to solve it. I have tried but not success:

return (react_1.default.createElement(PageWrapper, { id: "pdf-page-wrapper", last: _pageNum >= numPages },

return (react_1.default.createElement(PageWrapper, { id: "pdf-page-wrapper", shouldForwardProp: (prop)=> prop !== 'last', last: _pageNum >= numPages },

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants