diff --git a/renderer/native/ios/renderer/HippyComponent.h b/renderer/native/ios/renderer/HippyComponent.h index 66cebab031d..9c44b1af7b4 100644 --- a/renderer/native/ios/renderer/HippyComponent.h +++ b/renderer/native/ios/renderer/HippyComponent.h @@ -47,7 +47,7 @@ typedef void (^HippyDirectEventBlock)(NSDictionary *body); @property (nonatomic, weak) __kindof id parent; /// Subviews of current component -- (NSArray<__kindof id> *)subcomponents; +- (NSArray<__kindof id> *)hippySubviews; /// Inset /// - Parameters: diff --git a/renderer/native/ios/renderer/HippyRootShadowView.mm b/renderer/native/ios/renderer/HippyRootShadowView.mm index 8609254e851..4c77c621b76 100644 --- a/renderer/native/ios/renderer/HippyRootShadowView.mm +++ b/renderer/native/ios/renderer/HippyRootShadowView.mm @@ -30,7 +30,7 @@ - (void)applySizeConstraints { } - (void)amendLayoutBeforeMount:(NSMutableSet *)blocks { - for (HippyShadowView *renderObject in self.subcomponents) { + for (HippyShadowView *renderObject in self.hippySubviews) { [renderObject amendLayoutBeforeMount:blocks]; } } diff --git a/renderer/native/ios/renderer/HippyUIManager.mm b/renderer/native/ios/renderer/HippyUIManager.mm index 23e9dfb2169..c063ad487ad 100644 --- a/renderer/native/ios/renderer/HippyUIManager.mm +++ b/renderer/native/ios/renderer/HippyUIManager.mm @@ -157,7 +157,7 @@ - (void)removeAllObjects { static void NativeRenderTraverseViewNodes(id view, void (^block)(id)) { if (view.hippyTag != nil) { block(view); - for (id subview in view.subcomponents) { + for (id subview in view.hippySubviews) { NativeRenderTraverseViewNodes(subview, block); } } @@ -597,7 +597,7 @@ - (UIView *)createViewRecursiveFromRenderObjectWithNOLock:(HippyShadowView *)sha } NSUInteger index = 0; - for (HippyShadowView *subRenderObject in shadowView.subcomponents) { + for (HippyShadowView *subRenderObject in shadowView.hippySubviews) { UIView *subview = [self createViewRecursiveFromRenderObjectWithNOLock:subRenderObject]; [view insertHippySubview:subview atIndex:index]; index++; diff --git a/renderer/native/ios/renderer/component/listview/HippyNextBaseListView.mm b/renderer/native/ios/renderer/component/listview/HippyNextBaseListView.mm index 2a5a19c951c..f299e3d83b7 100644 --- a/renderer/native/ios/renderer/component/listview/HippyNextBaseListView.mm +++ b/renderer/native/ios/renderer/component/listview/HippyNextBaseListView.mm @@ -142,7 +142,7 @@ - (void)setScrollEnabled:(BOOL)value { // here we use super's hippyBridgeDidFinishTransaction imp to trigger reload, // and override reloadData to handle special logic - (void)reloadData { - NSArray *datasource = [self.hippyShadowView.subcomponents copy]; + NSArray *datasource = [self.hippyShadowView.hippySubviews copy]; self->_dataSource = [[HippyNextBaseListViewDataSource alloc] initWithDataSource:datasource itemViewName:[self compoentItemName] containBannerView:NO]; diff --git a/renderer/native/ios/renderer/component/scrollview/HippyScrollView.mm b/renderer/native/ios/renderer/component/scrollview/HippyScrollView.mm index 968b9fa0dad..ecc2017025c 100644 --- a/renderer/native/ios/renderer/component/scrollview/HippyScrollView.mm +++ b/renderer/native/ios/renderer/component/scrollview/HippyScrollView.mm @@ -262,7 +262,7 @@ - (void)insertHippySubview:(UIView *)view atIndex:(NSInteger)atIndex { } } -- (NSArray *)subcomponents { +- (NSArray *)hippySubviews { return _contentView ? [NSMutableArray arrayWithObject:_contentView] : nil; } diff --git a/renderer/native/ios/renderer/component/smartViewPager/NativeRenderSmartViewPagerView.mm b/renderer/native/ios/renderer/component/smartViewPager/NativeRenderSmartViewPagerView.mm index abac1ef5f3e..a10ca363f35 100644 --- a/renderer/native/ios/renderer/component/smartViewPager/NativeRenderSmartViewPagerView.mm +++ b/renderer/native/ios/renderer/component/smartViewPager/NativeRenderSmartViewPagerView.mm @@ -313,8 +313,8 @@ - (NSArray *)refreshItemIndexArrayWithOldArrayLength:(NSInteger)length { } - (void)refreshItemNodes { - [self.dataSource setDataSource:self.hippyShadowView.subcomponents containBannerView:NO]; - _itemIndexArray = [self refreshItemIndexArrayWithOldArrayLength:self.hippyShadowView.subcomponents.count]; + [self.dataSource setDataSource:self.hippyShadowView.hippySubviews containBannerView:NO]; + _itemIndexArray = [self refreshItemIndexArrayWithOldArrayLength:self.hippyShadowView.hippySubviews.count]; [self setPreviousMargin:_previousMargin nextMargin:_nextMargin pageGap:_pageGap]; } diff --git a/renderer/native/ios/renderer/component/text/HippyShadowText.mm b/renderer/native/ios/renderer/component/text/HippyShadowText.mm index eb79f1399b7..b8d3d4b59df 100644 --- a/renderer/native/ios/renderer/component/text/HippyShadowText.mm +++ b/renderer/native/ios/renderer/component/text/HippyShadowText.mm @@ -311,7 +311,7 @@ - (void)amendLayoutBeforeMount:(NSMutableSet *)blocks // so only call amendXxx when subcomponent is not a . if (NativeRenderUpdateLifecycleComputed != _propagationLifecycle) { _propagationLifecycle = NativeRenderUpdateLifecycleComputed; - for (HippyShadowView *shadowView in self.subcomponents) { + for (HippyShadowView *shadowView in self.hippySubviews) { if (![shadowView isKindOfClass:HippyShadowText.class]) { [shadowView amendLayoutBeforeMount:blocks]; } @@ -441,7 +441,7 @@ - (NSAttributedString *)attributedString { info.foregroundColor = self.color ?: [UIColor blackColor]; info.backgroundColor = self.backgroundColor; info.opacity = self.opacity; - info.isNestedText = self.subcomponents.count > 0; + info.isNestedText = self.hippySubviews.count > 0; _isNestedText = info.isNestedText; return [self _attributedStringWithStyleInfo:info]; } @@ -496,7 +496,7 @@ - (NSAttributedString *)_attributedStringWithStyleInfo:(HippyAttributedStringSty CGFloat heightOfTallestSubview = 0.0; NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:self.text ?: @""]; - for (HippyShadowView *child in [self subcomponents]) { + for (HippyShadowView *child in [self hippySubviews]) { if ([child isKindOfClass:[HippyShadowText class]]) { HippyShadowText *childShadowText = (HippyShadowText *)child; HippyAttributedStringStyleInfo *childInfo = [HippyAttributedStringStyleInfo new]; @@ -966,7 +966,7 @@ - (void)setAllowFontScaling:(BOOL)allowFontScaling { return; } _allowFontScaling = allowFontScaling; - for (HippyShadowView *child in [self subcomponents]) { + for (HippyShadowView *child in [self hippySubviews]) { if ([child isKindOfClass:[HippyShadowText class]]) { ((HippyShadowText *)child).allowFontScaling = allowFontScaling; } @@ -983,7 +983,7 @@ - (void)setFontSizeMultiplier:(CGFloat)fontSizeMultiplier { HippyLogError(@"fontSizeMultiplier value must be > zero."); _fontSizeMultiplier = 1.0; } - for (HippyShadowView *child in [self subcomponents]) { + for (HippyShadowView *child in [self hippySubviews]) { if ([child isKindOfClass:[HippyShadowText class]]) { ((HippyShadowText *)child).fontSizeMultiplier = fontSizeMultiplier; } diff --git a/renderer/native/ios/renderer/component/text/HippyText.mm b/renderer/native/ios/renderer/component/text/HippyText.mm index 3dc00febcae..2e9ebd1a129 100644 --- a/renderer/native/ios/renderer/component/text/HippyText.mm +++ b/renderer/native/ios/renderer/component/text/HippyText.mm @@ -27,7 +27,7 @@ #import "HippyLog.h" static void collectNonTextDescendants(HippyText *view, NSMutableArray *nonTextDescendants) { - for (UIView *child in view.subcomponents) { + for (UIView *child in view.hippySubviews) { if ([child isKindOfClass:[HippyText class]]) { collectNonTextDescendants((HippyText *)child, nonTextDescendants); } else { @@ -65,11 +65,11 @@ - (void)hippySetFrame:(CGRect)frame { } - (void)removeHippySubview:(UIView *)subview { - if ([[self subcomponents] containsObject:subview]) { + if ([[self hippySubviews] containsObject:subview]) { [super removeHippySubview:subview]; } else { - NSArray *hippySubviews = [self subcomponents]; + NSArray *hippySubviews = [self hippySubviews]; for (UIView *hippySubview in hippySubviews) { [hippySubview removeHippySubview:subview]; } diff --git a/renderer/native/ios/renderer/component/text/HippyTextManager.mm b/renderer/native/ios/renderer/component/text/HippyTextManager.mm index b8f539b4300..bc2159baf1a 100644 --- a/renderer/native/ios/renderer/component/text/HippyTextManager.mm +++ b/renderer/native/ios/renderer/component/text/HippyTextManager.mm @@ -28,7 +28,7 @@ #import "UIView+Hippy.h" static void collectDirtyNonTextDescendants(HippyShadowText *renderObject, NSMutableArray *nonTextDescendants) { - for (HippyShadowView *child in renderObject.subcomponents) { + for (HippyShadowView *child in renderObject.hippySubviews) { if ([child isKindOfClass:[HippyShadowText class]]) { collectDirtyNonTextDescendants((HippyShadowText *)child, nonTextDescendants); } else if ([child isTextDirty]) { @@ -109,7 +109,7 @@ - (HippyViewManagerUIBlock)uiBlockToAmendWithShadowViewRegistry:(NSDictionary *)blocks return; } _propagationLifecycle = NativeRenderUpdateLifecycleComputed; - for (HippyShadowView *renderObjectView in self.subcomponents) { + for (HippyShadowView *renderObjectView in self.hippySubviews) { [renderObjectView amendLayoutBeforeMount:blocks]; } } @@ -160,15 +160,15 @@ - (void)setTextComputed { - (void)synchronousRecusivelySetCreationTypeToInstant { self.creationType = HippyCreationTypeInstantly; - for (HippyShadowView *subShadowView in self.subcomponents) { + for (HippyShadowView *subShadowView in self.hippySubviews) { [subShadowView synchronousRecusivelySetCreationTypeToInstant]; } } - (UIView *)createView:(HippyViewCreationBlock)creationBlock insertChildren:(HippyViewInsertionBlock)insertionBlock { UIView *container = creationBlock(self); - NSMutableArray *children = [NSMutableArray arrayWithCapacity:[self.subcomponents count]]; - for (HippyShadowView *subviews in self.subcomponents) { + NSMutableArray *children = [NSMutableArray arrayWithCapacity:[self.hippySubviews count]]; + for (HippyShadowView *subviews in self.hippySubviews) { UIView *subview = [subviews createView:creationBlock insertChildren:insertionBlock]; if (subview) { [children addObject:subview]; @@ -217,7 +217,7 @@ - (void)removeFromHippySuperview { [superview removeHippySubview:self]; } -- (NSArray *)subcomponents { +- (NSArray *)hippySubviews { return _objectSubviews; } @@ -415,7 +415,7 @@ - (void)setConfirmedLayoutDirection:(hippy::Direction)confirmedLayoutDirection { - (void)applyConfirmedLayoutDirectionToSubviews:(hippy::Direction)confirmedLayoutDirection { _confirmedLayoutDirection = confirmedLayoutDirection; - for (HippyShadowView *subviews in self.subcomponents) { + for (HippyShadowView *subviews in self.hippySubviews) { [subviews applyConfirmedLayoutDirectionToSubviews:confirmedLayoutDirection]; } } @@ -448,7 +448,7 @@ - (void)checkLayoutDirection:(NSMutableSet *)viewsSet directi - (void)superviewLayoutDirectionChangedTo:(hippy::Direction)direction { if (hippy::Direction::Inherit == self.layoutDirection) { self.confirmedLayoutDirection = ((HippyShadowView *)[self parent]).confirmedLayoutDirection; - for (HippyShadowView *subview in self.subcomponents) { + for (HippyShadowView *subview in self.hippySubviews) { [subview superviewLayoutDirectionChangedTo:self.confirmedLayoutDirection]; } } diff --git a/renderer/native/ios/renderer/component/view/UIView+DirectionalLayout.mm b/renderer/native/ios/renderer/component/view/UIView+DirectionalLayout.mm index 933ced8e60c..e1c5a8b2ea7 100644 --- a/renderer/native/ios/renderer/component/view/UIView+DirectionalLayout.mm +++ b/renderer/native/ios/renderer/component/view/UIView+DirectionalLayout.mm @@ -67,7 +67,7 @@ - (void)checkLayoutDirection:(NSMutableSet *)viewsSet direction:(hippy - (void)superviewLayoutDirectionChangedTo:(hippy::Direction)direction { if (hippy::Direction::Inherit == self.layoutDirection) { self.confirmedLayoutDirection = [self superview].confirmedLayoutDirection; - for (UIView *subview in self.subcomponents) { + for (UIView *subview in self.hippySubviews) { [subview superviewLayoutDirectionChangedTo:self.confirmedLayoutDirection]; } } diff --git a/renderer/native/ios/renderer/component/view/UIView+Hippy.mm b/renderer/native/ios/renderer/component/view/UIView+Hippy.mm index fff8fa4dc93..34b7a2e270b 100644 --- a/renderer/native/ios/renderer/component/view/UIView+Hippy.mm +++ b/renderer/native/ios/renderer/component/view/UIView+Hippy.mm @@ -140,7 +140,7 @@ - (NSNumber *)hippyTagAtPoint:(CGPoint)point { return view.hippyTag; } -- (NSArray *)subcomponents { +- (NSArray<__kindof id> *)hippySubviews { return objc_getAssociatedObject(self, _cmd); } @@ -160,14 +160,14 @@ - (void)setParent:(id)parent { - (void)insertHippySubview:(UIView *)subview atIndex:(NSUInteger)atIndex { // We access the associated object directly here in case someone overrides - // the `subcomponents` getter method and returns an immutable array. + // the `hippySubviews` getter method and returns an immutable array. if (nil == subview) { return; } - NSMutableArray *subviews = objc_getAssociatedObject(self, @selector(subcomponents)); + NSMutableArray *subviews = objc_getAssociatedObject(self, @selector(hippySubviews)); if (!subviews) { subviews = [NSMutableArray new]; - objc_setAssociatedObject(self, @selector(subcomponents), subviews, OBJC_ASSOCIATION_RETAIN_NONATOMIC); + objc_setAssociatedObject(self, @selector(hippySubviews), subviews, OBJC_ASSOCIATION_RETAIN_NONATOMIC); } if (atIndex <= [subviews count]) { @@ -188,8 +188,8 @@ - (void)moveHippySubview:(UIView *)subview toIndex:(NSUInteger)atIndex { - (void)removeHippySubview:(UIView *)subview { // We access the associated object directly here in case someone overrides - // the `subcomponents` getter method and returns an immutable array. - NSMutableArray *subviews = objc_getAssociatedObject(self, @selector(subcomponents)); + // the `hippySubviews` getter method and returns an immutable array. + NSMutableArray *subviews = objc_getAssociatedObject(self, @selector(hippySubviews)); [subviews removeObject:subview]; [subview sendDetachedFromWindowEvent]; [subview removeFromSuperview]; @@ -201,7 +201,7 @@ - (void)removeFromHippySuperview { } - (void)resetHippySubviews { - NSMutableArray *subviews = objc_getAssociatedObject(self, @selector(subcomponents)); + NSMutableArray *subviews = objc_getAssociatedObject(self, @selector(hippySubviews)); if (subviews) { [subviews makeObjectsPerformSelector:@selector(sendDetachedFromWindowEvent)]; [subviews makeObjectsPerformSelector:@selector(removeFromSuperview)]; @@ -241,13 +241,13 @@ - (void)setHippySubviewsUpdated:(BOOL)subViewsUpdated { if (!subviews) { // Check if sorting is required - in most cases it won't be BOOL sortingRequired = NO; - for (UIView *subview in self.subcomponents) { + for (UIView *subview in self.hippySubviews) { if (subview.hippyZIndex != 0) { sortingRequired = YES; break; } } - subviews = sortingRequired ? [self.subcomponents sortedArrayUsingComparator:^NSComparisonResult(UIView *a, UIView *b) { + subviews = sortingRequired ? [self.hippySubviews sortedArrayUsingComparator:^NSComparisonResult(UIView *a, UIView *b) { if (a.hippyZIndex > b.hippyZIndex) { return NSOrderedDescending; } else { @@ -255,7 +255,7 @@ - (void)setHippySubviewsUpdated:(BOOL)subViewsUpdated { // that original order is preserved return NSOrderedAscending; } - }] : self.subcomponents; + }] : self.hippySubviews; objc_setAssociatedObject(self, _cmd, subviews, OBJC_ASSOCIATION_RETAIN_NONATOMIC); } return subviews; diff --git a/renderer/native/ios/renderer/component/waterfalllist/HippyShadowWaterfallItem.m b/renderer/native/ios/renderer/component/waterfalllist/HippyShadowWaterfallItem.m index c5a1844cc13..ff409d7e967 100644 --- a/renderer/native/ios/renderer/component/waterfalllist/HippyShadowWaterfallItem.m +++ b/renderer/native/ios/renderer/component/waterfalllist/HippyShadowWaterfallItem.m @@ -54,7 +54,7 @@ - (void)amendLayoutBeforeMount:(NSMutableSet *)blocks _layoutDirty = YES; } _propagationLifecycle = NativeRenderUpdateLifecycleComputed; - for (HippyShadowView *renderObjectView in self.subcomponents) { + for (HippyShadowView *renderObjectView in self.hippySubviews) { [renderObjectView amendLayoutBeforeMount:blocks]; } } diff --git a/renderer/native/ios/renderer/component/waterfalllist/HippyWaterfallView.mm b/renderer/native/ios/renderer/component/waterfalllist/HippyWaterfallView.mm index 78925f3d7b3..36739531ff7 100644 --- a/renderer/native/ios/renderer/component/waterfalllist/HippyWaterfallView.mm +++ b/renderer/native/ios/renderer/component/waterfalllist/HippyWaterfallView.mm @@ -207,7 +207,7 @@ - (void)hippyBridgeDidFinishTransaction { } - (void)reloadData { - NSArray *datasource = [self.hippyShadowView.subcomponents copy]; + NSArray *datasource = [self.hippyShadowView.hippySubviews copy]; _dataSource = [[HippyWaterfallViewDataSource alloc] initWithDataSource:datasource itemViewName:[self compoentItemName] containBannerView:_containBannerView];