Skip to content

Releases: bloczjs/react-responsive

v3.0.3

20 Mar 14:15
Compare
Choose a tag to compare

What's Changed

Exposed changes:

  • Add types in exports by @Ayc0 in #60
  • [react 18] mark as available by @Ayc0 in #44
  • [react][types] update to v18 by @Ayc0 in #49

Internal changes:

Full Changelog: v3.0.2...v3.0.3

v3.0.2

22 Apr 21:13
Compare
Choose a tag to compare
  • Better fix only and matchMedia props on DOM elements for the Match component
    • With the implementation of the v3.0.0, we were polluting the global scope, injecting the variable React everywhere. This version ships a better fix for both of them.
  • Add support for node 15 and 16

v3.0.1

09 Apr 12:16
Compare
Choose a tag to compare

3.0.1

  • Fix exports field in package.json
    • use correct lib/ folder instead of dist/
    • Use proper .mjs for node
  • Drop support for node 13

v3.0.0

12 Mar 13:15
Compare
Choose a tag to compare
  • The package was renamed @blocz/react-responsive instead of react-only
  • rename useOnly to useBreakpoint and useQuery to useMediaQuery BREAKING CHANGE
    • Those were renamed for 2 reasons:
      1. useOnly isn鈥檛 really explicit
      2. useQuery can be confused with react-query鈥檚 or apollo鈥檚 useQuery hooks
  • useBreakpoint and useMediaQuery stop returning undefined during the initialization and if the media query is invalid. Instead it will directly use the correct value, and if the media query is invalid, it鈥檒l return false. BREAKING CHANGE
  • Bump peerDependencies to allow for react 17
  • Drop support for node 10
  • Remove prop strict BREAKING CHANGE:
    • This feature was initially introduced to avoid collision between mdUp and smDown for instance. But since we avoid the overlapping of breakpoints in the v1.0.1 and as this is customizable, this prop doesn't make sense anymore.
    • This prop relied on calc(% + 1px) and calc(% - 1px) which has 2 issues:
      • difficult to be compatible with SSR as for instance css-mediaquery crashes when we use calc() (see issue),
      • 1px is really arbitrary and not customizable so anyway if someone wanted to change that, they had to use custom breakpoints.
  • Fix only and matchMedia props on DOM elements for the Match component
    • Inject MatchChildProps in HTMLAttributes from the global namespace React

v2.3.3

02 May 18:26
Compare
Choose a tag to compare
  • remove wrong dependency on emotion

v2.3.2

02 May 18:27
Compare
Choose a tag to compare
  • add toJSON and toCSS for CSS-in-JS support

v2.3.1

02 May 18:27
Compare
Choose a tag to compare

v2.3.0

02 May 18:28
Compare
Choose a tag to compare
  • remove polyfill for matchMedia (it should be define by the users) minor breaking change
  • add new hook useQuery and use it internally in Only for the prop matchMedia
  • drop query in useOnly BREAKING CHANGE
    • as there is a new hook useQuery that deals with media queries, the 2nd argument of useOnly was redundant
    • new signature:
      • before: useOnly = (on?: string, media?: string, strict?: boolean) => boolean | undefined
      • after: useOnly = (on?: string, strict?: boolean) => boolean | undefined
    • as on and media were join with a or, you can still mimic the previous behavior by doing:
      • before:
        const isVisible = useOnly(on, media, strict);
      • after:
        const a = useOnly(on, strict);
        const b = useQuery(media);
        const isVisible = a || b;

v2.2.0

02 May 18:29
Compare
Choose a tag to compare
  • the 3rd option of every breakpoint is instead of a unit string, a string representing the unit or an object with two keys:
    • unit as before ("px", "em", ...)
    • direction "width" or "height"

v2.1.4

02 May 18:29
Compare
Choose a tag to compare
  • expose MatchChildProps