Skip to content

Commit 5741f77

Browse files
Ziqi Chenfacebook-github-bot
Ziqi Chen
authored andcommitted
added image button role on android
Summary: Because we're now separating accessibilityTraits into accessibilityRole and accessibilityState, we're going to only allow one role to be set, and allow on preset combinations of roles that make sense. This adds android functionality for an added role that is image button. Reviewed By: blavalla Differential Revision: D8846987 fbshipit-source-id: 9fe36828f63b05bd2c9cf9680204b1995d678342
1 parent 5acb721 commit 5741f77

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Diff for: ReactAndroid/src/main/java/com/facebook/react/uimanager/AccessibilityRoleUtil.java

+5
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ public enum AccessibilityRole {
3434
LINK("android.widget.Button"),
3535
SEARCH("android.widget.EditText"),
3636
IMAGE("android.widget.ImageView"),
37+
IMAGEBUTTON("android.widget.ImageView"),
3738
KEYBOARDKEY("android.inputmethodservice.Keyboard$Key"),
3839
TEXT("android.widget.ViewGroup"),
3940
ADJUSTABLE("android.widget.SeekBar");
@@ -91,6 +92,10 @@ public static void setRole(AccessibilityNodeInfoCompat nodeInfo, final Accessibi
9192
if (role.equals(AccessibilityRole.IMAGE)) {
9293
nodeInfo.setRoleDescription("Image");
9394
}
95+
if (role.equals(AccessibilityRole.IMAGEBUTTON)) {
96+
nodeInfo.setRoleDescription("Button Image");
97+
nodeInfo.setClickable(true);
98+
}
9499
if (role.equals(AccessibilityRole.ADJUSTABLE)) {
95100
nodeInfo.setRoleDescription("Adjustable");
96101
}

0 commit comments

Comments
 (0)