Skip to content

Commit

Permalink
Only disallow changes if the value actually changed
Browse files Browse the repository at this point in the history
Differential Revision: D5884661

fbshipit-source-id: 2d9fe28a0ecfc46afc9ca459975455e1fd13d19b
  • Loading branch information
Kevin Doherty authored and facebook-github-bot committed Sep 26, 2017
1 parent 64ffe45 commit 6f6329d
Showing 1 changed file with 1 addition and 2 deletions.
Expand Up @@ -11,7 +11,6 @@

import android.content.Context;
import android.support.v7.widget.SwitchCompat;
import android.widget.Switch;

/**
* Switch that has its value controlled by JS. Whenever the value of the switch changes, we do not
Expand All @@ -29,7 +28,7 @@ public ReactSwitch(Context context) {

@Override
public void setChecked(boolean checked) {
if (mAllowChange) {
if (mAllowChange && isChecked() != checked) {
mAllowChange = false;
super.setChecked(checked);
}
Expand Down

0 comments on commit 6f6329d

Please sign in to comment.