Skip to content

Commit

Permalink
Fix animation bug (microsoft#4964)
Browse files Browse the repository at this point in the history
* Change files

* comment
  • Loading branch information
kmelmon committed May 21, 2020
1 parent 70baa5f commit 1fe030a
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
@@ -0,0 +1,8 @@
{
"type": "prerelease",
"comment": "fix for animation bug",
"packageName": "react-native-windows",
"email": "kmelmon@microsoft.com",
"dependentChangeType": "patch",
"date": "2020-05-21T07:35:00.513Z"
}
16 changes: 16 additions & 0 deletions vnext/ReactUWP/Modules/Animated/PropsAnimatedNode.cpp
Expand Up @@ -97,9 +97,25 @@ void PropsAnimatedNode::UpdateView() {
StartAnimations();
}

static void EnsureUIElementDirtyForRender(xaml::UIElement uiElement) {
auto compositeMode = uiElement.CompositeMode();
switch (compositeMode) {
case xaml::Media::ElementCompositeMode::SourceOver:
case xaml::Media::ElementCompositeMode::MinBlend:
uiElement.CompositeMode(xaml::Media::ElementCompositeMode::Inherit);
break;
default:
uiElement.CompositeMode(xaml::Media::ElementCompositeMode::SourceOver);
break;
}
uiElement.CompositeMode(compositeMode);
}

void PropsAnimatedNode::StartAnimations() {
if (m_expressionAnimations.size()) {
if (const auto uiElement = GetUIElement()) {
// Work around for https://github.com/microsoft/microsoft-ui-xaml/issues/2511
EnsureUIElementDirtyForRender(uiElement);
uiElement.RotationAxis(m_rotationAxis);
for (const auto anim : m_expressionAnimations) {
if (anim.second.Target() == L"Translation.X") {
Expand Down

0 comments on commit 1fe030a

Please sign in to comment.