Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ios): fcp record of performance api may not working #4124

Merged
merged 1 commit into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions renderer/native/ios/renderer/HippyUIManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,14 @@ HIPPY_EXTERN NSString *const HippyFontChangeTriggerNotification;
- (instancetype)init NS_UNAVAILABLE;
+ (instancetype)new NS_UNAVAILABLE;

/// Get all rootView
- (NSArray<__kindof UIView *> *)rootViews;

/// Get rootView with given tag
/// Note: this is root's contentView,
/// NOT the HippyRootView instance!
- (UIView *)rootContentViewForTag:(NSNumber *)rootTag;

/// Gets the view associated with a hippyTag.
/// - Parameters:
/// - hippyTag: NSNumber
Expand Down Expand Up @@ -129,9 +137,6 @@ HIPPY_EXTERN NSString *const HippyFontChangeTriggerNotification;
/// - Parameter tag: root tag
- (void)setNeedsLayoutForRootNodeTag:(NSNumber *)tag;

/// Get all rootView
- (NSArray<__kindof UIView *> *)rootViews;

/// Update view with props
- (void)updateView:(NSNumber *)componentTag onRootTag:(NSNumber *)rootTag props:(NSDictionary *)pros;

Expand Down
5 changes: 5 additions & 0 deletions renderer/native/ios/renderer/HippyUIManager.mm
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,11 @@ - (void)domNodeForComponentTag:(int32_t)componentTag
}
}

- (UIView *)rootContentViewForTag:(NSNumber *)rootTag {
AssertMainQueue();
return [_viewRegistry rootComponentForTag:rootTag];
}

- (UIView *)viewForHippyTag:(NSNumber *)hippyTag onRootTag:(NSNumber *)rootTag {
AssertMainQueue();
return [_viewRegistry componentForTag:hippyTag onRootTag:rootTag];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,13 @@
*/

#import "UIView+MountEvent.h"
#import "objc/runtime.h"
#import "HippyUIManager.h"
#import "UIView+Hippy.h"
#import "UIView+Render.h"
#import "HippyRootView.h"
#import "HippyBridge+PerformanceAPI.h"
#import <objc/runtime.h>


/// The FCP Notification Imp
const NSNotificationName HippyFirstContentfulPaintEndNotification = @"HippyFirstContentfulPaintEndNotification";
Expand Down Expand Up @@ -95,8 +98,10 @@ - (void)viewDidUnmoundEvent {

- (void)sendAttachedToWindowEvent {
if (HippyPaintTypeFCP == self.paintType) {
HippyRootView *rootView = (HippyRootView *)[self hippyRootView];
[rootView sendFCPNotiIfNeeded:self];
NSNumber *rootTag = [self rootTag];
HippyUIManager *uiManager = [self uiManager];
UIView *rootContentView = [uiManager rootContentViewForTag:rootTag];
[(HippyRootView *)rootContentView.superview sendFCPNotiIfNeeded:self];
}
if (self.onAttachedToWindow) {
self.onAttachedToWindow(nil);
Expand Down
Loading