Skip to content
This repository has been archived by the owner on Aug 1, 2019. It is now read-only.

Jerky Animations in iOS 11 when addMessageToMessenger #172

Open
klivin opened this issue Oct 30, 2017 · 9 comments
Open

Jerky Animations in iOS 11 when addMessageToMessenger #172

klivin opened this issue Oct 30, 2017 · 9 comments

Comments

@klivin
Copy link

klivin commented Oct 30, 2017

Using a vanilla MessengerViewController to send messages after I add messages to the point where the screen has to scroll to add the messages, the animations become buggy. I tested with and without software keyboard, and both result in same jerky behavior

See attached video, I slowed down the animations to see the whole effect.

To reproduce test on iPhone 8 or iPhone X and see that the animations no longer work. Any guesses at what changed in iOS 11?

Thank you!

jumpy animations

@klivin
Copy link
Author

klivin commented Oct 30, 2017

I am also noticing ugly jerkiness when the software keyboard becomes active and the messenger view has to scroll. Also when the keyboard is dismissed.

@dodikk
Copy link

dodikk commented Oct 31, 2017

@klivin , sorry, I have no idea yet but I have some animation related issues as well.

A stupid question, but...

  1. Are you doing any networking?
  2. Have you ensured the main thread is clean?
  3. Are you constructing the cells off main thread? You should insert them to NMessenger on main thread, though.

I've managed to improve things a bit when I moved things off main thread. And used batch insertions when possible (multiple messages at a time)

@dodikk
Copy link

dodikk commented Oct 31, 2017

@objc public override func didEnterDisplayState()

P.S. The AsyncDisplayKit cell logs might also help debugging.
https://www.raywenderlich.com/124311/asyncdisplaykit-2-0-tutorial-getting-started

@klivin
Copy link
Author

klivin commented Nov 1, 2017

Thanks for the questions, and I'll look into cell logs to see if I find anything useful.

I have been able to reproduce jumpiness with and without adding cells on networking response. The gif I added shows a networking response appending cells in the same way:

let newMessage = self.createTextMessage(responseText!, isIncomingMessage: true)
self.addMessageToMessenger(newMessage)

All cell construction and insertion is on the main thread. I don't imagine constructing the cell off the main thread would help smooth out the jerky behavior. It seems to be more of a scrolling timing with new content size issue as the whole offset jumps up to previous cell on insertion of a new message cell. Then the table animates down to most of the way below the bottom message, but often times the bottom message is cut off.

Also odd that this behavior is new in iOS 11 as I cannot reproduce the jumpyness in iOS 10 and below.

@klivin
Copy link
Author

klivin commented Nov 1, 2017

I tried:

    func add(text: String, incoming: Bool) {
        DispatchQueue.default.async {
            let newMessage = self.createTextMessage(text, isIncomingMessage: incoming)
            DispatchQueue.main.async {
                self.addMessageToMessenger(newMessage)
            }
        }
    }

And that still has jumpy animations. It's interesting that the cell above the new cell to be added jumps as well, while the rest of the table appears to not move until scroll to index animated is issued.

@artanisdesign
Copy link

Hi Guys, any idea how to fix this?

@alberttai1
Copy link

Any solution to this yet?

@magicmikek
Copy link

No fix yet?

@kkaliher
Copy link

kkaliher commented Jul 3, 2018

i tried updating to Texture 2.3.4 and that somewhat improved things, but there is still occasional table jumping. Trying to update to a more recent Texture (there's been a ton of bug fixes since 2.3.4) but seems each new Texture version introduces new breaking changes with this lib.

Note too, no use asking "no fix yet" as the creators of this lib have evidently left the building.

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

No branches or pull requests

6 participants