question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

useBreakpointValue crashes app on mobile Safari ?

See original GitHub issue

Bug report

Describe the bug

I need to have breakpoint based values for the size propety on a Drawer and since responsive properties aren’t available for the size on Drawer ( featured requested here in this issue ) i decided to use useBreakPointValue, but turns out it’s breaking my application on mobile with this error:

TypeError: mediaQuery.addEventListener is not a function. ( in 'mediaQuery.addEventlistener("change", handleChange), 'mediaQuery.addEventListener' is undefined)

It does work well on the desktop browser tough.

To reproduce

  • install chakra-ui 1.0.0-rc.5.
  • add useBreakPointValue inside of a component
  • open website on safari mobile, i’m using iOS 13.4.1
const size = useBreakpointValue({ base: 'full', sm: 'xs' })

Expected behavior

Screenshots

image

System information

  • OS: iOS 13.3.1

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
ljosberinncommented, Oct 23, 2020

Someone patched Chakra with the patch-package tool over here but it’s a different issue - you might be able to work around that. Else I’m afraid you can only use the fix locally.

0reactions
hemscommented, Oct 26, 2020

Did you happen to see this? MIght help organizing your theme more, the docs just illustrate using inline extendTheme({...huge object here }) for the sake of brevity.

Yes, i did see that! Thanks for linking.

Since it’s my first project using chakra i decided to download the theme pack to understand a bit more how the theme is implemented and hopefully keep the same standards.

then later i believe i should move into using extendTheme and only do what’s needed, but at this stage i believe i’m still figuring out how it works and it’s very interesting to read the default implementation.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Safari crashing iOS 14 | Apple Developer Forums
The app itself doesnt crash, just the tab crash's. Says problem repeatedly happened on this webpage and page title changes to "Webpage Crashed"....
Read more >
useBreakpointValue - Chakra UI
useBreakpointValue is a custom hook which returns the value for the current breakpoint from the provided responsive values object.
Read more >
Some iPhone and iPad Users Seeing Strange Safari Crashes ...
Some iPhone and iPad users appear to be experiencing a curious bug in Safari at the current time, with the app crashing when...
Read more >
Progressive Web App crashes on Mobile Safari - Stack Overflow
Where I work we're currently making a PWA App. The app runs fine on Android, and on Desktop Chrome and Desktop Safari.
Read more >
App crashes on mobile and safari - Bugs - Babylon.js Forum
I'm currently working on an app that uses babylonjs v5.8.2 and that works well on chrome desktop. However it doesn't work on safari...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found