Просмотр исходного кода

This fixes an issue with a custom title-view (which has a title and a subtitle) appearing at the left side of the nav-bar instead of the center during a transition animation: when a screen with this title-view is being pushed or when you pop back to it. (#2384)

This happens because the title-view is being created again when RVVViewController appears. There's probably no point in setting the title-view again with the same data when it already has it. The title view setup is done anyway in RCCNavigationController.

This can be easily reproduced by calling "this.props.navigator.setSubTitle({subtitle: 'a subtitle'});" from the constructor of a pushed screen.
Artal Druk 6 лет назад
Родитель
Сommit
3f7f6c2612
1 измененных файлов: 0 добавлений и 7 удалений
  1. 0
    7
      ios/RCCViewController.m

+ 0
- 7
ios/RCCViewController.m Просмотреть файл

@@ -381,13 +381,6 @@ const NSInteger TRANSPARENT_NAVBAR_TAG = 78264803;
381 381
   NSMutableDictionary *titleTextAttributes = [RCTHelpers textAttributesFromDictionary:self.navigatorStyle withPrefix:@"navBarText" baseFont:[UIFont boldSystemFontOfSize:17]];
382 382
   [self.navigationController.navigationBar setTitleTextAttributes:titleTextAttributes];
383 383
   
384
-  if (self.navigationItem.titleView && [self.navigationItem.titleView isKindOfClass:[RCCTitleView class]]) {
385
-    
386
-    RCCTitleView *titleView = (RCCTitleView *)self.navigationItem.titleView;
387
-    RCCTitleViewHelper *helper = [[RCCTitleViewHelper alloc] init:viewController navigationController:viewController.navigationController title:titleView.titleLabel.text subtitle:titleView.subtitleLabel.text titleImageData:nil isSetSubtitle:NO];
388
-    [helper setup:self.navigatorStyle];
389
-  }
390
-  
391 384
   NSMutableDictionary *navButtonTextAttributes = [RCTHelpers textAttributesFromDictionary:self.navigatorStyle withPrefix:@"navBarButton"];
392 385
   NSMutableDictionary *leftNavButtonTextAttributes = [RCTHelpers textAttributesFromDictionary:self.navigatorStyle withPrefix:@"navBarLeftButton"];
393 386
   NSMutableDictionary *rightNavButtonTextAttributes = [RCTHelpers textAttributesFromDictionary:self.navigatorStyle withPrefix:@"navBarRightButton"];