Skip to content

Commit

Permalink
Disable state list animator during measurements of ReactSlider
Browse files Browse the repository at this point in the history
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
  • Loading branch information
mdvacca authored and facebook-github-bot committed Jun 7, 2020
1 parent 965635f commit 32888a8
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ public long measure(
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);
Expand Down

0 comments on commit 32888a8

Please sign in to comment.