Giter VIP home page Giter VIP logo

Comments (5)

wtmoose avatar wtmoose commented on June 5, 2024

I'm super busy, but I will do my best to take a look at this soon. It is a fairly obscure feature, so I wouldn't be surprised if it has some rough edges.

from swiftmessages.

wtmoose avatar wtmoose commented on June 5, 2024

I took a look and found a couple of issues:

First, KeyboardTrackingView is based on notifications. If you create a new one after the keyboard has already appeared, it won't know the current state of the keyboard. This was designed before keyboard layout margins existed :(

I have a slightly modified version of KeyboardTrackingView that works if you hold onto it in your view controller and reuse the same instance with each message view. However, there is still a small issue related to safe area. All of the nib files provided with SwiftMessages rely on the layoutMargins property to position the content. When you show a message, the appropriate layout margins are calculated based on the safe area. This can cause problems when combined with the keyboard tracking behavior:

  1. If the message is displayed before the keyboard appears, the bottom margin is too big after the keyboard pushes it up.
  2. If the message is displayed before the keyboard appears, the bottom margin is too small if the keyboard is dismissed, leaving the message view in the safe area.

Again, this stuff was designed before safe area existed :(

I'm not going to have time to rework the layout system for this particular issue. However, if you're willing to use your own view that internally constrains the content to bottom safe area, rather than one of the bundled nib files, I think my updated KeyboardTrackingView will probably work for you.

Let me know what you think.

from swiftmessages.

jmarr avatar jmarr commented on June 5, 2024

Awesome, thanks for looking into this. I saw you made some changes in 9.0.9, so I'll play around with that and creating our own view and let you know how it goes.

from swiftmessages.

wtmoose avatar wtmoose commented on June 5, 2024

The idea with the updated KeyboardTrackingView is that your view controller needs to create and hold onto a single instance and use that instance for each message. That way it retains the memory of the state of the keyboard. For the view, you need to set it up such that it uses Auto Layout to avoid the safe area rather than having SwiftMessages calculate the margins. I can help out with that if you get stuck.

from swiftmessages.

jmarr avatar jmarr commented on June 5, 2024

Great! I've installed a KeyboardTrackingView in my view controller and modified a copy of the CardView nib to constrain the bottom of the corner rounding view to the bottom safe area (minus an 8pt margin) and that seems to be working well. Thanks so much!

from swiftmessages.

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.