mirror of
https://github.com/status-im/react-native.git
synced 2025-01-09 17:15:54 +00:00
4906f8d28c
Summary: Fixes #18451 I've added another example to NativeAnimationsExample, which makes use of `Animated.substract()`, let me know if the example is not desired / doesn't add much value. Below two GIFs of the new method working on iOS and Android: <img width="320" src="https://user-images.githubusercontent.com/1437605/38154748-165cc5f8-3474-11e8-8b31-504444271896.gif" /> <img width="320" src="https://user-images.githubusercontent.com/1437605/38154749-1679bff0-3474-11e8-80b1-b558d44e0494.gif" /> <!-- Required: Write your test plan here. If you changed any code, please provide us with clear instructions on how you verified your changes work. Bonus points for screenshots and videos! --> https://github.com/facebook/react-native-website/pull/276 [GENERAL] [ENHANCEMENT] [Animated] - Implemented Animated.subtract Closes https://github.com/facebook/react-native/pull/18630 Differential Revision: D7462867 Pulled By: hramos fbshipit-source-id: 4cb0b8af08bb0c841e44ea2099889b8c02a22a4a
28 lines
817 B
Objective-C
28 lines
817 B
Objective-C
/**
|
|
* Copyright (c) 2015-present, Facebook, Inc.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*/
|
|
|
|
#import "RCTSubtractionAnimatedNode.h"
|
|
|
|
@implementation RCTSubtractionAnimatedNode
|
|
|
|
- (void)performUpdate
|
|
{
|
|
[super performUpdate];
|
|
NSArray<NSNumber *> *inputNodes = self.config[@"input"];
|
|
if (inputNodes.count > 1) {
|
|
RCTValueAnimatedNode *parent1 = (RCTValueAnimatedNode *)[self.parentNodes objectForKey:inputNodes[0]];
|
|
RCTValueAnimatedNode *parent2 = (RCTValueAnimatedNode *)[self.parentNodes objectForKey:inputNodes[1]];
|
|
if ([parent1 isKindOfClass:[RCTValueAnimatedNode class]] &&
|
|
[parent2 isKindOfClass:[RCTValueAnimatedNode class]]) {
|
|
self.value = parent1.value - parent2.value;
|
|
}
|
|
}
|
|
}
|
|
|
|
@end
|
|
|