Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autocomplete height reacts but stays blank #36

Open
Camelot93 opened this issue Jan 24, 2022 · 0 comments
Open

Autocomplete height reacts but stays blank #36

Camelot93 opened this issue Jan 24, 2022 · 0 comments

Comments

@Camelot93
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant