Skip to content

Restore explanatory comments lost during PR #152 merge with master #169

@thomasttvo

Description

@thomasttvo

Context

PR #152 (thomas/no-use-before-define) was opened 2025-12-24 against the class-component master, well before #150 ("Convert to functional component", 5e29835) landed on 2026-04-28. When this branch was merged with origin/master in commit 5fee673 (2026-04-29), the merge resolution kept #152's no-use-before-define structure and integrated master's behavioral fixes — but did not carry over the ~25 explanatory comments that #150 added.

Evidence

Bot review (claude[bot]) on PR #152 line 114 of src/ReactNativeZoomableView.tsx: #152

Direct grep:

  • git show 5e29835:src/ReactNativeZoomableView.tsx | grep -c 'Lazy init binds the Animated.View' → 1
  • git show <pr-152-head>:src/ReactNativeZoomableView.tsx | grep -c 'Lazy init binds the Animated.View' → 0

Comment blocks to restore

Per the bot's audit:

  • 24-line lazy useRef-init rationale block above panAnimRef
  • 5-line ownsPanAnim/ownsZoomAnim ownership-capture comment (External Animated Values lifecycle contract)
  • 7-line isMounted External-Animated-Values cleanup-skip rationale
  • 11-line zoomToListenerId orphan-listener rationale
  • 8-line originalWidthRef/originalHeightRef stale-closure rationale
  • 14-line componentDidUpdate-semantics block above the !originalWidth || !originalHeight guard (StrictMode mount→unmount→remount survival)
  • 8-line local listenerId-capture comment above getZoomToAnimation().start()
  • 4-line wrapper comment above the five terminal PanResponder callbacks
  • 7-line synchronous PanResponder.create rationale
  • 4-line forwardRef wrapper comment

These document non-obvious WHY decisions (StrictMode mount/unmount, native-driver mirror lag, listener orphaning races, External Animated Values ownership contracts) that aren't derivable from the surrounding code.

Why deferred from PR #152

PR #152's title and stated scope is no-use-before-define (lint refactor only). Restoring ~25 comment blocks is a manual port (not a clean revert — the post-merge file shape differs from master because function ordering changed for the lint rule) and is substantively different work. Per the repo's REVIEW.md §2 ("PR scope matches title"), this belongs in a separate follow-up — mirroring the pattern already established by 66ff2c1 ("Restore three master-side fixes lost during merge").

Proposed approach

Cherry-pick the comment blocks from master 5e29835 into the current file. Manual port required because of function-ordering changes from the lint rule.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions