diff --git a/package/ios/RNCSliderComponentView.mm b/package/ios/RNCSliderComponentView.mm index 661daddd..5f457933 100644 --- a/package/ios/RNCSliderComponentView.mm +++ b/package/ios/RNCSliderComponentView.mm @@ -176,7 +176,20 @@ - (void)updateProps:(const Props::Shared &)props oldProps:(const Props::Shared & if (oldScreenProps.maximumValue != newScreenProps.maximumValue) { [slider setMaximumValue:newScreenProps.maximumValue]; } - updateLimits(slider, newScreenProps.lowerLimit, newScreenProps.upperLimit); + if (slider.lowerLimit != newScreenProps.lowerLimit) { + if(newScreenProps.lowerLimit > slider.upperLimit){ + NSLog(@"Invalid configuration: upperLimit < lowerLimit; lowerLimit not set"); + } else { + slider.lowerLimit = newScreenProps.lowerLimit; + } + } + if (slider.upperLimit != newScreenProps.upperLimit) { + if(newScreenProps.upperLimit < slider.lowerLimit){ + NSLog(@"Invalid configuration: upperLimit < lowerLimit; upperLimit not set"); + } else { + slider.upperLimit = newScreenProps.upperLimit; + } + } if (oldScreenProps.tapToSeek != newScreenProps.tapToSeek) { slider.tapToSeek = newScreenProps.tapToSeek; } @@ -267,21 +280,6 @@ - (void)loadImageFromImageSource:(ImageSource)source completionBlock:(RNCLoadIma } } -void updateLimits(RNCSlider *slider, float newLowerLimit, float newUpperLimit) { - if (slider.lowerLimit != newLowerLimit) { - slider.lowerLimit = newLowerLimit; - } - - if (slider.upperLimit != newUpperLimit) { - slider.upperLimit = newUpperLimit; - } - - if (slider.lowerLimit > slider.upperLimit) { - NSLog(@"Invalid configuration: lowerLimit > upperLimit, reverting lowerLimit to upperLimit."); - slider.lowerLimit = slider.upperLimit; - } -} - - (void)setInverted:(BOOL)inverted { if (inverted) { diff --git a/package/ios/RNCSliderManager.m b/package/ios/RNCSliderManager.m index cd88caa3..67c6e958 100644 --- a/package/ios/RNCSliderManager.m +++ b/package/ios/RNCSliderManager.m @@ -162,7 +162,7 @@ - (void)sliderTouchEnd:(RNCSlider *)sender float lowerLimit = [RCTConvert float:json]; if (lowerLimit > view.upperLimit) { - NSLog(@"Invalid configuration: upperLimit < lowerLimit; lowerLimit not set") + NSLog(@"Invalid configuration: upperLimit < lowerLimit; lowerLimit not set"); } else { view.lowerLimit = lowerLimit; } @@ -171,7 +171,7 @@ - (void)sliderTouchEnd:(RNCSlider *)sender float upperLimit = [RCTConvert float:json]; if (upperLimit < view.lowerLimit) { - NSLog(@"Invalid configuration: upperLimit < lowerLimit; upperLimit not set") + NSLog(@"Invalid configuration: upperLimit < lowerLimit; upperLimit not set"); } else { view.upperLimit = upperLimit; }