Skip to content

Commit 1859903

Browse files
sammy-SCfacebook-github-bot
authored andcommitted
Simplify HostPlatformViewProps::getDiffProps (#57152)
Summary: `HostPlatformViewProps::getDiffProps` computes a `folly::dynamic` prop diff for Android with the highest complexity in the file: ~60 sequential per-prop `if (field != oldProps->field) result[key] = ...` guards plus inline `switch`es (`outlineStyle`, `backfaceVisibility`), a 28-call events block, a transform loop, and several accessibility object/array builders, for a cyclomatic complexity (CCN) of 87. This is a pure, behavior-preserving refactor. The recurring compare-and-assign shapes — plain `!=`, color dereference, direct `toString`/`toDynamic` conversion, and optional-with-converter — are pulled into small file-local `static` helpers, and the genuinely branching blocks (the two enum `switch`es, `overflow`/`scroll`, the events block, the transform loop, and the accessibility state/labelledBy/order/value/actions builders) are each moved verbatim into a named helper. Every prop keeps its explicit key/value/conversion on one line and in the same order, so the serialized `folly::dynamic` (keys, values, insertion order) is identical. The `// Borders` block is left inline unchanged. Only the `.cpp` is touched; there are no public header or API changes. Changelog: [Internal] Differential Revision: D108027816
1 parent 5663ef6 commit 1859903

1 file changed

Lines changed: 370 additions & 288 deletions

File tree

  • packages/react-native/ReactCommon/react/renderer/components/view/platform/android/react/renderer/components/view

0 commit comments

Comments
 (0)