@react-aria/utils
Advanced tools
Comparing version 3.0.0-nightly.997 to 3.0.0-nightly.1006
@@ -737,2 +737,16 @@ var { | ||
// Syncs ref from context with ref passed to hook | ||
function useSyncRef(context, ref) { | ||
useLayoutEffect(() => { | ||
if (context && context.ref) { | ||
context.ref.current = ref.current; | ||
return () => { | ||
context.ref.current = null; | ||
}; | ||
} | ||
}, [context, ref]); | ||
} | ||
exports.useSyncRef = useSyncRef; | ||
function getScrollParent(node) { | ||
@@ -739,0 +753,0 @@ while (node && !$e9be933e81f272fbb0513fcc706c7$var$isScrollable(node)) { |
@@ -677,2 +677,13 @@ import { clamp, snapValueToStep } from "@react-stately/utils"; | ||
} | ||
// Syncs ref from context with ref passed to hook | ||
export function useSyncRef(context, ref) { | ||
useLayoutEffect(() => { | ||
if (context && context.ref) { | ||
context.ref.current = ref.current; | ||
return () => { | ||
context.ref.current = null; | ||
}; | ||
} | ||
}, [context, ref]); | ||
} | ||
export function getScrollParent(node) { | ||
@@ -679,0 +690,0 @@ while (node && !$a164c39662575b65a0b01a73e313e5$var$isScrollable(node)) { |
@@ -94,2 +94,6 @@ import React, { HTMLAttributes, MutableRefObject, EffectCallback, RefObject } from "react"; | ||
export function useResizeObserver<T extends HTMLElement>(options: useResizeObserverOptionsType<T>): void; | ||
interface ContextValue<T> { | ||
ref?: MutableRefObject<T>; | ||
} | ||
export function useSyncRef<T>(context: ContextValue<T>, ref: RefObject<T>): void; | ||
export function getScrollParent(node: Element): Element; | ||
@@ -96,0 +100,0 @@ interface ViewportSize { |
{ | ||
"name": "@react-aria/utils", | ||
"version": "3.0.0-nightly.997+1e2b7f28", | ||
"version": "3.0.0-nightly.1006+3a1f1549", | ||
"description": "Spectrum UI components in React", | ||
@@ -21,5 +21,5 @@ "license": "Apache-2.0", | ||
"@babel/runtime": "^7.6.2", | ||
"@react-aria/ssr": "3.0.2-nightly.2677+1e2b7f28", | ||
"@react-stately/utils": "3.0.0-nightly.997+1e2b7f28", | ||
"@react-types/shared": "3.0.0-nightly.997+1e2b7f28", | ||
"@react-aria/ssr": "3.0.2-nightly.2686+3a1f1549", | ||
"@react-stately/utils": "3.0.0-nightly.1006+3a1f1549", | ||
"@react-types/shared": "3.0.0-nightly.1006+3a1f1549", | ||
"clsx": "^1.1.1" | ||
@@ -33,3 +33,3 @@ }, | ||
}, | ||
"gitHead": "1e2b7f280a04ead83e21b27fa580eb189e5f4186" | ||
"gitHead": "3a1f15494c22fb9f06de7285f8b920f46f959fac" | ||
} |
@@ -27,2 +27,3 @@ /* | ||
export * from './useResizeObserver'; | ||
export * from './useSyncRef'; | ||
export * from './getScrollParent'; | ||
@@ -29,0 +30,0 @@ export * from './useViewportSize'; |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
235506
29
2500