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

Function getPrevTab

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

Source from the content-addressed store, hash-verified

110 }
111
112 function getPrevTab(index) {
113 let i = index;
114
115 // Look for non-disabled tab from index to first tab on the left
116 while (i--) {
117 if (!isTabDisabled(getTab(i))) {
118 return i;
119 }
120 }
121
122 // If no tab found, continue searching from last tab on right to index
123 i = getTabsCount();
124 while (i-- > index) {
125 if (!isTabDisabled(getTab(i))) {
126 return i;
127 }
128 }
129
130 // All tabs are disabled, return index
131 /* istanbul ignore next */
132 return index;
133 }
134
135 function getFirstTab() {
136 const count = getTabsCount();

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…