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

Return final animation values to JS when animation completes #37886

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@ - (void)startAnimation

- (void)stopAnimation
{
_valueNode = nil;
if (_callback) {
_callback(@[ @{@"finished" : @(_animationHasFinished)} ]);
_callback(@[ @{@"finished" : @(_animationHasFinished), @"value" : @(_valueNode.value)} ]);
}
_valueNode = nil;
}

- (void)stepAnimationWithTime:(NSTimeInterval)currentTime
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,10 @@ - (void)startAnimation

- (void)stopAnimation
{
_valueNode = nil;
if (_callback) {
_callback(@[ @{@"finished" : @(_animationHasFinished)} ]);
_callback(@[ @{@"finished" : @(_animationHasFinished), @"value" : @(_valueNode.value)} ]);
}
_valueNode = nil;
}

- (void)stepAnimationWithTime:(NSTimeInterval)currentTime
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,10 @@ - (void)startAnimation

- (void)stopAnimation
{
_valueNode = nil;
if (_callback) {
_callback(@[ @{@"finished" : @(_animationHasFinished)} ]);
_callback(@[ @{@"finished" : @(_animationHasFinished), @"value" : @(_valueNode.value)} ]);
}
_valueNode = nil;
}

- (void)stepAnimationWithTime:(NSTimeInterval)currentTime
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,8 @@ - (void)testAnimationCallbackFinish

RCTResponseSenderBlock endCallback = ^(NSArray *response) {
endCallbackCalls++;
XCTAssertEqualObjects(response, @[ @{@"finished" : @YES} ]);
NSArray *expected = @[ @{@"finished" : @YES, @"value" : @1} ];
XCTAssertEqualObjects(response, expected);
};

[_nodesManager startAnimatingNode:@1
Expand Down Expand Up @@ -714,7 +715,8 @@ - (void)testHandleStoppingAnimation

RCTResponseSenderBlock endCallback = ^(NSArray *response) {
endCallbackCalled = YES;
XCTAssertEqualObjects(response, @[ @{@"finished" : @NO} ]);
XCTAssertEqual(response.count, 1);
XCTAssertEqualObjects(response[0][@"finished"], @NO);
};

[_nodesManager startAnimatingNode:@404
Expand Down