Skip to content

Setting and instantly animating a property fails for iOS #1218

Closed

Description

@PanayotCankov

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

  1. self-assigned this
    on Feb 4, 2016
  2. added
    ready for testTSC needs to test this and confirm against live production apps and automated test suites
    and removed on Feb 5, 2016
  3. vchimev commented on Feb 8, 2016

    @vchimev
    Contributor

    It still does not work for a label view. PR: #1501.

  4. added and removed
    ready for testTSC needs to test this and confirm against live production apps and automated test suites
    on Feb 8, 2016
  5. added this to the 1.6.0 milestone on Feb 8, 2016
  6. lock commented on Aug 30, 2019

    @lock

    This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

  7. locked and limited conversation to collaborators on Aug 30, 2019
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