@@ -7,34 +7,26 @@ import Animated, {
77 useAnimatedScrollHandler ,
88} from 'react-native-reanimated' ;
99
10- /**
11- * Props for the TimeRange component
12- * @property {(durationHours: number) => void } onDurationChange - Callback triggered when the selected duration changes
13- */
10+
1411type TimeRangeProps = {
1512 onDurationChange ?: ( durationHours : number ) => void ;
1613} ;
1714
1815const SCALE_FACTOR = 2.5 ;
19- const ITEM_HEIGHT = 36 * SCALE_FACTOR ; // Height of each time item in pixels
20- const TimeRangeHeight = ITEM_HEIGHT ; // Visible area shows a single time option
16+ const ITEM_HEIGHT = 36 * SCALE_FACTOR ;
17+ const TimeRangeHeight = ITEM_HEIGHT ;
2118const ArrowWrapperHeight = 24 * SCALE_FACTOR ;
2219const ArrowIconSize = 10 * SCALE_FACTOR ;
2320const LabelFontSize = 28 * SCALE_FACTOR ;
2421const ListWidth = 100 * SCALE_FACTOR ;
25- const ContainerHeight = TimeRangeHeight + ArrowWrapperHeight * 2 ; // Extra space for arrow indicators
22+ const ContainerHeight = TimeRangeHeight + ArrowWrapperHeight * 2 ;
2623const DurationOptions = Array . from ( { length : 10 } , ( _ , index ) => index + 1 ) ;
2724const DurationSnapOffsets = DurationOptions . map ( ( _ , index ) => index * ITEM_HEIGHT ) ;
2825const DurationLabels = DurationOptions . map ( hours => `${ hours } hr` ) ;
2926
3027export const TimeRange : React . FC < TimeRangeProps > = ( {
3128 onDurationChange,
3229} ) => {
33- /**
34- * Renders individual time items in the list
35- * @param {Object } param0 - Item data and index
36- * @returns {JSX.Element } Rendered time item
37- */
3830 const renderItem = useCallback (
3931 ( { item, index } : { item : string ; index : number } ) => (
4032 < View key = { index } style = { styles . timeItem } >
@@ -44,10 +36,7 @@ export const TimeRange: React.FC<TimeRangeProps> = ({
4436 [ ] ,
4537 ) ;
4638
47- /**
48- * Handles scroll events and interpolates the selected time
49- * Uses Reanimated worklet for smooth performance
50- */
39+
5140 const onScroll = useAnimatedScrollHandler ( {
5241 onScroll : event => {
5342 const { contentOffset } = event ;
@@ -70,7 +59,6 @@ export const TimeRange: React.FC<TimeRangeProps> = ({
7059 < FontAwesome name = "chevron-up" size = { ArrowIconSize } color = "#ffffff" />
7160 </ View >
7261 < View >
73-
7462 < Animated . FlatList
7563 onScroll = { onScroll }
7664 decelerationRate = "fast"
0 commit comments