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

Fix Page Animations #2956

Merged
merged 3 commits into from
May 28, 2021
Merged

Fix Page Animations #2956

merged 3 commits into from
May 28, 2021

Conversation

parasharrajat
Copy link
Member

@parasharrajat parasharrajat commented May 16, 2021

Please review.

Details

Details can be read #2335 (comment)

Fixed Issues

Fixes #2335

Tests / QA Steps

  1. Click the search icon to open the Search Modal.
  2. Open all the available models from the FAB button.
  3. Open the User Details / Group participants modal.
  4. Open the User Settings Modal.
  5. For all the modals enter and exit animation should be smooth and consistent.

Tested On

  • Web
  • Mobile Web
  • Desktop
  • iOS
  • Android

Screenshots

Web

animation.mp4

Mobile Web

animation-mWeb.mp4

Desktop

animation-des.mp4

iOS

Not able to record it as I have MAC VM but the animation on IOS works smoothly.

Android

1620411237903.mp4

@parasharrajat
Copy link
Member Author

@marcaaron I finally get the chance to look at it. But it seems transitionEnd is only affecting our codebase. I created a snack here https://snack.expo.io/@rajat_parashar/reactnav5-stack-navigator. but It seems to work fine. Check the Settings page.
Next step would be to break our navigation and then try to find the core issue.

@marcaaron
Copy link
Contributor

But it seems transitionEnd is only affecting our codebase?

Can you elaborate on this some more? The snack you shared doesn't use the drawer navigator, doesn't have animations enabled, etc. So I'm not getting what it proves. Thanks!

@parasharrajat
Copy link
Member Author

Oh, Yeah. I checked somewhere the issue is linked with StackNavigator. but let me try to completely mimic the code first and grab more intel on it. 🕵️

@parasharrajat
Copy link
Member Author

@marcaaron I have not found any strong reason why its not working on IOS. But it seems this could be it software-mansion/react-native-screens#713.

I have another solution here. We can use InteractionManager for the Native devices. I have gone through the codebase and it works as expected with transitionEnd for our case.

In short, InteractionManager for native devices and transitionEnd for Web,desktop,m-web.

Please let me know, what should be the best away forward here. Thanks.

@marcaaron
Copy link
Contributor

Ok. That seems fine to me, but it would be nice if we can avoid creating two separate ScreenWrapper components - maybe we can create something like this...

.
└── libs/
    └── onScreenTransition/
        ├── index.js
        └── index.ios.js
this.unsubscribeScreenTransitionHandler = onScreenTransition(navigation, this.callback);

componentWillUnmount() {
    this.unsubscribeScreenTransitionHandler();
}

I think if we go this route we should also create a new issue to track this open issue so we can clean up the exception made for iOS.

@parasharrajat
Copy link
Member Author

parasharrajat commented May 27, 2021

Yeah, I was planning to create a common event listener instead of ScreenWrapper. Thanks for directions.
I will create the follow up issue as well

@parasharrajat parasharrajat changed the title [WIP] Fix Page Animations Fix Page Animations May 27, 2021
@parasharrajat parasharrajat marked this pull request as ready for review May 28, 2021 17:06
@parasharrajat parasharrajat requested a review from a team as a code owner May 28, 2021 17:06
@MelvinBot MelvinBot requested review from ctkochan22 and removed request for a team May 28, 2021 17:06
@ctkochan22 ctkochan22 merged commit bbbefbf into Expensify:main May 28, 2021
@OSBotify
Copy link
Contributor

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

Copy link
Contributor

@marcaaron marcaaron left a comment

Choose a reason for hiding this comment

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

Just leaving a couple follow up comments.

navigation: PropTypes.shape({
/** Returns to the previous navigation state e.g. if this is inside a Modal we will dismiss it */
// Method to attach listner to Navigaton state.
Copy link
Contributor

Choose a reason for hiding this comment

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

listener to Navigation state.

* @returns {Function}
*/
function onScreenTransitionEnd(navigation, callback) {
return navigation.addListener('transitionEnd', evt => Str.result(callback, evt));
Copy link
Contributor

Choose a reason for hiding this comment

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

Why Str.result() vs navigation.addListener('transitionEnd', callback) ?

Copy link
Member Author

Choose a reason for hiding this comment

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

Just to skip the test if callback is present. But yeah we can jus pass the callback directly.

Copy link
Member Author

Choose a reason for hiding this comment

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

I will add these in a new PR.

Copy link
Member Author

Choose a reason for hiding this comment

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

dropped a PR #3228. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Modal animation is inconsistent
4 participants