mirror of https://github.com/ANL-CEEESA/RELOG.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
1.2 KiB
39 lines
1.2 KiB
export type UseNodesInitializedOptions = {
|
|
/** @default false */
|
|
includeHiddenNodes?: boolean;
|
|
};
|
|
/**
|
|
* This hook tells you whether all the nodes in a flow have been measured and given
|
|
*a width and height. When you add a node to the flow, this hook will return
|
|
*`false` and then `true` again once the node has been measured.
|
|
*
|
|
* @public
|
|
* @returns Whether or not the nodes have been initialized by the `<ReactFlow />` component and
|
|
* given a width and height.
|
|
*
|
|
* @example
|
|
* ```jsx
|
|
*import { useReactFlow, useNodesInitialized } from '@xyflow/react';
|
|
*import { useEffect, useState } from 'react';
|
|
*
|
|
*const options = {
|
|
* includeHiddenNodes: false,
|
|
*};
|
|
*
|
|
*export default function useLayout() {
|
|
* const { getNodes } = useReactFlow();
|
|
* const nodesInitialized = useNodesInitialized(options);
|
|
* const [layoutedNodes, setLayoutedNodes] = useState(getNodes());
|
|
*
|
|
* useEffect(() => {
|
|
* if (nodesInitialized) {
|
|
* setLayoutedNodes(yourLayoutingFunction(getNodes()));
|
|
* }
|
|
* }, [nodesInitialized]);
|
|
*
|
|
* return layoutedNodes;
|
|
*}
|
|
*```
|
|
*/
|
|
export declare function useNodesInitialized(options?: UseNodesInitializedOptions): boolean;
|
|
//# sourceMappingURL=useNodesInitialized.d.ts.map
|