new DoricLayout bug fix

This commit is contained in:
王劲鹏 2020-04-30 18:48:30 +08:00 committed by osborn
parent 2e9459f80f
commit 0c6fa027b1
3 changed files with 7 additions and 7 deletions

View File

@ -125,16 +125,19 @@ - (void)doric_navBar_setBackgroundColor:(UIColor *)color {
} }
- (void)doric_navBar_setLeft:(UIView *)view { - (void)doric_navBar_setLeft:(UIView *)view {
[view.doricLayout apply:CGSizeMake(self.navigationController.navigationBar.width, self.navigationController.navigationBar.height)];
UIBarButtonItem *custom = [[UIBarButtonItem alloc] initWithCustomView:view]; UIBarButtonItem *custom = [[UIBarButtonItem alloc] initWithCustomView:view];
self.navigationItem.leftBarButtonItem = custom; self.navigationItem.leftBarButtonItem = custom;
} }
- (void)doric_navBar_setRight:(UIView *)view { - (void)doric_navBar_setRight:(UIView *)view {
[view.doricLayout apply:CGSizeMake(self.navigationController.navigationBar.width, self.navigationController.navigationBar.height)];
UIBarButtonItem *custom = [[UIBarButtonItem alloc] initWithCustomView:view]; UIBarButtonItem *custom = [[UIBarButtonItem alloc] initWithCustomView:view];
self.navigationItem.rightBarButtonItem = custom; self.navigationItem.rightBarButtonItem = custom;
} }
- (void)doric_navBar_setCenter:(UIView *)view { - (void)doric_navBar_setCenter:(UIView *)view {
[view.doricLayout apply:CGSizeMake(self.navigationController.navigationBar.width, self.navigationController.navigationBar.height)];
self.navigationItem.titleView = view; self.navigationItem.titleView = view;
} }

View File

@ -82,8 +82,6 @@ - (void)setLeft:(NSDictionary *)params withPromise:(DoricPromise *)promise {
viewNode = [[DoricViewNode create:self.doricContext withType:type] also:^(DoricViewNode *it) { viewNode = [[DoricViewNode create:self.doricContext withType:type] also:^(DoricViewNode *it) {
it.viewId = viewId; it.viewId = viewId;
[it initWithSuperNode:nil]; [it initWithSuperNode:nil];
it.view.doricLayout = [DoricLayout new];
[self.doricContext.navBar doric_navBar_setLeft:it.view];
NSMutableDictionary <NSString *, DoricViewNode *> *map = self.doricContext.headNodes[TYPE_LEFT]; NSMutableDictionary <NSString *, DoricViewNode *> *map = self.doricContext.headNodes[TYPE_LEFT];
if (map != nil) { if (map != nil) {
@ -96,6 +94,7 @@ - (void)setLeft:(NSDictionary *)params withPromise:(DoricPromise *)promise {
}]; }];
} }
[viewNode blend:params[@"props"]]; [viewNode blend:params[@"props"]];
[self.doricContext.navBar doric_navBar_setLeft:viewNode.view];
[promise resolve:nil]; [promise resolve:nil];
}); });
} else { } else {
@ -113,8 +112,6 @@ - (void)setRight:(NSDictionary *)params withPromise:(DoricPromise *)promise {
viewNode = [[DoricViewNode create:self.doricContext withType:type] also:^(DoricViewNode *it) { viewNode = [[DoricViewNode create:self.doricContext withType:type] also:^(DoricViewNode *it) {
it.viewId = viewId; it.viewId = viewId;
[it initWithSuperNode:nil]; [it initWithSuperNode:nil];
it.view.doricLayout = [DoricLayout new];
[self.doricContext.navBar doric_navBar_setRight:it.view];
NSMutableDictionary <NSString *, DoricViewNode *> *map = self.doricContext.headNodes[TYPE_RIGHT]; NSMutableDictionary <NSString *, DoricViewNode *> *map = self.doricContext.headNodes[TYPE_RIGHT];
if (map != nil) { if (map != nil) {
@ -127,6 +124,7 @@ - (void)setRight:(NSDictionary *)params withPromise:(DoricPromise *)promise {
}]; }];
} }
[viewNode blend:params[@"props"]]; [viewNode blend:params[@"props"]];
[self.doricContext.navBar doric_navBar_setRight:viewNode.view];
[promise resolve:nil]; [promise resolve:nil];
}); });
} else { } else {
@ -144,8 +142,6 @@ - (void)setCenter:(NSDictionary *)params withPromise:(DoricPromise *)promise {
viewNode = [[DoricViewNode create:self.doricContext withType:type] also:^(DoricViewNode *it) { viewNode = [[DoricViewNode create:self.doricContext withType:type] also:^(DoricViewNode *it) {
it.viewId = viewId; it.viewId = viewId;
[it initWithSuperNode:nil]; [it initWithSuperNode:nil];
it.view.doricLayout = [DoricLayout new];
[self.doricContext.navBar doric_navBar_setCenter:it.view];
NSMutableDictionary <NSString *, DoricViewNode *> *map = self.doricContext.headNodes[TYPE_CENTER]; NSMutableDictionary <NSString *, DoricViewNode *> *map = self.doricContext.headNodes[TYPE_CENTER];
if (map != nil) { if (map != nil) {
@ -158,6 +154,7 @@ - (void)setCenter:(NSDictionary *)params withPromise:(DoricPromise *)promise {
}]; }];
} }
[viewNode blend:params[@"props"]]; [viewNode blend:params[@"props"]];
[self.doricContext.navBar doric_navBar_setCenter:viewNode.view];
[promise resolve:nil]; [promise resolve:nil];
}); });
} else { } else {

File diff suppressed because one or more lines are too long