From 9646c5cb3c40ef29be4bdbf39775ccfaddd8e489 Mon Sep 17 00:00:00 2001 From: Valentin Shergin Date: Tue, 8 May 2018 18:50:05 -0700 Subject: [PATCH] Fabric: RCTViewComponentView, storing just applied `layoutMetrics` Summary: This will be useful for this class and for subclasses soon. For instance, when we draw something in `drawRect:`, we need to know exact content frame for rendering. Reviewed By: mdvacca Differential Revision: D7751855 fbshipit-source-id: 5d688368edd7b4f3c8c19d54ca701a9cc361270b --- React/Fabric/Mounting/RCTViewComponentView.h | 6 +++++- React/Fabric/Mounting/RCTViewComponentView.mm | 8 ++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/React/Fabric/Mounting/RCTViewComponentView.h b/React/Fabric/Mounting/RCTViewComponentView.h index 046030a8f..8dc5fc2e1 100644 --- a/React/Fabric/Mounting/RCTViewComponentView.h +++ b/React/Fabric/Mounting/RCTViewComponentView.h @@ -9,13 +9,17 @@ #import #import +#import NS_ASSUME_NONNULL_BEGIN /** * UIView class for component. */ -@interface RCTViewComponentView : UIView +@interface RCTViewComponentView : UIView { +@protected + facebook::react::LayoutMetrics _layoutMetrics; +} @end diff --git a/React/Fabric/Mounting/RCTViewComponentView.mm b/React/Fabric/Mounting/RCTViewComponentView.mm index 24a985949..cc3c0772b 100644 --- a/React/Fabric/Mounting/RCTViewComponentView.mm +++ b/React/Fabric/Mounting/RCTViewComponentView.mm @@ -30,4 +30,12 @@ using namespace facebook::react; // TODO: Implement all sutable non-layout props. } +- (void)updateLayoutMetrics:(LayoutMetrics)layoutMetrics + oldLayoutMetrics:(LayoutMetrics)oldLayoutMetrics +{ + [super updateLayoutMetrics:layoutMetrics oldLayoutMetrics:oldLayoutMetrics]; + + _layoutMetrics = layoutMetrics; +} + @end