Files
react-native/packages/rn-tester/NativeComponentExample/ios/RNTLegacyView.mm
generatedunixname89002005287564 4553f87489 Fix CQS signal readability-implicit-bool-conversion in xplat/js/react-native-github/packages (#53591)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/53591

Reviewed By: rshest

Differential Revision: D81571883

fbshipit-source-id: 479a0764eabeac968028814ec6aafa32687b0905
2025-09-04 03:13:49 -07:00

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