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

VictoryLabel's backgroundStyle functional styles are not provided current props for evaluation #1646

Closed
4 tasks done
chacestew opened this issue Jul 16, 2020 · 1 comment
Closed
4 tasks done

Comments

@chacestew
Copy link
Contributor

Bugs and Questions

Checklist

  • This is not a victory-native specific issue. (Issues that only appear in victory-native should be opened here)

  • I have read through the FAQ and Guides before asking a question

  • I am using the latest version of Victory

  • I've searched open issues to make sure I'm not opening a duplicate issue

The Problem

When providing a backgroundStyle prop to VictoryLabel, the functional styles are not being passed props for evaluation.

Reproduction

This sandbox shows the problem: https://codesandbox.io/s/basic-victory-example-eck0o?file=/index.js

Open console to see that undefined is returned when logging the argument provided to the fill functional style.

Cause

I believe this is due to the following code:

return Array.isArray(style) && !isEmpty(style)
? style.map((s) => Helpers.evaluateStyle(s, props))
: Helpers.evaluateStyle(style);
};

On line 79, props are missing as the second argument to Helpers.evaluateStyle.

Fix

If you agree with my findings, I would be happy to create a PR altering this one line.

@boygirl
Copy link
Contributor

boygirl commented Jul 16, 2020

@chacestew Good catch! Your solution is correct, and a PR would be very welcome. Thank you!

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

No branches or pull requests

2 participants