TimboKZ / Chonky

😸 A File Browser component for React.
https://chonky.io
MIT License
734 stars 162 forks source link

Default project gives warning: "[JSS] <Hook />'s styles function doesn't rely on the "theme" argument." #104

Open LeifAndersen opened 3 years ago

LeifAndersen commented 3 years ago

When building the example from the Installation & Usage page, I get the following warning:

Warning: [JSS] <Hook />'s styles function doesn't rely on the "theme" argument. We recommend declaring styles as an object instead.

(I also put this project into a github repo here: https://github.com/LeifAndersen/chonky-warning-demo)

Which you can build with:

npx webpack

and then open index.html in your web browser. (Tested with chromium)

Here is the full error message:

Warning: [JSS] <Hook />'s styles function doesn't rely on the "theme" argument. We recommend declaring styles as an object instead.
warning @ tiny-warning.esm.js:15
getStyles @ react-jss.esm.js:179
createStyleSheet @ react-jss.esm.js:222
eval @ react-jss.esm.js:325
mountMemo @ react-dom.development.js:15846
useMemo @ react-dom.development.js:16219
useMemo @ react.development.js:1532
useStyles @ react-jss.esm.js:324
eval @ chonky.esm.js:4192
renderWithHooks @ react-dom.development.js:14985
updateFunctionComponent @ react-dom.development.js:17356
updateSimpleMemoComponent @ react-dom.development.js:17215
updateMemoComponent @ react-dom.development.js:17092
beginWork @ react-dom.development.js:19135
beginWork$1 @ react-dom.development.js:23935
performUnitOfWork @ react-dom.development.js:22774
workLoopSync @ react-dom.development.js:22702
renderRootSync @ react-dom.development.js:22665
performSyncWorkOnRoot @ react-dom.development.js:22288
eval @ react-dom.development.js:11327
unstable_runWithPriority @ scheduler.development.js:468
runWithPriority$1 @ react-dom.development.js:11276
flushSyncCallbackQueueImpl @ react-dom.development.js:11322
flushSyncCallbackQueue @ react-dom.development.js:11309
unbatchedUpdates @ react-dom.development.js:22433
legacyRenderSubtreeIntoContainer @ react-dom.development.js:26015
render @ react-dom.development.js:26098
eval @ in.jsx:42
./in.jsx @ main.js:2439
__webpack_require__ @ main.js:5556
(anonymous) @ main.js:5638
(anonymous) @ main.js:5640
Show 2 more frames
TimboKZ commented 2 years ago

Thanks for reporting this. This is a known, which happens because Chonky needs to use some custom wrappers for JSS since JSS API for global styles is rubbish.

These will go away once I migrate Chonky to styled-components.

ghost commented 2 years ago

This is a blocker in our codebase. Do you have any workarounds? It's breaking our mui implementation.

kencheah commented 2 years ago

This is also a blocker for us. Are there any workarounds we could try?