MCPcopy
hub / github.com/reactjs/react-tabs / getNextTab

Function getNextTab

src/components/UncontrolledTabs.jsx:90–110  ·  view source on GitHub ↗
(index)

Source from the content-addressed store, hash-verified

88 }
89
90 function getNextTab(index) {
91 const count = getTabsCount();
92
93 // Look for non-disabled tab from index to the last tab on the right
94 for (let i = index + 1; i < count; i++) {
95 if (!isTabDisabled(getTab(i))) {
96 return i;
97 }
98 }
99
100 // If no tab found, continue searching from first on left to index
101 for (let i = 0; i < index; i++) {
102 if (!isTabDisabled(getTab(i))) {
103 return i;
104 }
105 }
106
107 // All tabs are disabled, return index
108 /* istanbul ignore next */
109 return index;
110 }
111
112 function getPrevTab(index) {
113 let i = index;

Callers 1

handleKeyDownFunction · 0.85

Calls 3

getTabsCountFunction · 0.90
isTabDisabledFunction · 0.85
getTabFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…