Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 6 additions & 1 deletion .maestro/scripts/setup-ios-simulator.sh

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated: fix to a flaky maestro setup that sometimes does infinite wait on this step

Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,13 @@ if [ "$STATE" != "(Booted)" ]; then
xcrun simctl boot "$UDID"
# `bootstatus -b` exits before the app registry is ready on some runtimes.
# Polling listapps for a built-in app is better signal that SpringBoard is up.
echo "Waiting for simulator to finish booting..."
echo "Waiting for simulator to finish booting (max 20s)..."
SECONDS=0
until xcrun simctl listapps "$UDID" 2>/dev/null | grep -q "com.apple.Preferences"; do
if (( SECONDS >= 20 )); then
echo "Timed out waiting for SpringBoard; continuing to build step to unstick the simulator."
break
fi
sleep 2
done
fi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,14 @@ class UnorderedListSpan(
}

private val radius: Float = listStyle.bulletSize / 2f
private val ringStrokeWidth: Float = radius * 0.3f
private val markerColumnWidth: Float = listStyle.effectiveMarkerWidth(radius)

private fun configureBulletPaint(): Paint =
sharedBulletPaint.apply {
color = listStyle.bulletColor
style = Paint.Style.FILL
strokeWidth = 0f
}

override fun getMarkerWidth(): Float = markerColumnWidth
Expand All @@ -64,6 +67,26 @@ class UnorderedListSpan(
val fontMetrics = paint.fontMetrics
val bulletY = baseline + (fontMetrics.ascent + fontMetrics.descent) / 2f

canvas.drawCircle(bulletX, bulletY, radius, bulletPaint)
when (depth) {
0 -> {
canvas.drawCircle(bulletX, bulletY, radius, bulletPaint)
}

1 -> {
bulletPaint.style = Paint.Style.STROKE
bulletPaint.strokeWidth = ringStrokeWidth
canvas.drawCircle(bulletX, bulletY, radius - ringStrokeWidth / 2f, bulletPaint)
}

else -> {
canvas.drawRect(
bulletX - radius,
bulletY - radius,
bulletX + radius,
bulletY + radius,
bulletPaint,
)
}
}
}
}
4 changes: 2 additions & 2 deletions ios/styles/StyleConfig.h

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unrelated: this removes a lot of build warnings

Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic, strong, nullable) RCTUIColor *backgroundColor;
@end

NS_ASSUME_NONNULL_END

@interface StyleConfig : NSObject <NSCopying>
- (instancetype)init;
- (CGFloat)fontScaleMultiplier;
Expand Down Expand Up @@ -400,3 +398,5 @@ NS_ASSUME_NONNULL_END
- (void)setSubscriptBaselineOffsetScale:(CGFloat)newValue;

@end

NS_ASSUME_NONNULL_END
30 changes: 24 additions & 6 deletions ios/utils/ListMarkerDrawer.m
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,10 @@ - (void)drawMarkersForGlyphRange:(NSRange)glyphsToShow
checked:checked];
} else if ([attrs[ListTypeAttribute] integerValue] == ListTypeUnordered) {
UIFont *font = attrs[NSFontAttributeName] ?: [self defaultFont];
NSInteger depth = [attrs[ListDepthAttribute] integerValue];
[self drawBulletAtX:markerX
centerY:baselineY - (font.xHeight + font.capHeight) / 4.0];
centerY:baselineY - (font.xHeight + font.capHeight) / 4.0
depth:depth];
} else {
[self drawOrderedMarkerAtX:markerX attrs:attrs baselineY:baselineY isRTL:isRTL];
}
Expand Down Expand Up @@ -138,13 +140,29 @@ - (void)drawCheckmarkInsideRect:(CGRect)rect size:(CGFloat)size
[checkmark stroke];
}

- (void)drawBulletAtX:(CGFloat)x centerY:(CGFloat)y
- (void)drawBulletAtX:(CGFloat)x centerY:(CGFloat)y depth:(NSInteger)depth
{
CGFloat size = [_config listStyleBulletSize];
CGRect rect = CGRectMake(x - size / 2.0, y - size / 2.0, size, size);
[self
executeDrawing:^(CGContextRef ctx) {
[[_config listStyleBulletColor] setFill];
CGFloat size = [_config listStyleBulletSize];
CGContextFillEllipseInRect(ctx, CGRectMake(x - size / 2.0, y - size / 2.0, size, size));
switch (depth) {
case 0:
[[_config listStyleBulletColor] setFill];
CGContextFillEllipseInRect(ctx, rect);
break;
case 1: {
CGFloat lineWidth = MAX(1.0, size * 0.15);
[[_config listStyleBulletColor] setStroke];
CGContextSetLineWidth(ctx, lineWidth);
CGContextStrokeEllipseInRect(ctx, CGRectInset(rect, lineWidth / 2.0, lineWidth / 2.0));
break;
}
default:
[[_config listStyleBulletColor] setFill];
CGContextFillRect(ctx, rect);
break;
}
}
atX:x
y:y];
Expand Down Expand Up @@ -192,4 +210,4 @@ - (BOOL)isValidX:(CGFloat)x y:(CGFloat)y
return !isnan(x) && !isinf(x) && !isnan(y) && !isinf(y);
}

@end
@end
Loading