FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Setting and instantly animating a property fails for iOS · Issue #1218 · NativeScript/NativeScript · GitHub

Setting and instantly animating a property fails for iOS #1218

Description

In iOS, the following code:

button.backgroundColor = "#FF0000"
button.animate({
    backgroundColor: new colorModule.Color("#00FFFF"),
    duration: 500
});

Animates a button's background from white (the default) to teal #00FFFF without setting it to red initially #FF0000. So I guess the animation works, but somehow overrides/ignores the button.backgroundColor = "#FF0000" setter.

This was working before the following feature was introduced: #936 The problem is using the UIViewKeyframeAnimationOptionBeginFromCurrentState key to allow animations to interrupt a previous animation from the middle and continue smoothly.

As a workaround you can chain two animations:

button.animate({
    backgroundColor: new colorModule.Color("#FF0000"),
    duration: 10
}).then(function() {
  return button.animate({
    backgroundColor: new colorModule.Color("#00FFFF"),
    duration: 500
  });
}

Both are common concepts but seem to be mutually exclusive for iOS. We will have to find alternative for the animation API that works in both cases or control the behavior with a property.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL