feat:fix Refreshable pulldown and so on
This commit is contained in:
		| @@ -25,3 +25,4 @@ | |||||||
| #import "DoricNavigatorDelegate.h" | #import "DoricNavigatorDelegate.h" | ||||||
| #import "DoricNavBarDelegate.h" | #import "DoricNavBarDelegate.h" | ||||||
| #import "DoricViewController.h" | #import "DoricViewController.h" | ||||||
|  | #import "DoricPromise.h" | ||||||
| @@ -154,4 +154,21 @@ - (void)setProgressRotation:(CGFloat)rotation { | |||||||
|     [self.headerNode callJSResponse:@"setProgressRotation", @(rotation), nil]; |     [self.headerNode callJSResponse:@"setProgressRotation", @(rotation), nil]; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | - (void)setRefreshing:(NSNumber *)refreshable withPromise:(DoricPromise *)promise { | ||||||
|  |     self.view.refreshing = [refreshable boolValue]; | ||||||
|  |     [promise resolve:nil]; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | - (void)setRefreshable:(NSNumber *)refreshing withPromise:(DoricPromise *)promise { | ||||||
|  |     self.view.refreshable = [refreshing boolValue]; | ||||||
|  |     [promise resolve:nil]; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | - (NSNumber *)isRefreshing { | ||||||
|  |     return @(self.view.refreshing); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | - (NSNumber *)isRefreshable { | ||||||
|  |     return @(self.view.refreshable); | ||||||
|  | } | ||||||
| @end | @end | ||||||
|   | |||||||
| @@ -79,6 +79,9 @@ - (void)setRefreshing:(BOOL)refreshing { | |||||||
|         return; |         return; | ||||||
|     } |     } | ||||||
|     if (refreshing) { |     if (refreshing) { | ||||||
|  |         if (self.onRefreshBlock) { | ||||||
|  |             self.onRefreshBlock(); | ||||||
|  |         } | ||||||
|         [UIView animateWithDuration:0.3f |         [UIView animateWithDuration:0.3f | ||||||
|                          animations:^{ |                          animations:^{ | ||||||
|                              self.contentInset = UIEdgeInsetsMake(self.headerView.height, 0, 0, 0); |                              self.contentInset = UIEdgeInsetsMake(self.headerView.height, 0, 0, 0); | ||||||
|   | |||||||
| @@ -543,7 +543,7 @@ - (CGSize)targetLayoutSize { | |||||||
|         width = self.superview.width; |         width = self.superview.width; | ||||||
|     } |     } | ||||||
|     if (self.layoutConfig.heightSpec == DoricLayoutAtMost |     if (self.layoutConfig.heightSpec == DoricLayoutAtMost | ||||||
|             || self.layoutConfig.widthSpec == DoricLayoutWrapContent) { |             || self.layoutConfig.heightSpec == DoricLayoutWrapContent) { | ||||||
|         height = self.superview.height; |         height = self.superview.height; | ||||||
|     } |     } | ||||||
|     return CGSizeMake(width, height); |     return CGSizeMake(width, height); | ||||||
|   | |||||||
| @@ -36,10 +36,13 @@ @implementation DoricTableView | |||||||
| - (CGSize)sizeThatFits:(CGSize)size { | - (CGSize)sizeThatFits:(CGSize)size { | ||||||
|     if (self.subviews.count > 0) { |     if (self.subviews.count > 0) { | ||||||
|         CGFloat width = size.width; |         CGFloat width = size.width; | ||||||
|  |         CGFloat height = 0; | ||||||
|  | 
 | ||||||
|         for (UIView *child in self.subviews) { |         for (UIView *child in self.subviews) { | ||||||
|             width = MAX(child.width, width); |             width = MAX(child.width, width); | ||||||
|  |             height += child.height; | ||||||
|         } |         } | ||||||
|         return CGSizeMake(width, size.width); |         return CGSizeMake(width, height); | ||||||
|     } |     } | ||||||
|     return size; |     return size; | ||||||
| } | } | ||||||
| @@ -74,9 +77,11 @@ - (UITableView *)build { | |||||||
| - (void)blendView:(UITableView *)view forPropName:(NSString *)name propValue:(id)prop { | - (void)blendView:(UITableView *)view forPropName:(NSString *)name propValue:(id)prop { | ||||||
|     if ([@"itemCount" isEqualToString:name]) { |     if ([@"itemCount" isEqualToString:name]) { | ||||||
|         self.itemCount = [prop unsignedIntegerValue]; |         self.itemCount = [prop unsignedIntegerValue]; | ||||||
|  |         [self.view reloadData]; | ||||||
|     } else if ([@"renderItem" isEqualToString:name]) { |     } else if ([@"renderItem" isEqualToString:name]) { | ||||||
|         [self.itemViewIds removeAllObjects]; |         [self.itemViewIds removeAllObjects]; | ||||||
|         [self clearSubModel]; |         [self clearSubModel]; | ||||||
|  |         [self.view reloadData]; | ||||||
|     } else if ([@"batchCount" isEqualToString:name]) { |     } else if ([@"batchCount" isEqualToString:name]) { | ||||||
|         self.batchCount = [prop unsignedIntegerValue]; |         self.batchCount = [prop unsignedIntegerValue]; | ||||||
|     } else { |     } else { | ||||||
|   | |||||||
| @@ -80,9 +80,11 @@ - (UICollectionView *)build { | |||||||
| - (void)blendView:(UICollectionView *)view forPropName:(NSString *)name propValue:(id)prop { | - (void)blendView:(UICollectionView *)view forPropName:(NSString *)name propValue:(id)prop { | ||||||
|     if ([@"itemCount" isEqualToString:name]) { |     if ([@"itemCount" isEqualToString:name]) { | ||||||
|         self.itemCount = [prop unsignedIntegerValue]; |         self.itemCount = [prop unsignedIntegerValue]; | ||||||
|  |         [self.view reloadData]; | ||||||
|     } else if ([@"renderPage" isEqualToString:name]) { |     } else if ([@"renderPage" isEqualToString:name]) { | ||||||
|         [self.itemViewIds removeAllObjects]; |         [self.itemViewIds removeAllObjects]; | ||||||
|         [self clearSubModel]; |         [self clearSubModel]; | ||||||
|  |         [self.view reloadData]; | ||||||
|     } else if ([@"batchCount" isEqualToString:name]) { |     } else if ([@"batchCount" isEqualToString:name]) { | ||||||
|         self.batchCount = [prop unsignedIntegerValue]; |         self.batchCount = [prop unsignedIntegerValue]; | ||||||
|     } else { |     } else { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user