You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by cx...@apache.org on 2017/03/07 07:55:52 UTC
[6/8] incubator-weex git commit: * [ios] first screen render time
support for recycler
* [ios] first screen render time support for recycler
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/27494582
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/27494582
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/27494582
Branch: refs/heads/0.11-dev
Commit: 274945824bf3b05f7c09077669c664a614a01756
Parents: 7b9016c
Author: \u9690\u98ce <cx...@apache.org>
Authored: Tue Mar 7 15:53:54 2017 +0800
Committer: \u9690\u98ce <cx...@apache.org>
Committed: Tue Mar 7 15:53:54 2017 +0800
----------------------------------------------------------------------
.../Sources/Component/Recycler/WXRecyclerComponent.m | 15 +++++++++++++++
ios/sdk/WeexSDK/Sources/Component/WXListComponent.m | 1 -
2 files changed, 15 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/27494582/ios/sdk/WeexSDK/Sources/Component/Recycler/WXRecyclerComponent.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Component/Recycler/WXRecyclerComponent.m b/ios/sdk/WeexSDK/Sources/Component/Recycler/WXRecyclerComponent.m
index c2eaa5d..93dee45 100644
--- a/ios/sdk/WeexSDK/Sources/Component/Recycler/WXRecyclerComponent.m
+++ b/ios/sdk/WeexSDK/Sources/Component/Recycler/WXRecyclerComponent.m
@@ -426,7 +426,22 @@ typedef enum : NSUInteger {
- (void)cellDidRendered:(WXCellComponent *)cell
{
+ if (WX_MONITOR_INSTANCE_PERF_IS_RECORDED(WXPTFirstScreenRender, self.weexInstance) && !self.weexInstance.onRenderProgress) {
+ return;
+ }
+
+ NSIndexPath *indexPath = [self.dataController indexPathForCell:cell];
+ UICollectionViewLayoutAttributes *attributes = [self.collectionView layoutAttributesForItemAtIndexPath:indexPath];
+ CGRect cellRect = attributes.frame;
+ if (cellRect.origin.y + cellRect.size.height >= _collectionView.frame.size.height) {
+ WX_MONITOR_INSTANCE_PERF_END(WXPTFirstScreenRender, self.weexInstance);
+ }
+
+ if (self.weexInstance.onRenderProgress) {
+ CGRect renderRect = [_collectionView convertRect:cellRect toView:self.weexInstance.rootView];
+ self.weexInstance.onRenderProgress(renderRect);
+ }
}
- (void)cellDidRemove:(WXCellComponent *)cell
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/27494582/ios/sdk/WeexSDK/Sources/Component/WXListComponent.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Component/WXListComponent.m b/ios/sdk/WeexSDK/Sources/Component/WXListComponent.m
index 157b68c..ae07415 100644
--- a/ios/sdk/WeexSDK/Sources/Component/WXListComponent.m
+++ b/ios/sdk/WeexSDK/Sources/Component/WXListComponent.m
@@ -437,7 +437,6 @@
CGRect renderRect = [_tableView convertRect:cellRect toView:self.weexInstance.rootView];
self.weexInstance.onRenderProgress(renderRect);
}
-
}
- (void)cell:(WXCellComponent *)cell didMoveToIndex:(NSUInteger)index