@shopify/react-hooks
Advanced tools
Comparing version
@@ -8,4 +8,6 @@ 'use strict'; | ||
function createUseMediaFactory(useEffectHook) { | ||
return query => { | ||
const [match, setMatch] = React.useState(false); | ||
return (query, { | ||
initialValue | ||
}) => { | ||
const [match, setMatch] = React.useState(() => initialValue === undefined ? window.matchMedia(query).matches : Boolean(initialValue)); | ||
useEffectHook(() => { | ||
@@ -12,0 +14,0 @@ if (!window || !window.matchMedia) { |
@@ -1,3 +0,7 @@ | ||
export declare const useMedia: (query: string) => boolean; | ||
export declare const useMediaLayout: (query: string) => boolean; | ||
export declare const useMedia: (query: string, { initialValue }: { | ||
initialValue?: boolean; | ||
}) => boolean; | ||
export declare const useMediaLayout: (query: string, { initialValue }: { | ||
initialValue?: boolean; | ||
}) => boolean; | ||
//# sourceMappingURL=media.d.ts.map |
{ | ||
"name": "@shopify/react-hooks", | ||
"version": "3.2.0", | ||
"version": "4.0.0", | ||
"license": "MIT", | ||
@@ -48,5 +48,5 @@ "description": "A collection of primitive React hooks", | ||
"devDependencies": { | ||
"@shopify/jest-dom-mocks": "^5.1.0", | ||
"@shopify/react-testing": "^5.3.0" | ||
"@shopify/jest-dom-mocks": "^5.2.0", | ||
"@shopify/react-testing": "^5.4.0" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
37992
1.39%489
1.66%