Skip to content

feat: implement ios part of measureOnUI#163

Merged
WoLewicki merged 3 commits into0.81.4-discordfrom
wolewicki/measure-native-views-ios-part
Apr 17, 2026
Merged

feat: implement ios part of measureOnUI#163
WoLewicki merged 3 commits into0.81.4-discordfrom
wolewicki/measure-native-views-ios-part

Conversation

@WoLewicki
Copy link
Copy Markdown

PR implementing iOS part of measuring pressables on UI with native views, taken mostly from facebook#51835

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Implements the iOS/Fabric plumbing for measureOnUI, allowing JS-driven measurement to be performed against the native view hierarchy (similar to Android), via the Scheduler → SurfacePresenter → MountingManager path.

Changes:

  • Implement -[RCTSurfacePresenter schedulerMeasure:jsCallback:] to forward measure requests onto the main thread and into the mounting layer.
  • Add -[RCTMountingManager measureAsyncOnUI:rootView:callback:] to compute x, y, width, height, pageX, pageY from UIKit views.
  • Expose the new MountingManager API in RCTMountingManager.h.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
packages/react-native/React/Fabric/RCTSurfacePresenter.mm Forwards scheduler “measure on UI” requests to the mounting manager on the main queue.
packages/react-native/React/Fabric/Mounting/RCTMountingManager.mm Adds UIKit-based measurement implementation and invokes provided callback with results.
packages/react-native/React/Fabric/Mounting/RCTMountingManager.h Declares the new async UI measurement method.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +353 to +354
RCTLogWarn(@"measure cannot find view with tag #%d", reactTag);
callback({});

UIView<RCTComponentViewProtocol> *view = [self->_componentViewRegistry findComponentViewWithTag:reactTag];
if (!view) {
RCTLogWarn(@"measure cannot find view with tag #%d", reactTag);
Comment on lines +356 to +360
RCTFabricSurface *surface = [self surfaceForRootTag:surfaceId];

std::function<void(folly::dynamic)> callbackCopy = jsCallback;
RCTExecuteOnMainQueue(^{
UIView *rootView = surface.view;
@WoLewicki WoLewicki merged commit 26d6362 into 0.81.4-discord Apr 17, 2026
42 of 47 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants