From 9f439dabd8fabc151bb96fbb04fa34bfe2b469d8 Mon Sep 17 00:00:00 2001 From: Yogev Ben David Date: Tue, 30 Apr 2019 14:37:08 +0300 Subject: [PATCH] Fix topBar.title.component fill alignment (#5044) * Fix topBar.title.component fill alignment * Lock react-native-ui-lib version --- lib/ios/RNNReactView.h | 2 +- lib/ios/RNNReactView.m | 3 ++- lib/ios/RNNViewControllerPresenter.m | 2 +- package.json | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/ios/RNNReactView.h b/lib/ios/RNNReactView.h index 3dc4f00f1cf..fbd8b35b18f 100644 --- a/lib/ios/RNNReactView.h +++ b/lib/ios/RNNReactView.h @@ -10,6 +10,6 @@ typedef void (^RNNReactViewReadyCompletionBlock)(void); @property (nonatomic, copy) void (^rootViewDidChangeIntrinsicSize)(CGSize intrinsicSize); @property (nonatomic, copy) RNNReactViewReadyCompletionBlock reactViewReadyBlock; -- (void)setAlignment:(NSString *)alignment; +- (void)setAlignment:(NSString *)alignment inFrame:(CGRect)frame; @end diff --git a/lib/ios/RNNReactView.m b/lib/ios/RNNReactView.m index 314db7b6893..a6ed5802057 100644 --- a/lib/ios/RNNReactView.m +++ b/lib/ios/RNNReactView.m @@ -40,9 +40,10 @@ - (void)rootViewDidChangeIntrinsicSize:(RCTRootView *)rootView { } } -- (void)setAlignment:(NSString *)alignment { +- (void)setAlignment:(NSString *)alignment inFrame:(CGRect)frame { if ([alignment isEqualToString:@"fill"]) { self.sizeFlexibility = RCTRootViewSizeFlexibilityNone; + [self setFrame:frame]; } else { self.sizeFlexibility = RCTRootViewSizeFlexibilityWidthAndHeight; __weak RNNReactView *weakSelf = self; diff --git a/lib/ios/RNNViewControllerPresenter.m b/lib/ios/RNNViewControllerPresenter.m index 1f2ffec1e06..fe7f87a3640 100644 --- a/lib/ios/RNNViewControllerPresenter.m +++ b/lib/ios/RNNViewControllerPresenter.m @@ -167,7 +167,7 @@ - (void)setCustomNavigationTitleView:(RNNNavigationOptions *)options perform:(RN _customTitleView = (RNNReactView*)[_componentRegistry createComponentIfNotExists:options.topBar.title.component parentComponentId:viewController.layoutInfo.componentId reactViewReadyBlock:readyBlock]; _customTitleView.backgroundColor = UIColor.clearColor; NSString* alignment = [options.topBar.title.component.alignment getWithDefaultValue:@""]; - [_customTitleView setAlignment:alignment]; + [_customTitleView setAlignment:alignment inFrame:viewController.navigationController.navigationBar.frame]; viewController.navigationItem.titleView = nil; viewController.navigationItem.titleView = _customTitleView; diff --git a/package.json b/package.json index 0477bbc61db..966494c1906 100644 --- a/package.json +++ b/package.json @@ -61,7 +61,7 @@ "@types/react-test-renderer": "16.x.x", "jsc-android": "236355.x.x", "detox": "12.1.x", - "react-native-ui-lib": "3.x.x", + "react-native-ui-lib": "3.24.2", "handlebars": "4.x.x", "jest": "23.x.x", "metro-react-native-babel-preset": "0.50.0",