[DealsLayout] Sold out overlay label not showing
Closed this issue · 2 comments
stowy commented
The sold out overlay needs to show for sold out deals. This consists of a centered 'Sold Out' label over the image, and an overlay over the top of the whole deal card with an alpha.
This is attempted here:
ASOverlayLayoutSpec *soldOut = [ASOverlayLayoutSpec overlayLayoutSpecWithChild:self.soldOutOverlay overlay:self.soldOutOverlayTop];
soldOut.flexGrow = YES;
ASOverlayLayoutSpec *soldOutOverImage = [ASOverlayLayoutSpec overlayLayoutSpecWithChild:imagePlace overlay:soldOut];
However it doesn't show the soldOutOverlayTop or the sold out label which is a subnode of the sold out overlay, see:
self.soldOutLabelFlat = [[ASTextNode alloc] init];
self.soldOutLabelFlat.alignSelf = ASStackLayoutAlignSelfCenter;
self.soldOutLabelFlat.flexGrow = YES;
self.soldOutLabelFlat.backgroundColor = [[UIColor whiteColor] colorWithAlphaComponent:0.9];
self.soldOutLabelFlat.sizeRange = ASRelativeSizeRangeMake(ASRelativeSizeMake(ASRelativeDimensionMakeWithPercent(0), ASRelativeDimensionMakeWithPoints(50.0)), ASRelativeSizeMake(ASRelativeDimensionMakeWithPercent(100), ASRelativeDimensionMakeWithPoints(50.0)));
self.soldOutOverlayTop = [[ASDisplayNode alloc] init];
self.soldOutOverlayTop.flexGrow = YES;
self.soldOutOverlayTop.backgroundColor = [[UIColor whiteColor] colorWithAlphaComponent:0.5];
self.soldOutOverlay = [[ASDisplayNode alloc] init];
self.soldOutOverlay.backgroundColor = [UIColor clearColor];
[self.soldOutOverlay addSubnode:self.soldOutLabelFlat];
[self.soldOutOverlay addSubnode:self.soldOutOverlayTop];
self.soldOutOverlay.hidden = YES;
[self addSubnode:self.soldOutOverlay];
stowy commented
Note for now I have added manual layout of the sold out overlay and label, however the text label does not centrally align. Do you have an idea @appleguy?
stowy commented
Resolved using a combination of overlay spec, static spec, center spec and background spec.