{"action":"created","issue":{"url":"https://api.github.com/repos/wix/react-native-navigation/issues/4188","repository_url":"https://api.github.com/repos/wix/react-native-navigation","labels_url":"https://api.github.com/repos/wix/react-native-navigation/issues/4188/labels{/name}","comments_url":"https://api.github.com/repos/wix/react-native-navigation/issues/4188/comments","events_url":"https://api.github.com/repos/wix/react-native-navigation/issues/4188/events","html_url":"https://github.com/wix/react-native-navigation/pull/4188","id":372503245,"node_id":"MDExOlB1bGxSZXF1ZXN0MjI0NjY3MTA5","number":4188,"title":"[V2] topBar title options not applied when also using subtitle","user":{"login":"rgoldiez","id":10797610,"node_id":"MDQ6VXNlcjEwNzk3NjEw","avatar_url":"https://avatars3.githubusercontent.com/u/10797610?v=4","gravatar_id":"","url":"https://api.github.com/users/rgoldiez","html_url":"https://github.com/rgoldiez","followers_url":"https://api.github.com/users/rgoldiez/followers","following_url":"https://api.github.com/users/rgoldiez/following{/other_user}","gists_url":"https://api.github.com/users/rgoldiez/gists{/gist_id}","starred_url":"https://api.github.com/users/rgoldiez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rgoldiez/subscriptions","organizations_url":"https://api.github.com/users/rgoldiez/orgs","repos_url":"https://api.github.com/users/rgoldiez/repos","events_url":"https://api.github.com/users/rgoldiez/events{/privacy}","received_events_url":"https://api.github.com/users/rgoldiez/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-10-22T12:38:20Z","updated_at":"2018-11-09T14:10:23Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/wix/react-native-navigation/pulls/4188","html_url":"https://github.com/wix/react-native-navigation/pull/4188","diff_url":"https://github.com/wix/react-native-navigation/pull/4188.diff","patch_url":"https://github.com/wix/react-native-navigation/pull/4188.patch"},"body":""},"comment":{"url":"https://api.github.com/repos/wix/react-native-navigation/issues/comments/437370313","html_url":"https://github.com/wix/react-native-navigation/pull/4188#issuecomment-437370313","issue_url":"https://api.github.com/repos/wix/react-native-navigation/issues/4188","id":437370313,"node_id":"MDEyOklzc3VlQ29tbWVudDQzNzM3MDMxMw==","user":{"login":"pkyeck","id":870980,"node_id":"MDQ6VXNlcjg3MDk4MA==","avatar_url":"https://avatars0.githubusercontent.com/u/870980?v=4","gravatar_id":"","url":"https://api.github.com/users/pkyeck","html_url":"https://github.com/pkyeck","followers_url":"https://api.github.com/users/pkyeck/followers","following_url":"https://api.github.com/users/pkyeck/following{/other_user}","gists_url":"https://api.github.com/users/pkyeck/gists{/gist_id}","starred_url":"https://api.github.com/users/pkyeck/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pkyeck/subscriptions","organizations_url":"https://api.github.com/users/pkyeck/orgs","repos_url":"https://api.github.com/users/pkyeck/repos","events_url":"https://api.github.com/users/pkyeck/events{/privacy}","received_events_url":"https://api.github.com/users/pkyeck/received_events","type":"User","site_admin":false},"created_at":"2018-11-09T14:10:23Z","updated_at":"2018-11-09T14:10:23Z","author_association":"NONE","body":"Had the same problem - but for me it had nothing to do with the subtitle. Was happening with or without subtitle. The `RNNTitleOptions.fontAttributes` was null.\r\n\r\nBut just looking at the two methods (`setupTitle` and `setupSubtitle`) lets me wonder why setting up the label is done so differently in both of them ...?\r\n\r\nCleaning everything up a bit lead to this:\r\n\r\n```\r\n-(UILabel*)setupTitle {\r\n\tCGRect titleFrame = self.titleView.frame;\r\n\tif (self.subtitle) {\r\n\t\ttitleFrame.size.height /= 2;\r\n\t}\r\n\tUILabel *titleLabel = [[UILabel alloc] initWithFrame:titleFrame];\r\n\ttitleLabel.textAlignment = NSTextAlignmentCenter;\r\n\ttitleLabel.backgroundColor = [UIColor clearColor];\r\n\ttitleLabel.autoresizingMask = self.titleView.autoresizingMask;\r\n\t\r\n\tNSDictionary* fontAttributes = [RNNFontAttributesCreator createFontAttributesWithFontFamily:[_titleOptions.fontFamily getWithDefaultValue:nil] fontSize:[_titleOptions.fontSize getWithDefaultValue:nil] color:[_titleOptions.color getWithDefaultValue:nil]];\r\n\t\r\n\t[titleLabel setAttributedText:[[NSAttributedString alloc] initWithString:self.title attributes:fontAttributes]];\r\n\t\r\n\tCGSize labelSize = [titleLabel.text sizeWithAttributes:fontAttributes];\r\n\tCGRect labelframe = titleLabel.frame;\r\n\tlabelframe.size = labelSize;\r\n\ttitleLabel.frame = labelframe;\r\n\t\r\n\tif (!self.subtitle) {\r\n\t\ttitleLabel.center = self.titleView.center;\r\n\t}\r\n\t\r\n\t[titleLabel sizeToFit];\r\n\t[self.titleView addSubview:titleLabel];\r\n\t\r\n\treturn titleLabel;\r\n}\r\n```\r\n\r\nWhere the `setupSubtitle` one looked almost identical.\r\n\r\nAnd while we're at it, also remove the `@property (nonatomic, strong) NSDictionary* fontAttributes;` from `RNNTitleOptions.h` - it's never used and lead to this bug in the first place."}}
{"actor":{"display_login":"pkyeck"}}