@@ -102,6 +102,9 @@ const StepIndicator = ({
102102 const sizeAnim = React . useRef (
103103 new Animated . Value ( customStyles . stepIndicatorSize )
104104 ) . current ;
105+ const staleSizeAnim = React . useRef (
106+ new Animated . Value ( customStyles . stepIndicatorSize )
107+ ) . current ;
105108 const borderRadiusAnim = React . useRef (
106109 new Animated . Value ( customStyles . stepIndicatorSize / 2 )
107110 ) . current ;
@@ -243,6 +246,9 @@ const StepIndicator = ({
243246 } ;
244247
245248 const renderStepLabels = ( ) => {
249+ if ( ! labels || labels . length === 0 ) {
250+ return ;
251+ }
246252 var labelViews = labels . map ( ( label , index ) => {
247253 const selectedStepLabelStyle =
248254 index === currentPosition
@@ -308,8 +314,10 @@ const StepIndicator = ({
308314 height : sizeAnim ,
309315 width : sizeAnim ,
310316 borderRadius : borderRadiusAnim ,
317+ overflow : 'hidden' ,
311318 } ;
312319 indicatorLabelStyle = {
320+ overflow : 'hidden' ,
313321 fontSize : customStyles . currentStepIndicatorLabelFontSize ,
314322 color : customStyles . stepIndicatorLabelCurrentColor ,
315323 } ;
@@ -321,11 +329,13 @@ const StepIndicator = ({
321329 backgroundColor : customStyles . stepIndicatorFinishedColor ,
322330 borderWidth : customStyles . stepStrokeWidth ,
323331 borderColor : customStyles . stepStrokeFinishedColor ,
324- height : customStyles . stepIndicatorSize ,
325- width : customStyles . stepIndicatorSize ,
332+ height : staleSizeAnim ,
333+ width : staleSizeAnim ,
326334 borderRadius : customStyles . stepIndicatorSize / 2 ,
335+ overflow : 'hidden' ,
327336 } ;
328337 indicatorLabelStyle = {
338+ overflow : 'hidden' ,
329339 fontSize : customStyles . stepIndicatorLabelFontSize ,
330340 color : customStyles . stepIndicatorLabelFinishedColor ,
331341 } ;
@@ -337,9 +347,10 @@ const StepIndicator = ({
337347 backgroundColor : customStyles . stepIndicatorUnFinishedColor ,
338348 borderWidth : customStyles . stepStrokeWidth ,
339349 borderColor : customStyles . stepStrokeUnFinishedColor ,
340- height : customStyles . stepIndicatorSize ,
341- width : customStyles . stepIndicatorSize ,
350+ height : staleSizeAnim ,
351+ width : staleSizeAnim ,
342352 borderRadius : customStyles . stepIndicatorSize / 2 ,
353+ overflow : 'hidden' ,
343354 } ;
344355 indicatorLabelStyle = {
345356 overflow : 'hidden' ,
@@ -381,10 +392,11 @@ const StepIndicator = ({
381392 }
382393 const animateToPosition = ( progressBarSize / ( stepCount - 1 ) ) * position ;
383394 sizeAnim . setValue ( customStyles . stepIndicatorSize ) ;
395+ staleSizeAnim . setValue ( customStyles . stepIndicatorSize ) ;
384396 borderRadiusAnim . setValue ( customStyles . stepIndicatorSize / 2 ) ;
385397 Animated . sequence ( [
386398 Animated . timing ( progressAnim , {
387- toValue : animateToPosition ,
399+ toValue : isNaN ( animateToPosition ) ? 0 : animateToPosition ,
388400 duration : 200 ,
389401 useNativeDriver : false ,
390402 } ) ,
@@ -426,13 +438,13 @@ const StepIndicator = ({
426438
427439const styles = StyleSheet . create ( {
428440 container : {
429- backgroundColor : 'transparent ' ,
441+ backgroundColor : 'rgba(1,0,0,0) ' ,
430442 } ,
431443 stepIndicatorContainer : {
432444 flexDirection : 'row' ,
433445 alignItems : 'center' ,
434446 justifyContent : 'space-around' ,
435- backgroundColor : 'transparent ' ,
447+ backgroundColor : 'rgba(1,0,0,0) ' ,
436448 } ,
437449 stepLabelsContainer : {
438450 justifyContent : 'space-around' ,
0 commit comments