Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When messages list is presented in a default modal, scrolling up triggers unexpected animation #1307

Closed
MatejBalantic opened this issue Jul 22, 2021 · 9 comments
Assignees
Labels
🐞 Bug An issue or PR related to a bug

Comments

@MatejBalantic
Copy link

MatejBalantic commented Jul 22, 2021

What did you do?

Opened a message list presented in a standard modal view, then scrolled up.

What did you expect to happen?

Table view to scroll up, or alternatively nothing.

What happened instead?

The entire modal view started interactively shrinking as seen in this video. When watching the video note that I am moving my finger UP, not DOWN as it might feel from watching the video.

GetStream Environment

GetStream Chat version:
4.0.0-beta8

Additional context

This appears to be caused by a hack in ChatMessageListView that sets transform = .mirrorY

@tbarbugli tbarbugli added the 🐞 Bug An issue or PR related to a bug label Jul 22, 2021
@tbarbugli
Copy link
Member

Thank you for reporting this and for attaching the video, that helps a lot.

@b-onc
Copy link
Contributor

b-onc commented Aug 11, 2021

Hello @MatejBalantic ,

We're able to reproduce and currently working on a fix.

@nuno-vieira
Copy link
Member

Hi @MatejBalantic this issue has been fixed and it is available already in the main branch, and it will be available on the next release. Thanks for the report!

@Lascorbe
Copy link

@nuno-vieira We've tried the fix. Now the view doesn't dismiss, but it is a default behaviour from iOS we want to have. Also the view still gets shrink (moved down while moving your finger up) as if it is going to be dismissed.

@nuno-vieira
Copy link
Member

Hi @Lascorbe ! Yes, the solution to the problem is discussed here in this PR: #1364. If your view has only a message list, you won't be able to dismiss it with a gesture, only through another view besides the message list (example: NavigationBar). This is a flaw with the current approach of using a mirrored table view, which we plan on refactoring in the near future, btw. Trying to fight the default behaviour from Apple and override the animations provided by Apple will only make it worse, but we are going to discuss internally with the team if we can get a better solution in the short term besides refactoring to a UICollectionView (which is the right thing to do). If this is a blocker for you in the short team, one suggestion could be overriding the presentation of the modal and provide your own. This would require subclassing ChatMessageListVC and provide your own UIViewControllerAnimatedTransitioning. Most likely this will also be our short term solution (With the con that will always be slightly different than the default Apple's animations)

Will re-open the issue 👍

@nuno-vieira nuno-vieira reopened this Aug 17, 2021
@Lascorbe
Copy link

@nuno-vieira thank you. We'll probably end up presenting this view as part of the navigation stack, but we're looking forward to the refactor nonetheless 😀

@tbarbugli
Copy link
Member

@Lascorbe closing this for now but please reopen if you are still blocked. In the meantime we updated our docs for the SDK: https://getstream.io/chat/docs/sdk/ios/

@bradleyrzeller
Copy link

Is there any update on this? We are presenting a ChatChannelVC in a system modal. As was described above in previous comments, the "fix" prevents the modal from actually being dismissed while dragging on the list view however, the entire modal is still being scrolled down while the user gestures up.

I'd like to avoid rolling my own system modal transition "replica." Are there any other workarounds known at this time?
Thanks!

@nuno-vieira
Copy link
Member

Hi @MatejBalantic! @bradleyrzeller @Lascorbe !

This is now supported on the new 4.10.0 release, in order to fix this you need to use our custom translation delegate. Like this:

// Make sure to have a reference to the delegate or it will be instantly deallocated.
let streamModalTransitioningDelegate = StreamModalTransitioningDelegate()

func showChannelVC() {
    let vc = ChatChannelVC()
    vc.channelController = client.channelController(for: cid)
    let navVC = UINavigationController(rootViewController: vc)
    navVC.transitioningDelegate = streamModalTransitioningDelegate
    navVC.modalPresentationStyle = .custom
    navigationController?.present(navVC, animated: true, completion: nil)
}

For more details, you can check the release changelog here: https://github.com/GetStream/stream-chat-swift/releases/tag/4.10.0

Let us know if you have any questions!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 Bug An issue or PR related to a bug
Projects
None yet
Development

No branches or pull requests

7 participants