{"action":"created","issue":{"url":"https://api.github.com/repos/facebook/AsyncDisplayKit/issues/2677","repository_url":"https://api.github.com/repos/facebook/AsyncDisplayKit","labels_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/issues/2677/labels{/name}","comments_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/issues/2677/comments","events_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/issues/2677/events","html_url":"https://github.com/facebook/AsyncDisplayKit/issues/2677","id":192211177,"number":2677,"title":"[ASTextNode] Center-aligned text not rendering correctly ","user":{"login":"GitGadd","id":3338062,"avatar_url":"https://avatars.githubusercontent.com/u/3338062?v=3","gravatar_id":"","url":"https://api.github.com/users/GitGadd","html_url":"https://github.com/GitGadd","followers_url":"https://api.github.com/users/GitGadd/followers","following_url":"https://api.github.com/users/GitGadd/following{/other_user}","gists_url":"https://api.github.com/users/GitGadd/gists{/gist_id}","starred_url":"https://api.github.com/users/GitGadd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GitGadd/subscriptions","organizations_url":"https://api.github.com/users/GitGadd/orgs","repos_url":"https://api.github.com/users/GitGadd/repos","events_url":"https://api.github.com/users/GitGadd/events{/privacy}","received_events_url":"https://api.github.com/users/GitGadd/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/facebook/AsyncDisplayKit/milestones/22","html_url":"https://github.com/facebook/AsyncDisplayKit/milestones/2.0.1","labels_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/milestones/22/labels","id":2132538,"number":22,"title":"2.0.1","description":"","creator":{"login":"hannahmbanana","id":3419380,"avatar_url":"https://avatars.githubusercontent.com/u/3419380?v=3","gravatar_id":"","url":"https://api.github.com/users/hannahmbanana","html_url":"https://github.com/hannahmbanana","followers_url":"https://api.github.com/users/hannahmbanana/followers","following_url":"https://api.github.com/users/hannahmbanana/following{/other_user}","gists_url":"https://api.github.com/users/hannahmbanana/gists{/gist_id}","starred_url":"https://api.github.com/users/hannahmbanana/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hannahmbanana/subscriptions","organizations_url":"https://api.github.com/users/hannahmbanana/orgs","repos_url":"https://api.github.com/users/hannahmbanana/repos","events_url":"https://api.github.com/users/hannahmbanana/events{/privacy}","received_events_url":"https://api.github.com/users/hannahmbanana/received_events","type":"User","site_admin":false},"open_issues":37,"closed_issues":2,"state":"open","created_at":"2016-11-14T04:32:37Z","updated_at":"2016-12-03T23:52:49Z","due_on":null,"closed_at":null},"comments":9,"created_at":"2016-11-29T07:51:52Z","updated_at":"2016-12-05T01:03:09Z","closed_at":null,"body":"After updating from 2.0-beta.1 to 2.0-beta.2, center-aligned text in our custom alerts is rendering incorrectly. Note that using 'left' text alignment and taking the same screenshot looks OK.\r\n\r\nUpdate: Manually setting the style.width of each ASTextNode to the expected width seems to fix it as a work-around, but would obviously break down if the constrained width was a range.\r\n\r\nScreenshot of issue:\r\n\r\n![screen shot 2016-11-29 at 08 41 08](https://cloud.githubusercontent.com/assets/3338062/20700785/a0160550-b60f-11e6-98cc-2048a8ed013c.png)\r\n\r\nAttributed text creation:\r\n```\r\ntitleAttributes[NSParagraphStyleAttributeName] = {\r\n    let para = NSMutableParagraphStyle()\r\n    para.alignment = .center\r\n    return para\r\n}()\r\ntitleNode.attributedText = NSAttributedString(string: title, attributes: titleAttributes)\r\n```\r\n\r\nLayout:\r\n```\r\nfileprivate override func layoutSpecThatFits(_ constrainedSize: ASSizeRange) -> ASLayoutSpec {\r\n\t\tvar children = [titleNode]\r\n\t\tif let messageNode=messageNode {\r\n\t\t\tchildren.append(messageNode)\r\n\t\t}\r\n\t\treturn ASBackgroundLayoutSpec(\r\n\t\t\tchild: ASInsetLayoutSpec(\r\n\t\t\t\tinsets: UIEdgeInsets(horizontal: AXTheme.defaultMargin*2, vertical: AXTheme.defaultMargin*3),\r\n\t\t\t\tchild: ASStackLayoutSpec(direction: .vertical,\r\n\t\t\t\t\tspacing: AXTheme.defaultMargin,\r\n\t\t\t\t\tjustifyContent: .start,\r\n\t\t\t\t\talignItems: .center,\r\n\t\t\t\t\tchildren: children)),\r\n\t\t\tbackground: backgroundImageNode)\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/facebook/AsyncDisplayKit/issues/comments/264746699","html_url":"https://github.com/facebook/AsyncDisplayKit/issues/2677#issuecomment-264746699","issue_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/issues/2677","id":264746699,"user":{"login":"rewandy","id":4761768,"avatar_url":"https://avatars.githubusercontent.com/u/4761768?v=3","gravatar_id":"","url":"https://api.github.com/users/rewandy","html_url":"https://github.com/rewandy","followers_url":"https://api.github.com/users/rewandy/followers","following_url":"https://api.github.com/users/rewandy/following{/other_user}","gists_url":"https://api.github.com/users/rewandy/gists{/gist_id}","starred_url":"https://api.github.com/users/rewandy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rewandy/subscriptions","organizations_url":"https://api.github.com/users/rewandy/orgs","repos_url":"https://api.github.com/users/rewandy/repos","events_url":"https://api.github.com/users/rewandy/events{/privacy}","received_events_url":"https://api.github.com/users/rewandy/received_events","type":"User","site_admin":false},"created_at":"2016-12-05T01:03:09Z","updated_at":"2016-12-05T01:03:09Z","body":"I am encountering the same issue with center-aligned `ASTextNode`s that have been sized with `flexBasis`. The final frame of my text nodes is correct, but the text is not being centered within them.\r\n\r\n#### Before\r\n\r\n<img width=\"371\" alt=\"screen shot 2016-12-04 at 4 58 35 pm\" src=\"https://cloud.githubusercontent.com/assets/4761768/20870800/02f8b302-ba43-11e6-851d-4f2048b10a57.png\">\r\n\r\n#### After\r\n\r\n<img width=\"372\" alt=\"screen shot 2016-12-04 at 4 51 56 pm\" src=\"https://cloud.githubusercontent.com/assets/4761768/20870804/0c6339c6-ba43-11e6-88b3-22751e21250d.png\">\r\n\r\n<hr>\r\n\r\nI need to use `flexBasis` so I can tell each \"box\" to take up `25%` of the available space horizontally. Like I said, the boxes **are** sized correctly, it's just that the `ASTextNode`s are not rendering their text as expected.\r\n\r\nThis appears to have regressed sometime between 4d16d5840735cf0a06a258bcb4ce4f0c714e593f and 2.0 rc1."}}
{"actor":{"display_login":"rewandy"}}