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 🍏

19 lines 645 B
export const getInitialScrollIndex = variables => { const { disableInfiniteScroll, initialValue, numberOfItems, padWithNItems, pickerItems, repeatValuesNTimes } = variables; let index = 0; if (initialValue !== undefined) { const indexOfInitialValue = pickerItems.findIndex(item => item.value === initialValue); if (indexOfInitialValue !== -1) { index = indexOfInitialValue; } } return Math.max(numberOfItems * Math.floor(repeatValuesNTimes / 2) + (index + numberOfItems) % numberOfItems - (!disableInfiniteScroll ? padWithNItems : 0), 0); }; //# sourceMappingURL=getInitialScrollIndex.js.map