MessageViewController icon indicating copy to clipboard operation
MessageViewController copied to clipboard

Scroll view behavior fix

Open jasonaibrahim opened this issue 5 years ago • 3 comments

Current behavior

The scroll view will jump to the middle when a keystroke is received by the keyboard no matter where the scroll view currently is.

Fix

Remove calls to setNeedsLayout to avoid the scroll view from jumping

jasonaibrahim avatar Sep 15 '18 23:09 jasonaibrahim

@jasonaibrahim can you detail this bug a little more? I'm not sure I've seen it before. How do I repro?

rnystrom avatar Sep 22 '18 19:09 rnystrom

@rnystrom sorry for slow replies, been travelling. i will put together a little demo repo in the next few days

jasonaibrahim avatar Oct 02 '18 16:10 jasonaibrahim

Alright I have a demo repo up and able to reproduce.

Reproduce Issue

  1. Clone https://github.com/jasonaibrahim/MessageViewControllerScrollViewBugExample
  2. Pod install
  3. Open MessageViewControllerScrollViewBugExample.xcworkspace
  4. Run in any simulator or physical device
  5. Scroll down to the bottom of the scroll view so that "99" is the last item visible
  6. Tap into message view to open keyboard (make sure keyboard is visible on screen)
  7. Type a letter
  8. See the scroll view jump so now "91" is the last item visible

Fix

  1. rm -rf Pods
  2. open Podfile, change pod to pod 'MessageViewController', :git => 'https://github.com/jasonaibrahim/MessageViewController.git', :branch => 'scroll-view-behavior-fix'
  3. pod install
  4. Run steps 4-7 from above
  5. Scroll view no longer jumps

jasonaibrahim avatar Oct 03 '18 10:10 jasonaibrahim