Commit c871348
Summary:
The three accessibility conversion helpers in `accessibilityPropsConversions.h` — the two `fromRawValue` overloads (`Role`, `AccessibilityRole`) and `fromString` (`AccessibilityTraits`) — each mapped strings to enums with a long `if`/`else if` chain, giving cyclomatic complexity (CCN) 67, 41, and 26. This is a pure, behavior-preserving refactor: each chain becomes a single lookup into a function-local `static const std::unordered_map`, with every key->value mapping reproduced exactly (including duplicate keys and the OR'd `imagebutton` value) and the original not-found / wrong-type fallback behavior preserved verbatim (logging, `react_native_expect`, and the same sane defaults). The maps are function-local statics, so no new symbols are exported and the public C++ API is unchanged.
Changelog: [Internal]
Differential Revision: D108027808
1 parent 2dc4e99 commit c871348
1 file changed
Lines changed: 147 additions & 290 deletions
File tree
- packages/react-native/ReactCommon/react/renderer/components/view
0 commit comments