mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
49f3f47b1e
Summary: Adds support for Animated.Color with native driver for iOS. Reads the native config for the rbga channel AnimatedNodes, and on update(), converts the values into a SharedColor. Followup changes will include support for platform colors. Ran update_pods: https://www.internalfb.com/intern/wiki/React_Native/Preparing_to_Ship/Open_Source_Pods/ Changelog: [iOS][Added] - Support running animations with AnimatedColor with native driver Reviewed By: sammy-SC Differential Revision: D33860583 fbshipit-source-id: 990ad0f754a21e3939f2cb233bcfa793ef12eb14
31 lines
1.0 KiB
Objective-C
31 lines
1.0 KiB
Objective-C
/*
|
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*/
|
|
|
|
#import <React/RCTColorAnimatedNode.h>
|
|
#import <React/RCTValueAnimatedNode.h>
|
|
|
|
@implementation RCTColorAnimatedNode
|
|
|
|
- (void)performUpdate
|
|
{
|
|
[super performUpdate];
|
|
|
|
RCTValueAnimatedNode *rNode = (RCTValueAnimatedNode *)[self.parentNodes objectForKey:self.config[@"r"]];
|
|
RCTValueAnimatedNode *gNode = (RCTValueAnimatedNode *)[self.parentNodes objectForKey:self.config[@"g"]];
|
|
RCTValueAnimatedNode *bNode = (RCTValueAnimatedNode *)[self.parentNodes objectForKey:self.config[@"b"]];
|
|
RCTValueAnimatedNode *aNode = (RCTValueAnimatedNode *)[self.parentNodes objectForKey:self.config[@"a"]];
|
|
|
|
_color = ((int)round(aNode.value * 255) & 0xff) << 24 |
|
|
((int)round(rNode.value) & 0xff) << 16 |
|
|
((int)round(gNode.value) & 0xff) << 8 |
|
|
((int)round(bNode.value) & 0xff);
|
|
|
|
// TODO (T111179606): Support platform colors for color animations
|
|
}
|
|
|
|
@end
|