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

Method isValid

packages/react-stately/src/layout/ListLayout.ts:453–464  ·  view source on GitHub ↗
(node: Node<T>, offset: number)

Source from the content-addressed store, hash-verified

451 }
452
453 protected isValid(node: Node<T>, offset: number): boolean {
454 let cached = this.layoutNodes.get(node.key);
455 let offsetProperty = this.orientation === 'horizontal' ? 'x' : 'y';
456 return (
457 !this.invalidateEverything &&
458 !!cached &&
459 cached.node === node &&
460 offset === cached.layoutInfo.rect[offsetProperty] &&
461 cached.layoutInfo.rect.intersects(this.validRect) &&
462 cached.validRect.containsRect(cached.layoutInfo.rect.intersection(this.requestedRect))
463 );
464 }
465
466 protected buildChild(node: Node<T>, x: number, y: number, parentKey: Key | null): LayoutNode {
467 if (this.isValid(node, this.orientation === 'horizontal' ? x : y)) {

Callers 4

buildCollectionMethod · 0.95
buildChildMethod · 0.95
buildSectionMethod · 0.95
buildRowGroupMethod · 0.45

Calls 3

intersectsMethod · 0.80
containsRectMethod · 0.80
intersectionMethod · 0.80

Tested by

no test coverage detected