Skip to content

Commit

Permalink
added a null check on accessibilityStates
Browse files Browse the repository at this point in the history
Summary:
Added a check for null on `accessibilityStates`.
Now, if a null value is passed in to the prop, it simply does not do anything.

Reviewed By: achen1

Differential Revision: D9034714

fbshipit-source-id: caffa41a1d8b08d5358d085e4e268e8e6f1c9344
  • Loading branch information
Ziqi Chen authored and facebook-github-bot committed Jul 27, 2018
1 parent 27b3aec commit 40f6998
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,9 @@ public void setAccessibilityRole(T view, String accessibilityRole) {
public void setViewStates(T view, ReadableArray accessibilityStates) {
view.setSelected(false);
view.setEnabled(true);
if (accessibilityStates == null) {
return;
}
for (int i = 0; i < accessibilityStates.size(); i++) {
String state = accessibilityStates.getString(i);
if (state.equals("selected")) {
Expand Down

0 comments on commit 40f6998

Please sign in to comment.