@@ -145,6 +145,7 @@ const DurationScroll = forwardRef<DurationScrollRef, DurationScrollProps>(
145145 setClickSound ( sound ) ;
146146 }
147147 } ;
148+
148149 loadSound ( ) ;
149150
150151 // Unload sound when component unmounts
@@ -154,27 +155,6 @@ const DurationScroll = forwardRef<DurationScrollRef, DurationScrollProps>(
154155 // eslint-disable-next-line react-hooks/exhaustive-deps
155156 } , [ Audio ] ) ;
156157
157- useImperativeHandle ( ref , ( ) => ( {
158- reset : ( options ) => {
159- flatListRef . current ?. scrollToIndex ( {
160- animated : options ?. animated ?? false ,
161- index : initialScrollIndex ,
162- } ) ;
163- } ,
164- setValue : ( value , options ) => {
165- flatListRef . current ?. scrollToIndex ( {
166- animated : options ?. animated ?? false ,
167- index : getInitialScrollIndex ( {
168- numberOfItems,
169- padWithNItems,
170- repeatNumbersNTimes : safeRepeatNumbersNTimes ,
171- value : value ,
172- } ) ,
173- } ) ;
174- } ,
175- latestDuration : latestDuration ,
176- } ) ) ;
177-
178158 const renderItem = useCallback (
179159 ( { item } : { item : string } ) => {
180160 let stringItem = item ;
@@ -401,6 +381,27 @@ const DurationScroll = forwardRef<DurationScrollRef, DurationScrollProps>(
401381 } ,
402382 ] ) ;
403383
384+ useImperativeHandle ( ref , ( ) => ( {
385+ reset : ( options ) => {
386+ flatListRef . current ?. scrollToIndex ( {
387+ animated : options ?. animated ?? false ,
388+ index : initialScrollIndex ,
389+ } ) ;
390+ } ,
391+ setValue : ( value , options ) => {
392+ flatListRef . current ?. scrollToIndex ( {
393+ animated : options ?. animated ?? false ,
394+ index : getInitialScrollIndex ( {
395+ numberOfItems,
396+ padWithNItems,
397+ repeatNumbersNTimes : safeRepeatNumbersNTimes ,
398+ value : value ,
399+ } ) ,
400+ } ) ;
401+ } ,
402+ latestDuration : latestDuration ,
403+ } ) ) ;
404+
404405 return (
405406 < View
406407 pointerEvents = { isDisabled ? "none" : undefined }
0 commit comments