Feature: add an animationWhitelist
array to the animate
prop
#1209
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Addresses #1186
This PR allows users to override the default
animationWhitelist
for components that accept ananimate
prop.When a component has an
animate
prop it will render itself within a<VictoryTransition />
wrapper, which then renders a<VictoryAnimation />
component with a subset of data to "tween". Initially, that subset was determined by pulling data keys that were included in a module-scoped array of strings (["data", "style", "domain", ...]
). These changes allow ananimate.animationWhitelist
prop to override that array and also moves the default array to a static property on the component so users can reference it if necessary.There's still room for improvement by allowing users to specify sub-properties they want to animate. For example, instead of enabling/disabling all animations for
style
it would be great to enable/disable animation forstyle.fill
orstyle.opacity
, etc. That gets a little more difficult when dealing with thedata
animations though.