Skip to content

Autocomplete height reacts but stays blank #36

Open
@Camelot93

Description

@Camelot93

Hello, I know that a similar issue has been raised #7 but it has highlighted a different problem that I am experiencing. When completing it with the prefix "#" the table appears but is blank.
Screen Shot 2022-01-23 at 7 41 07 PM

here are the concerned chunk of code :

class types:

class Chat:MessagesViewController, MessagesDataSource, MessagesLayoutDelegate, MessagesDisplayDelegate,InputBarAccessoryViewDelegate,AutocompleteManagerDataSource, AutocompleteManagerDelegate

autocomplete variable:

    open lazy var autocompleteManager: AutocompleteManager = { [unowned self] in
          let manager = AutocompleteManager(for: self.messageInputBar.inputTextView)
          manager.delegate = self
          manager.dataSource = self
          return manager
      }()

viewdidload for autocomplete:


        autocompleteManager.register(prefix: "#", with: mentionTextAttributes)
        autocompleteManager.maxSpaceCountDuringCompletion = 1

Here are the different methods for autocomplete, all of them are called and we can see what is printed except for one which i guess is the issue:

CALLED:

    func autocompleteManager(_ manager: AutocompleteManager, shouldBecomeVisible: Bool) {
        setAutocompleteManager(active: shouldBecomeVisible)
    }
func setAutocompleteManager(active: Bool) {
            let topStackView = messageInputBar.topStackView
            if active && !topStackView.arrangedSubviews.contains(autocompleteManager.tableView) {
                topStackView.insertArrangedSubview(autocompleteManager.tableView, at: topStackView.arrangedSubviews.count)
                topStackView.layoutIfNeeded()
            } else if !active && topStackView.arrangedSubviews.contains(autocompleteManager.tableView) {
                topStackView.removeArrangedSubview(autocompleteManager.tableView)
                topStackView.layoutIfNeeded()
            }
        messageInputBar.invalidateIntrinsicContentSize()
        }
    
  ```

func autocompleteManager(_ manager: AutocompleteManager, shouldRegister prefix: String, at range: NSRange) -> Bool {
return true
}


NOT CALLED AND ISSUE:

func autocompleteManager(_ manager: AutocompleteManager, tableView: UITableView, cellForRowAt indexPath: IndexPath, for session: AutocompleteSession) -> UITableViewCell {
guard let cell = tableView.dequeueReusableCell(withIdentifier: AutocompleteCell.reuseIdentifier, for: indexPath) as? AutocompleteCell else {
fatalError("None ")
}
let users = Users
let name = session.completion?.text ?? ""
let user = users.filter { return $0.displayName == name }.first
cell.imageView?.image = UIImage(named: "art.scnassets/imp.png")
cell.textLabel?.attributedText = manager.attributedText(matching: session, fontSize: 15)
return cell
}


Can anyone please advise
Thank you

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions