Skip to content

chore(ios): mark -[RCTSurfacePresenter addObserver:] as deprecated - #59011

Closed
tjzel wants to merge 1 commit into
react:mainfrom
tjzel:@tjzel/deprecate-surface-presenter-add-observer
Closed

tjzel wants to merge 1 commit into
react:mainfrom
tjzel:@tjzel/deprecate-surface-presenter-add-observer

Conversation

@tjzel

@tjzel tjzel commented Oct 12, 2026

Copy link
Copy Markdown
Contributor

Note

This PR description is AI-generated.

Summary:

-[RCTSurfacePresenter addObserver:] is documented as deprecated in favor of RCTMountingTransactionObserverCoordinator, but it has no attribute, so the compiler cannot warn callers. I added __deprecated_msg to the declaration, the same idiom as -[RCTViewManager customBubblingEventTypes]. I suppressed -Wdeprecated-implementations around the implementation, the same way RCTUITextField.mm does. I kept removeObserver: undeprecated, because callers that still use addObserver: must balance it, and they should not get a second warning for the cleanup call. The in-repo caller, RCTNativeAnimatedTurboModule, calls through id<RCTSurfacePresenterStub>, whose declaration is not deprecated, so it gets no warning and needs no change.

Changelog:

[IOS] [DEPRECATED] - Mark -[RCTSurfacePresenter addObserver:] as deprecated for the compiler. Use RCTMountingTransactionObserverCoordinator instead.

Test Plan:

  • I ran clang++ -fsyntax-only on a small Objective-C++ file that includes RCTSurfacePresenter.h. A call on RCTSurfacePresenter * gives warning: 'addObserver:' is deprecated: Use RCTMountingTransactionObserverCoordinator instead. Calls to removeObserver: and calls through id<RCTSurfacePresenterStub> give no warning.
  • RCTSurfacePresenter.mm passes clang++ -fsyntax-only -Werror=deprecated-declarations -Werror=deprecated-implementations.
  • node scripts/clang-format.js --check passes on both files.
  • I did not build RNTester.

https://claude.ai/code/session_01Do8XDDkHi4bGs3ZHQcWcAH

The method was documented as deprecated, but it had no attribute, so
the compiler could not warn callers. Add __deprecated_msg so that
callers get -Wdeprecated-declarations. Suppress
-Wdeprecated-implementations around the implementation.

Claude-Session: https://claude.ai/code/session_01Do8XDDkHi4bGs3ZHQcWcAH
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Oct 12, 2026
@facebook-github-tools facebook-github-tools Bot added p: Software Mansion Partner: Software Mansion Partner labels Oct 12, 2026
@tjzel
tjzel marked this pull request as ready for review October 12, 2026 15:18
@facebook-github-tools facebook-github-tools Bot added the Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. label Oct 12, 2026
@meta-codesync

meta-codesync Bot commented Oct 13, 2026

Copy link
Copy Markdown

@javache has imported this pull request. If you are a Meta employee, you can view this in D124967062.

@meta-codesync meta-codesync Bot closed this in 9979e14 Oct 13, 2026
@meta-codesync meta-codesync Bot added the Merged This PR has been merged. label Oct 13, 2026
@meta-codesync

meta-codesync Bot commented Oct 13, 2026

Copy link
Copy Markdown

@javache merged this pull request in 9979e14.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged This PR has been merged. p: Software Mansion Partner: Software Mansion Partner Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant