MCPcopy Create free account
hub / github.com/NativeScript/SimDeck / tabBarControls

Function tabBarControls

packages/nativescript-inspector/src/index.ts:1637–1660  ·  view source on GitHub ↗
(tabBar: any)

Source from the content-addressed store, hash-verified

1635}
1636
1637function tabBarControls(tabBar: any): any[] {
1638 const controls = collectSubviews(
1639 tabBar,
1640 (view) =>
1641 isKindOf(view, "UIControl") &&
1642 isVisible(view) &&
1643 hasUsableFrame(frameInScreen(view)),
1644 );
1645 const byFrame = new Map<string, any>();
1646 for (const control of controls) {
1647 const frame = frameInScreen(control);
1648 if (!frame) {
1649 continue;
1650 }
1651 byFrame.set(rectKey(frame), control);
1652 }
1653 return preferLargestNonOverlappingControls([...byFrame.values()]).sort(
1654 (left, right) => {
1655 const leftFrame = frameInScreen(left);
1656 const rightFrame = frameInScreen(right);
1657 return rectNumber(leftFrame, "x") - rectNumber(rightFrame, "x");
1658 },
1659 );
1660}
1661
1662function preferLargestNonOverlappingControls(controls: any[]): any[] {
1663 const accepted: any[] = [];

Callers 1

Calls 10

collectSubviewsFunction · 0.85
isKindOfFunction · 0.85
isVisibleFunction · 0.85
hasUsableFrameFunction · 0.85
frameInScreenFunction · 0.85
rectKeyFunction · 0.85
rectNumberFunction · 0.85
setMethod · 0.80
valuesMethod · 0.65

Tested by

no test coverage detected