Update PointerEvents static method to reduce duplication

Summary:
This diff updated `PointerEvents` enum to reduce duplication for null checks on pointer events string.

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D33717223

fbshipit-source-id: ff542a05240393416d85651ca08cd55136eb79a4
This commit is contained in:
Xin Chen authored and Facebook GitHub Bot committed 2022-01-27 11:17:55 -08:00
1 parent d6db5c5464
commit 67355f6c74
4 files changed
+8 -19

No files matched your search

@@ -29,7 +29,11 @@ public enum PointerEvents {
;
public static PointerEvents parsePointerEvents(String pointerEventsStr) {
return PointerEvents.valueOf(pointerEventsStr.toUpperCase(Locale.US).replace("-", "_"));
if (pointerEventsStr == null) {
return PointerEvents.AUTO;
} else {
return PointerEvents.valueOf(pointerEventsStr.toUpperCase(Locale.US).replace("-", "_"));
}
}
public static boolean canBeTouchTarget(PointerEvents pointerEvents) {