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
This commit is contained in:
committed by
Facebook GitHub Bot
parent
446206a0ce
commit
0fd6262044
@@ -9,6 +9,7 @@
|
|||||||
|
|
||||||
#import "CKInsetComponent+Sonar.h"
|
#import "CKInsetComponent+Sonar.h"
|
||||||
|
|
||||||
|
#import <ComponentKit/CKDimension.h>
|
||||||
#import <FlipperKitLayoutPlugin/SKNamed.h>
|
#import <FlipperKitLayoutPlugin/SKNamed.h>
|
||||||
#import <FlipperKitLayoutPlugin/SKObject.h>
|
#import <FlipperKitLayoutPlugin/SKObject.h>
|
||||||
|
|
||||||
@@ -19,39 +20,27 @@ FB_LINKABLE(CKInsetComponent_Sonar)
|
|||||||
|
|
||||||
- (NSArray<SKNamed<NSDictionary<NSString*, NSObject*>*>*>*)
|
- (NSArray<SKNamed<NSDictionary<NSString*, NSObject*>*>*>*)
|
||||||
sonar_additionalDataOverride {
|
sonar_additionalDataOverride {
|
||||||
return @[ [SKNamed newWithName:@"CKInsetComponent"
|
return @[
|
||||||
withValue:@{
|
[SKNamed newWithName:@"CKInsetComponent"
|
||||||
@"insets" : SKMutableObject(
|
withValue:@{@"insets" : SKObject([self insetsDictionary])}],
|
||||||
[[self valueForKey:@"_insets"] UIEdgeInsetsValue])
|
];
|
||||||
}] ];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setMutableData:(id)data {
|
- (id)insetsDictionary {
|
||||||
[self setValue:data forKey:@"_insets"];
|
CKRelativeDimension top;
|
||||||
}
|
CKRelativeDimension left;
|
||||||
|
CKRelativeDimension bottom;
|
||||||
- (NSDictionary<NSString*, SKNodeDataChanged>*)sonar_getDataMutationsChanged {
|
CKRelativeDimension right;
|
||||||
__block UIEdgeInsets insets =
|
[[self valueForKey:@"_top"] getValue:&top];
|
||||||
[[self valueForKey:@"_insets"] UIEdgeInsetsValue];
|
[[self valueForKey:@"_left"] getValue:&left];
|
||||||
return @{@"CKInsetComponent.insets.bottom" : ^(NSNumber* value){
|
[[self valueForKey:@"_right"] getValue:&bottom];
|
||||||
insets.bottom = value.floatValue;
|
[[self valueForKey:@"_bottom"] getValue:&right];
|
||||||
return [NSValue valueWithUIEdgeInsets:insets];
|
return @{
|
||||||
}
|
@"top" : top.description(),
|
||||||
,
|
@"left" : left.description(),
|
||||||
@"CKInsetComponent.insets.left": ^(NSNumber *value) {
|
@"bottom" : bottom.description(),
|
||||||
insets.left = value.floatValue;
|
@"right" : right.description(),
|
||||||
return [NSValue valueWithUIEdgeInsets:insets];
|
};
|
||||||
},
|
|
||||||
@"CKInsetComponent.insets.right": ^(NSNumber *value) {
|
|
||||||
insets.right = value.floatValue;
|
|
||||||
return [NSValue valueWithUIEdgeInsets:insets];
|
|
||||||
},
|
|
||||||
@"CKInsetComponent.insets.top": ^(NSNumber *value) {
|
|
||||||
insets.top = value.floatValue;
|
|
||||||
return [NSValue valueWithUIEdgeInsets:insets];
|
|
||||||
},
|
|
||||||
}
|
|
||||||
;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
Reference in New Issue
Block a user