UNPKG

@salient-sys/react-native-infinite-picker

Version:

A simple, flexible, performant duration picker for React Native apps 🔥 Great for timers, alarms and duration inputs ⏰🕰️⏳ Includes iOS-style haptic and audio feedback 🍏

31 lines (30 loc) 702 B
export const findNearestEnabledItemAndIndex = variables => { const { index, pickerItems } = variables; if (!pickerItems.length) { return {}; } let left = index - 1; let right = index + 1; while (left <= 0 || right < pickerItems.length) { if (right < pickerItems.length && !pickerItems[right].isDisabled) { return { pickerItem: pickerItems[right], index: right }; } if (left >= 0 && !pickerItems[left].isDisabled) { return { pickerItem: pickerItems[left], index: left }; } left--; right++; } // all items are disabled return {}; }; //# sourceMappingURL=findNearestEnabledItemAndIndex.js.map