Files
flipper/iOS/Plugins/FlipperKitLayoutPlugin/FlipperKitLayoutComponentKitSupport/CKInsetComponent+Sonar.mm
Ruslan Serebriakov 0fd6262044 Fixing the issue with broken CKInsetComponent set up
Summary:
After updating the internal properties of CKInsetComponent we didn't update some KVO magic being used in Flipper which caused some crashes:
https://fb.workplace.com/groups/componentkit/permalink/4986354281413147/

Reviewed By: fabiomassimo

Differential Revision: D25946704

fbshipit-source-id: 5995cda20d12b18f7520507cb6ede897fddf2670
2021-01-20 04:52:29 -08:00

49 lines
1.2 KiB
Plaintext

/*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#if FB_SONARKIT_ENABLED
#import "CKInsetComponent+Sonar.h"
#import <ComponentKit/CKDimension.h>
#import <FlipperKitLayoutPlugin/SKNamed.h>
#import <FlipperKitLayoutPlugin/SKObject.h>
#import "CKComponent+Sonar.h"
FB_LINKABLE(CKInsetComponent_Sonar)
@implementation CKInsetComponent (Sonar)
- (NSArray<SKNamed<NSDictionary<NSString*, NSObject*>*>*>*)
sonar_additionalDataOverride {
return @[
[SKNamed newWithName:@"CKInsetComponent"
withValue:@{@"insets" : SKObject([self insetsDictionary])}],
];
}
- (id)insetsDictionary {
CKRelativeDimension top;
CKRelativeDimension left;
CKRelativeDimension bottom;
CKRelativeDimension right;
[[self valueForKey:@"_top"] getValue:&top];
[[self valueForKey:@"_left"] getValue:&left];
[[self valueForKey:@"_right"] getValue:&bottom];
[[self valueForKey:@"_bottom"] getValue:&right];
return @{
@"top" : top.description(),
@"left" : left.description(),
@"bottom" : bottom.description(),
@"right" : right.description(),
};
}
@end
#endif