Skip to content

Infra/ colorSwatch perf improvements #2154

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 1 commit into from
Jul 31, 2022
Merged

Conversation

lidord-wix
Copy link
Contributor

Description

Add accessibilityInfo only if the accessibility mode is on
improves performance by ~71%

Changelog

ColorSwatch - add accessibilityInfo only if the accessibility mode is on

@@ -148,7 +149,7 @@ class ColorSwatch extends PureComponent<Props> {
onPress={this.onPress}
style={[this.styles.container, style]}
onLayout={this.onLayout}
{...this.getAccessibilityInfo()}
{...accessibilityInfo}
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is the previous approach slow?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We added a condition to get the accessibility info only when the user is on accessibility mode since the calculation we do for getting the color name is pretty heavy.

@Effanuel Effanuel mentioned this pull request Jul 28, 2022
@ethanshar ethanshar added the Important for Next Release PR that must be included in the release version label Jul 29, 2022
@lidord-wix lidord-wix merged commit 3360d8b into master Jul 31, 2022
@lidord-wix lidord-wix deleted the infra/colorSwatch_perf branch August 4, 2022 09:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Important for Next Release PR that must be included in the release version
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants