mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
4553f87489
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/53591 Reviewed By: rshest Differential Revision: D81571883 fbshipit-source-id: 479a0764eabeac968028814ec6aafa32687b0905
35 lines
818 B
Plaintext
35 lines
818 B
Plaintext
/*
|
|
* 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 "RNTLegacyView.h"
|
|
|
|
@implementation RNTLegacyView
|
|
|
|
- (void)setBackgroundColor:(UIColor *)backgroundColor
|
|
{
|
|
super.backgroundColor = backgroundColor;
|
|
[self emitEvent];
|
|
}
|
|
|
|
- (void)emitEvent
|
|
{
|
|
if (self.onColorChanged == nullptr) {
|
|
return;
|
|
}
|
|
CGFloat hue = 0.0;
|
|
CGFloat saturation = 0.0;
|
|
CGFloat brightness = 0.0;
|
|
CGFloat alpha = 0.0;
|
|
[self.backgroundColor getHue:&hue saturation:&saturation brightness:&brightness alpha:&alpha];
|
|
self.onColorChanged(@{
|
|
@"backgroundColor" :
|
|
@{@"hue" : @(hue), @"saturation" : @(saturation), @"brightness" : @(brightness), @"alpha" : @(alpha)}
|
|
});
|
|
}
|
|
|
|
@end
|