RCTSubtractionAnimatedNode.m 828 B

123456789101112131415161718192021222324252627
  1. /*
  2. * Copyright (c) Facebook, Inc. and its affiliates.
  3. *
  4. * This source code is licensed under the MIT license found in the
  5. * LICENSE file in the root directory of this source tree.
  6. */
  7. #import <React/RCTSubtractionAnimatedNode.h>
  8. @implementation RCTSubtractionAnimatedNode
  9. - (void)performUpdate
  10. {
  11. [super performUpdate];
  12. NSArray<NSNumber *> *inputNodes = self.config[@"input"];
  13. if (inputNodes.count > 1) {
  14. RCTValueAnimatedNode *parent1 = (RCTValueAnimatedNode *)[self.parentNodes objectForKey:inputNodes[0]];
  15. RCTValueAnimatedNode *parent2 = (RCTValueAnimatedNode *)[self.parentNodes objectForKey:inputNodes[1]];
  16. if ([parent1 isKindOfClass:[RCTValueAnimatedNode class]] &&
  17. [parent2 isKindOfClass:[RCTValueAnimatedNode class]]) {
  18. self.value = parent1.value - parent2.value;
  19. }
  20. }
  21. }
  22. @end