Commit 5663ef6
Simplify
Summary:
`AndroidTextInputProps::getDiffProps` computes a `folly::dynamic` prop diff through ~57 sequential per-prop `if (field != oldProps->field) result[key] = ...` blocks (plus a nested `has_value()` branch for `textAlignVertical` and an optional ternary for `acceptDragAndDropTypes`), giving the function a cyclomatic complexity (CCN) of 63 — past the landing threshold.
This is a pure, behavior-preserving refactor. The recurring compare-and-assign shapes — plain `!=`, color dereference, `floatEquality`, direct `toString`/`toDynamic` conversion, and optional-with-converter — are pulled into small file-local `static` helpers, and the body becomes a flat list of helper calls in the exact same order, with the same keys, comparisons (`!=` vs `floatEquality`), conversions, and values. The serialized output (including `folly::dynamic` insertion order, so the duplicate `numberOfLines`/`includeFontPadding` keys still resolve identically) is unchanged. Only the `.cpp` is touched; there are no public header or API changes.
Changelog: [Internal]
Differential Revision: D108027818AndroidTextInputProps::getDiffProps (#57151)1 parent 38ca607 commit 5663ef6
1 file changed
Lines changed: 251 additions & 251 deletions
File tree
- packages/react-native/ReactCommon/react/renderer/components/textinput/platform/android/react/renderer/components/androidtextinput
0 commit comments