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

TypeError: useMediaQuery is not a function #82

Open
hari-bhandari opened this issue May 20, 2024 · 10 comments
Open

TypeError: useMediaQuery is not a function #82

hari-bhandari opened this issue May 20, 2024 · 10 comments

Comments

@hari-bhandari
Copy link

image

TypeError: useMediaQuery is not a function

Call Stack
useIsMobileBreakpoint
node_modules\@aperturerobotics\chonky\dist\chonky.cjs.development.js (2490:0)
eval
node_modules\@aperturerobotics\chonky\dist\chonky.cjs.development.js (2852:0)
renderWithHooks
node_modules\react-dom\cjs\react-dom.development.js (16305:0)
updateForwardRef
node_modules\react-dom\cjs\react-dom.development.js (19226:0)
beginWork
node_modules\react-dom\cjs\react-dom.development.js (21636:0)
HTMLUnknownElement.callCallback
node_modules\react-dom\cjs\react-dom.development.js (4164:0)
Object.invokeGuardedCallbackDev
node_modules\react-dom\cjs\react-dom.development.js (4213:0)
invokeGuardedCallback
node_modules\react-dom\cjs\react-dom.development.js (4277:0)
beginWork$1
node_modules\react-dom\cjs\react-dom.development.js (27451:0)
performUnitOfWork
node_modules\react-dom\cjs\react-dom.development.js (26557:0)
workLoopSync
node_modules\react-dom\cjs\react-dom.development.js (26466:0)
renderRootSync
node_modules\react-dom\cjs\react-dom.development.js (26434:0)
performSyncWorkOnRoot
node_modules\react-dom\cjs\react-dom.development.js (26085:0)
flushSyncCallbacks
node_modules\react-dom\cjs\react-dom.development.js (12042:0)
eval
node_modules\react-dom\cjs\react-dom.development.js (25651:0)```
@johnneijzen
Copy link

johnneijzen commented May 30, 2024

same issue i downgrade to ^0.2.8 instead

@fjwillemsen
Copy link

Same error, hope it gets fixed! The effort to maintain Chonky is much appreciated.

@kaytwo
Copy link

kaytwo commented Jul 8, 2024

Our team determined that removing these lines:

"exports": {
".": {
"import": "./dist/index.js",
"require": "./dist/index.js",
"types": "./dist/index.d.ts"
}
},

allowed everything to work as expected. I don't 100% understand what the underlying problem is here, but happy to submit a PR to clean up the package.json for this issue.

@paralin
Copy link
Member

paralin commented Jul 8, 2024

Hmmm that looks like a esm vs. cjs issue. I'll have a look.

@cklat
Copy link

cklat commented Oct 15, 2024

Is there any news to this problem?

I'm able to use the package without any problems after adjusting some things for the initial setup but I'm unable to test anything with it using jest.
When rendering the page which uses the Chonky component in the respective tests, I get the above mentioned error of 'useMediaQuery() is not a function'

Is there any workaround for the moment you guys know of?

e/
Using v0.2.8 for what's worth.

@paralin
Copy link
Member

paralin commented Nov 10, 2024

@hari-bhandari @cklat @kaytwo @johnneijzen @fjwillemsen I released v0.3.1 with the changes mentioned here. Please give it a go and let me know if this issue is fixed or not.

paralin added a commit that referenced this issue Nov 10, 2024
Related: #82

Signed-off-by: Christian Stewart <[email protected]>
@cklat
Copy link

cklat commented Nov 15, 2024

@paralin

unable to upgrade from v0.2.8

edit//

Managed to get it to upgrade.

However in my case (testing to render the component), the error is still the same. Nothing changed

@paralin
Copy link
Member

paralin commented Nov 15, 2024

Ok I'll have another look.

@shayanaijaz
Copy link

Hi, any updates on this issue? Running into the same issue when trying to test using Jest

@paralin
Copy link
Member

paralin commented Jan 7, 2025

I am no longer using chonky and therefore haven't had time to investigate this issue. That said, if someone sends a PR to fix it I will test + merge + publish the updated version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

7 participants