Skip to content

Commit

Permalink
Fix for Scroll Animation
Browse files Browse the repository at this point in the history
  • Loading branch information
Deepak committed Nov 27, 2014
1 parent 8f28bc5 commit fd7f27b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,14 @@
*/
@property (assign, nonatomic) BOOL automaticallyScrollsToMostRecentMessage;

/**
* A boolean flag to disable the animation while scrolling to the latest message on entering the view
* and later reset to allow scroll animation.
*
*/

@property (assign, nonatomic) BOOL disableScrollToBottomAnimationOnEntry;

/**
* The collection view cell identifier to use for dequeuing outgoing message collection view cells
* in the collectionView for text messages.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ - (void)jsq_configureMessagesViewController

self.automaticallyScrollsToMostRecentMessage = YES;

self.disableScrollToBottomAnimationOnEntry=YES;

self.outgoingCellIdentifier = [JSQMessagesCollectionViewCellOutgoing cellReuseIdentifier];
self.outgoingMediaCellIdentifier = [JSQMessagesCollectionViewCellOutgoing mediaCellReuseIdentifier];

Expand Down Expand Up @@ -337,7 +339,14 @@ - (void)finishReceivingMessage
[self.collectionView reloadData];

if (self.automaticallyScrollsToMostRecentMessage && ![self jsq_isMenuVisible]) {
[self scrollToBottomAnimated:YES];
if(self.disableScrollToBottomAnimationOnEntry){
[self scrollToBottomAnimated:NO];
self.disableScrollToBottomAnimationOnEntry=NO;
}
else{
[self scrollToBottomAnimated:YES];
}

}
}

Expand Down

0 comments on commit fd7f27b

Please sign in to comment.