MCPcopy Create free account
hub / github.com/adobe/react-spectrum / toggleExpandedKeys

Function toggleExpandedKeys

packages/@react-spectrum/s2/src/SideNav.tsx:199–206  ·  view source on GitHub ↗
(keys: Set<Key>)

Source from the content-addressed store, hash-verified

197 // Expanding or collapsing an item moves every row below it and mounts or unmounts its children.
198 // Scheduling that as a transition causes the <ViewTransition> around each row to animate.
199 let toggleExpandedKeys = (keys: Set<Key>) => {
200 startTransition(() => {
201 addTransitionType(
202 keys.size > visibleExpandedKeys.size ? ITEM_EXPAND_TRANSITION : ITEM_COLLAPSE_TRANSITION
203 );
204 setExpandedKeys(keys);
205 });
206 };
207
208 let reduceMotion = useMediaQuery('(prefers-reduced-motion: reduce)');
209

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected