react-doc-viewer icon indicating copy to clipboard operation
react-doc-viewer copied to clipboard

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

Open EgleJuske opened this issue 1 year ago • 3 comments

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

EgleJuske avatar Jan 22 '24 08:01 EgleJuske

I'm also encountering this issue.

edavalosanaya avatar Feb 16 '24 19:02 edavalosanaya

Any update on this issue?

sujithmathewthomas avatar Apr 09 '24 08:04 sujithmathewthomas

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 },

Gregorio-Sanchez avatar Apr 18 '24 12:04 Gregorio-Sanchez