Files
Riccardo Cipolleschi c005830958 Add Fabric Interop event example
Summary:
This changes adds an example to RNTester to verify that the Interop Layer can process bubbling events in Fabric as it used to do in Paper.

## Changelog:
[iOS][Added] - Add example in the Interop Layer to use events

Reviewed By: sammy-SC

Differential Revision: D43911390

fbshipit-source-id: ae75db25078669676e5a609e090f1e9674026391
2023-03-10 04:52:44 -08:00

35 lines
808 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) {
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