Disable state list animator during measurements of ReactSlider

Summary:
This diff disables the state list animator from the ReactSlider object used to measure ReactSlider.
The motivation is to fix T63030542, which it seems to be caused by the state list animator being accessed and modified from different threads

We don't have a way to reproduce, but based on my analysis this diff will fix T63030542.

I would like to land this diff and then keep tracking production data for the crash reported on T63030542

Changelog:
[Android][Fixed] Fix intermittent crash of ReactSlider on Android

Reviewed By: fkgozali

Differential Revision: D21920698

fbshipit-source-id: 54af388043d5041c4bf981c81364780d3f52d818
This commit is contained in:
David Vacca
2020-06-07 00:43:03 -07:00
committed by Facebook GitHub Bot
parent 965635f073
commit 32888a8b4a
@@ -73,6 +73,10 @@ public class ReactSliderManager extends SimpleViewManager<ReactSlider>
YogaMeasureMode heightMode) {
if (!mMeasured) {
SeekBar reactSlider = new ReactSlider(getThemedContext(), null, STYLE);
// reactSlider is used for measurements purposes, it is not necessary to set a
// StateListAnimator.
// It is not safe to access StateListAnimator from a background thread.
reactSlider.setStateListAnimator(null);
final int spec =
View.MeasureSpec.makeMeasureSpec(
ViewGroup.LayoutParams.WRAP_CONTENT, View.MeasureSpec.UNSPECIFIED);