GithubHelp home page GithubHelp logo

Comments (8)

nathantannar4 avatar nathantannar4 commented on May 20, 2024 1

Once it reaches the maxHeight the textview becomes scrollable. Same way the iMessage app works

from messagekit.

hyouuu avatar hyouuu commented on May 20, 2024

1 minor issue I found with the current inputAccessoryView is that, if you return too many times that the textView expands above the screen top, you cannot scroll to the top of the message ;)

from messagekit.

nathantannar4 avatar nathantannar4 commented on May 20, 2024

Yes that is not in the new one I made. There is a maxHeight variable that can be used to correct that

from messagekit.

hyouuu avatar hyouuu commented on May 20, 2024

Cool - or make it scrollable if beyond screen?

from messagekit.

etoledom avatar etoledom commented on May 20, 2024

When the textView grows and reaches maxHeight, after sending the message it doesn't go back to the original size.

from messagekit.

nathantannar4 avatar nathantannar4 commented on May 20, 2024

Good catch @etoledom . I have isolated the bug to changing the UITextView.isScrollEnabled: Bool property. For some reason it doesn't let the view resize, possibly due to the auto layout constraints? I am not sure.

This can be corrected by forcing a temp heightAnchor on the InputTextView.

Set the property in setupConstraints(): textViewLayoutSet?.height = textView.heightAnchor.constraint(equalToConstant: 36)
And modify textViewDidChange() to include: textViewLayoutSet?.height?.isActive = textView.text.isEmpty

from messagekit.

nathantannar4 avatar nathantannar4 commented on May 20, 2024

Never mind that has bugs, call textView.invalidateIntrinsicContentSize() in

override open var intrinsicContentSize: CGSize {
        let sizeToFit = textView.sizeThatFits(CGSize(width: textView.bounds.width, height: .greatestFiniteMagnitude))
        var heightToFit = sizeToFit.height.rounded() + padding.top + padding.bottom + separatorLine.frame.height + tableViewHeightConstant
        if heightToFit >= maxHeight {
            textView.isScrollEnabled = true
            heightToFit = maxHeight
        } else {
            textView.isScrollEnabled = false
            textView.invalidateIntrinsicContentSize()
        }
        let size = CGSize(width: bounds.width, height: heightToFit)
        if previousIntrinsicContentSize != size {
            delegate?.inputBar(self, didChangeIntrinsicContentTo: size)
        }
        previousIntrinsicContentSize = size
        return size
    }

from messagekit.

SD10 avatar SD10 commented on May 20, 2024

Closing this as it is being implemented in #80 👍 Great work @nathantannar4 🎉

from messagekit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.