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

MM-9548 - Scroll to top when iOS status bar is pressed #3736

Merged
merged 1 commit into from
Jan 7, 2020

Conversation

emilioicai
Copy link

@emilioicai emilioicai commented Dec 19, 2019

Summary

React Native ScrollViews (including FlatLists) are flipped upside down when the prop inverted is set to true. This is the root of many bugs one of them affecting PostList: tapping on the status bar in iOS should scroll the Flatlist up to the top.

The solution proposed is to detect natively if the ScrollView is inverted, on such case, prevent it from scrolling it to the beginning of the ScrollView (as a non-inverted ScrollView would do) and force a scroll to the end of it.

I've been careful not to force the scroll if the user explicitly selected not to do it or if it's happening in a nested ScrollView, as it's default in iOS.

Ticket Link

Fixes mattermost/mattermost#13220
Jira Ticket: https://mattermost.atlassian.net/browse/MM-9548

Checklist

  • Has UI changes
  • Includes text changes and localization file updates

Device Information

This PR was tested on: iPhone XS (iOS 13.1.3), iPhone 8 (iOS 13.1.3)

Screenshots

v

@enahum enahum requested review from migbot and enahum December 19, 2019 12:44
@enahum enahum added 2: Dev Review Requires review by a core commiter 2: PM Review Requires review by a product manager 3: QA Review Requires review by a QA tester labels Dec 19, 2019
@enahum enahum added this to the v1.28 milestone Dec 19, 2019
@enahum enahum requested a review from chuttam December 19, 2019 12:55
@emilioicai
Copy link
Author

@chuttam
Copy link

chuttam commented Dec 19, 2019

As a patch, this looks good to me.

The diff for the single react-native+0.61.2.path is getting a bit difficult to tease out individual change sets. It seems like patch-package doesn't have a way to allow manual organizing of the single patch file contents. Should we consider creating a separate patch file for each identifiable thing/feature/bug? We run all patches in make post-install anyway.

Copy link
Contributor

@migbot migbot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@migbot
Copy link
Contributor

migbot commented Dec 19, 2019

As a patch, this looks good to me.

The diff for the single react-native+0.61.2.path is getting a bit difficult to tease out individual change sets. It seems like patch-package doesn't have a way to allow manual organizing of the single patch file contents. Should we consider creating a separate patch file for each identifiable thing/feature/bug? We run all patches in make post-install anyway.

Yep, we could do something like:

{package}+{version}+{short_description}.patch

patch-package will throw a warning but will still apply the patches:

Warning: patch-package detected a patch file version mismatch

  Don't worry! This is probably fine. The patch was still applied
  successfully. Here's the deets:

  Patch file created for

    react-native@0.61.2+test2

  applied to

    react-native@0.61.2
  
  At path
  
    node_modules/react-native

Copy link
Contributor

@enahum enahum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

@enahum enahum removed the 2: Dev Review Requires review by a core commiter label Dec 20, 2019
Copy link
Member

@saturninoabril saturninoabril left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested and looks good to me, thanks @emilioicai!

@saturninoabril saturninoabril added QA Review Done and removed 3: QA Review Requires review by a QA tester labels Dec 20, 2019
@esethna esethna requested review from enahum and removed request for esethna and enahum December 23, 2019 19:21
@mattermod
Copy link
Contributor

This issue has been automatically labelled "stale" because it hasn't had recent activity.
A core team member will check in on the status of the PR to help with questions.
Thank you for your contribution!

/cc @jasonblais @hanzei

@adamjclarkson
Copy link

Ok, have tested on my iPhone X, iOS 13.3. Working great. My one question is about this caveat in original summary:

I've been careful not to force the scroll if the user explicitly selected not to do it or if it's happening in a nested ScrollView, as it's default in iOS.

@emilioicai is there a way for me to test this? How would a user explicitly have this turned off?

@emilioicai
Copy link
Author

@adamjclarkson sorry, by user I meant developer, I sent this PR also to React Native’s repo and copied the description. Developers can disable scrolling to top through a specific parameter.

Copy link

@adamjclarkson adamjclarkson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works perfectly. Thanks @emilioicai

@migbot migbot added 4: Reviews Complete All reviewers have approved the pull request and removed 2: PM Review Requires review by a product manager Lifecycle/1:stale labels Jan 7, 2020
@migbot migbot merged commit 303eee9 into mattermost:master Jan 7, 2020
@migbot
Copy link
Contributor

migbot commented Jan 7, 2020

Thanks @emilioicai!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4: Reviews Complete All reviewers have approved the pull request QA Review Done
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Clicking on the time in the status bar should scroll center channel up
7 participants