facebookarchive/AsyncDisplayKit

Block is not displaying properly in ASDisplayNode.

vandana26V opened this issue · 0 comments

Hi I am using View(From xib) as a block. If I set the newCellNode.style.width = ASDimensionMake(200) Labels in the first block(Tableview Header) is not displaying.
If I have 3 blocks I want 2nd block to be displayed in center with small preview of 1st and 3rd block.

Code snippet:

var cellNodes = [ASDisplayNode]()
  for i in 0...2 {
    let newCellNode: ASCellNode = ASCellNode(viewBlock: {
      let convHeaderPrevView = ConversationWithPreviewUIView.init().instanceFromNib() as! ConversationWithPreviewTableViewCell
      
      convHeaderPrevView.firstNameLabel?.text = "XYZ"
      convHeaderPrevView.lastNameLabel?.text = "ABCD"
      convHeaderPrevView.countLabel?.text = "1234"
      
      self.headerView = convHeaderPrevView
      
      let conversationView = ConversationalView.init().instanceFromNib() as! ConversationalUITableViewCell

      let uiN: UINib = UINib(nibName: self.cellReuseIdentifier, bundle: nil)
      conversationView.conversationalTableView?.register(uiN, forCellReuseIdentifier: self.cellReuseIdentifier)

      self.documentTableView = conversationView.conversationalTableView
      self.documentTableView.dataSource = self
      self.documentTableView.delegate = self

      self.documentTableView.rowHeight = UITableViewAutomaticDimension
      self.documentTableView.estimatedRowHeight =  50
      self.documentTableView.sectionHeaderHeight = UITableViewAutomaticDimension
      self.documentTableView.estimatedSectionHeaderHeight = 20
      self.documentTableView.sectionFooterHeight = 0

      self.documentTableView.reloadData()
      
      self.msgView = conversationView
      self.msgView?.frame =  self.UITableView_Auto_Height(custmView: self.msgView!)
      conversationView.frame = (self.msgView?.frame)!

      let viewBlock = conversationView
      return viewBlock

    })
    
   newCellNode.style.width = ASDimensionMake(200)
    newCellNode.style.height = ASDimensionMake(225)
    cellNodes.append(newCellNode)
  }
  
  messengerView.addMessage(sendCollectionViewWithNodes(cellNodes, numberOfRows: 1, isIncomingMessage: true), scrollsToMessage: true)

blockwithfixedwidth
blockwithoutfixedwidth
requireduidesign