From 2290751ac9fcdc89cd17dd71c4271d3227ebf35e Mon Sep 17 00:00:00 2001 From: Samuel Susla Date: Thu, 11 Jun 2020 09:40:42 -0700 Subject: [PATCH] Explicitly set default white value on Slider component Summary: Changelog: [Internal] Here is what I believe happens. We have an instance of `RCTSliderComponentView` which has green thumb tint color. It gets reused, in prepareForRecycle we call `setThumbTintImage:nil` on its UISlider which internally sets an ivar to `nil`. Next time `RCTSliderComponentView` gets used without explicit thumb tint color, we assign nil to UISlider's thumb tint color. Internally this nil gets compared to nil that it saved during `prepareForRecycle` and concludes that the value is already sets and exists early. Since we don't have access to `UISlider` I can't prove this but here is a short video where I showcase this behavior {F239923204} The code in video is here P133083862. Reviewed By: shergin Differential Revision: D21997324 fbshipit-source-id: 28a11ed817cc863a313217c475042918ee726011 --- .../Mounting/ComponentViews/Slider/RCTSliderComponentView.mm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/React/Fabric/Mounting/ComponentViews/Slider/RCTSliderComponentView.mm b/React/Fabric/Mounting/ComponentViews/Slider/RCTSliderComponentView.mm index a5e4d7e83f9..9928b6ad12a 100644 --- a/React/Fabric/Mounting/ComponentViews/Slider/RCTSliderComponentView.mm +++ b/React/Fabric/Mounting/ComponentViews/Slider/RCTSliderComponentView.mm @@ -81,7 +81,10 @@ using namespace facebook::react; // need to make sure that image properties are reset here [_sliderView setMinimumTrackImage:nil forState:UIControlStateNormal]; [_sliderView setMaximumTrackImage:nil forState:UIControlStateNormal]; - [_sliderView setThumbImage:nil forState:UIControlStateNormal]; + + if (_thumbImage) { + [_sliderView setThumbImage:nil forState:UIControlStateNormal]; + } _trackImage = nil; _minimumTrackImage = nil;