Skip to content

Infra/animated image improvements #2157

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

Merged
merged 4 commits into from
Aug 1, 2022

Conversation

M-i-k-e-l
Copy link
Collaborator

Description

AnimatedImage:

  1. Move from a js class to a tsx function
  2. Revert functionality to pre Trying to fix 1735 #2079 while keeping the "fix" (using reanimated entering).
  3. I believe this also fixes a bug in the pre Trying to fix 1735 #2079 which did not show the loader.
  4. This improves load time from what I've tested (relates to Avatar - WOAUILIB-2913).

Note: this unfortunately may remove the history from this file, an option is to change to a tsx (while breaking master's npm run build:dev) and only then merging this.

Changelog

AnimatedImage - fix functionality and improve performance

import View from '../../components/view';
import Image, {ImageProps} from '../../components/image';

const UIAnimatedImage = Animated.createAnimatedComponent<ImageProps>(Image);
Copy link
Contributor

Choose a reason for hiding this comment

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

Is calling this method expensive?

Copy link
Contributor

Choose a reason for hiding this comment

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

Anyone importing a type from this file, and not using import type will call this method

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I do not know, but this is a semi-common usage (from what I've seen in another lib this was a HOC).
I think this is only called once for the whole app, am I wrong? So unless you mean that a public user might accidentally do that, it does not matter.

Copy link
Contributor

@lidord-wix lidord-wix left a comment

Choose a reason for hiding this comment

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

Looks good IMO
I have to say that I don't really feel bad about losing the history here, since it's a small and not that popular component.. but maybe ask Ethan

@M-i-k-e-l M-i-k-e-l merged commit d5cfdec into master Aug 1, 2022
@M-i-k-e-l M-i-k-e-l deleted the infra/animated-image-improvements branch August 1, 2022 17:57
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.

3 participants