diff --git a/lib/ios/RNNReactView.m b/lib/ios/RNNReactView.m index 52296cb9a37..314db7b6893 100644 --- a/lib/ios/RNNReactView.m +++ b/lib/ios/RNNReactView.m @@ -45,6 +45,10 @@ - (void)setAlignment:(NSString *)alignment { self.sizeFlexibility = RCTRootViewSizeFlexibilityNone; } else { self.sizeFlexibility = RCTRootViewSizeFlexibilityWidthAndHeight; + __weak RNNReactView *weakSelf = self; + [self setRootViewDidChangeIntrinsicSize:^(CGSize intrinsicSize) { + [weakSelf setFrame:CGRectMake(0, 0, intrinsicSize.width, intrinsicSize.height)]; + }]; } } diff --git a/lib/ios/RNNViewControllerPresenter.m b/lib/ios/RNNViewControllerPresenter.m index 7d6d8418c75..fa634afe098 100644 --- a/lib/ios/RNNViewControllerPresenter.m +++ b/lib/ios/RNNViewControllerPresenter.m @@ -166,22 +166,9 @@ - (void)setCustomNavigationTitleView:(RNNNavigationOptions *)options perform:(RN if (options.topBar.title.component.name.hasValue) { _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]; - - BOOL isCenter = [alignment isEqualToString:@"center"]; - __weak RNNReactView *weakTitleView = _customTitleView; - CGRect frame = viewController.navigationController.navigationBar.bounds; - [_customTitleView setFrame:frame]; - [_customTitleView setRootViewDidChangeIntrinsicSize:^(CGSize intrinsicContentSize) { - if (isCenter) { - [weakTitleView setFrame:CGRectMake(0, 0, intrinsicContentSize.width, intrinsicContentSize.height)]; - } else { - [weakTitleView setFrame:frame]; - } - }]; - + viewController.navigationItem.titleView = _customTitleView; } else { [_customTitleView removeFromSuperview];