MessageViewController
MessageViewController copied to clipboard
Scroll view behavior fix
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 can you detail this bug a little more? I'm not sure I've seen it before. How do I repro?
@rnystrom sorry for slow replies, been travelling. i will put together a little demo repo in the next few days
Alright I have a demo repo up and able to reproduce.
Reproduce Issue
- Clone https://github.com/jasonaibrahim/MessageViewControllerScrollViewBugExample
- Pod install
- Open MessageViewControllerScrollViewBugExample.xcworkspace
- Run in any simulator or physical device
- Scroll down to the bottom of the scroll view so that "99" is the last item visible
- Tap into message view to open keyboard (make sure keyboard is visible on screen)
- Type a letter
- See the scroll view jump so now "91" is the last item visible
Fix
-
rm -rf Pods
- open Podfile, change pod to
pod 'MessageViewController', :git => 'https://github.com/jasonaibrahim/MessageViewController.git', :branch => 'scroll-view-behavior-fix'
-
pod install
- Run steps 4-7 from above
- Scroll view no longer jumps