feat:add Popover demo
This commit is contained in:
@@ -24,7 +24,6 @@
|
||||
#import "DoricLayouts.h"
|
||||
#import "UIView+Doric.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
@class DoricSuperNode;
|
||||
|
||||
@interface DoricViewNode <V:UIView *> : DoricContextHolder
|
||||
@@ -55,5 +54,3 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
- (void)requestLayout;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -126,6 +126,8 @@ - (void)blendView:(UIView *)view forPropName:(NSString *)name propValue:(id)prop
|
||||
} else if ([name isEqualToString:@"layoutConfig"]) {
|
||||
if (self.superNode && [prop isKindOfClass:[NSDictionary class]]) {
|
||||
[self.superNode blendSubNode:self layoutConfig:prop];
|
||||
} else {
|
||||
[self blendLayoutConfig:prop];
|
||||
}
|
||||
} else if ([name isEqualToString:@"onClick"]) {
|
||||
self.callbackIds[@"onClick"] = prop;
|
||||
@@ -246,4 +248,36 @@ - (NSNumber *)getRotation {
|
||||
return @(degree);
|
||||
}
|
||||
|
||||
- (void)blendLayoutConfig:(NSDictionary *)params {
|
||||
[params[@"widthSpec"] also:^(NSNumber *it) {
|
||||
if (it) {
|
||||
self.layoutConfig.widthSpec = (DoricLayoutSpec) [it integerValue];
|
||||
}
|
||||
}];
|
||||
|
||||
[params[@"heightSpec"] also:^(NSNumber *it) {
|
||||
if (it) {
|
||||
self.layoutConfig.heightSpec = (DoricLayoutSpec) [it integerValue];
|
||||
}
|
||||
}];
|
||||
|
||||
NSDictionary *margin = params[@"margin"];
|
||||
if (margin) {
|
||||
self.layoutConfig.margin = DoricMarginMake(
|
||||
[(NSNumber *) margin[@"left"] floatValue],
|
||||
[(NSNumber *) margin[@"top"] floatValue],
|
||||
[(NSNumber *) margin[@"right"] floatValue],
|
||||
[(NSNumber *) margin[@"bottom"] floatValue]);
|
||||
}
|
||||
|
||||
NSNumber *alignment = params[@"alignment"];
|
||||
if (alignment) {
|
||||
self.layoutConfig.alignment = (DoricGravity) [alignment integerValue];
|
||||
}
|
||||
NSNumber *weight = params[@"weight"];
|
||||
if (weight) {
|
||||
self.layoutConfig.weight = (DoricGravity) [weight integerValue];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
Reference in New Issue
Block a user