Skip to content

Commit 12d42c2

Browse files
committed
Address comments
1 parent bdd437b commit 12d42c2

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

packages/components/TabList/src/TabList/useTabList.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import * as React from 'react';
2-
import { type View, type AccessibilityState, type LayoutRectangle, Platform } from 'react-native';
2+
import { Platform } from 'react-native';
3+
import type { View, AccessibilityState, LayoutRectangle } from 'react-native';
34

45
import { memoize, mergeStyles } from '@fluentui-react-native/framework';
56
import type { LayoutEvent } from '@fluentui-react-native/interactive-hooks';
@@ -81,17 +82,13 @@ export const useTabList = (props: TabListProps): TabListInfo => {
8182

8283
const currentIndex = tabKeys.indexOf(selectedTabKey);
8384

84-
if (currentIndex === -1 && __DEV__) {
85-
console.error(`Selected tab key does not exist in tab key array. Tab Key: ${selectedTabKey}. Keys: ${tabKeys}`);
86-
}
87-
8885
// We want to only switch selection to non-disabled tabs. This skips over disabled ones.
8986
const direction = increment > 0 ? 1 : -1;
90-
increment = increment / direction; // abs
87+
const magnitude = increment * direction;
9188
let newTabKey: string;
9289
let retries = 0;
9390
while (retries < tabKeys.length) {
94-
let newIndex = (currentIndex + direction * (increment + retries)) % tabKeys.length;
91+
let newIndex = (currentIndex + direction * (magnitude + retries)) % tabKeys.length;
9592

9693
if (newIndex < 0) {
9794
newIndex = tabKeys.length + newIndex;

0 commit comments

Comments
 (0)