UNPKG

@quidone/react-native-wheel-picker

Version:

Picker is a UI component for selecting an item from a list of options.

16 lines (15 loc) 299 B
export const getPageIndex = ( offset: number, { maxIndex, pageLength, }: { maxIndex: number; pageLength: number; }, ) => { let index = Math.floor((offset + pageLength / 2) / pageLength); index = Math.max(0, index); index = Math.min(index, maxIndex); return index; };