Repository navigation
Releases
Releases · bloczjs/react-responsive
v3.0.1
v3.0.0
- The package was renamed
@blocz/react-responsiveinstead ofreact-only - rename
useOnlytouseBreakpointanduseQuerytouseMediaQueryBREAKING CHANGE- Those were renamed for 2 reasons:
useOnlyisn’t really explicituseQuerycan be confused with react-query’s or apollo’s useQuery hooks
- Those were renamed for 2 reasons:
useBreakpointanduseMediaQuerystop returningundefinedduring 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’ll returnfalse. BREAKING CHANGE- Bump peerDependencies to allow for react 17
- Drop support for node 10
- Remove prop
strictBREAKING CHANGE:- This feature was initially introduced to avoid collision between
mdUpandsmDownfor 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)andcalc(% - 1px)which has 2 issues:- difficult to be compatible with SSR as for instance css-mediaquery crashes when we use
calc()(see issue), 1pxis really arbitrary and not customizable so anyway if someone wanted to change that, they had to use custom breakpoints.
- difficult to be compatible with SSR as for instance css-mediaquery crashes when we use
- This feature was initially introduced to avoid collision between
- Fix
onlyandmatchMediaprops on DOM elements for theMatchcomponent- Inject
MatchChildPropsinHTMLAttributesfrom the global namespaceReact
- Inject
v2.3.3
v2.3.2
v2.3.1
- Use Node 13 conditional exports: https://nodejs.org/api/esm.html#esm_conditional_exports
v2.3.0
- remove polyfill for matchMedia (it should be define by the users) minor breaking change
- add new hook
useQueryand use it internally inOnlyfor the propmatchMedia - drop
queryinuseOnlyBREAKING CHANGE- as there is a new hook
useQuerythat deals with media queries, the 2nd argument ofuseOnlywas redundant - new signature:
- before:
useOnly = (on?: string, media?: string, strict?: boolean) => boolean | undefined - after:
useOnly = (on?: string, strict?: boolean) => boolean | undefined
- before:
- as
onandmediawere join with aor, 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;
- before:
- as there is a new hook