Skip to main content
Version: 1.x (Reanimated 4)

Fill & Stroke

Every shape shares the same paint model: an optional fill and an optional stroke. A shape with neither draws nothing.

Fill

PropTypeDefaultDescription
fillstringNoneFill color (any CSS color string, e.g. '#8a2be2', 'rgb(…)', 'tomato').
fillEnabledbooleantrueSet false to temporarily disable the fill without removing it.
<Rect x={20} y={20} width={120} height={80} fill="#8a2be2" />
Solid fill

Stroke

PropTypeDefaultDescription
strokestringNoneStroke color.
strokeWidthnumber2Stroke width in points.
strokeEnabledbooleantrueSet false to disable the stroke.
lineCap'butt' | 'round' | 'square'NoneHow open line ends are drawn.
lineJoin'miter' | 'round' | 'bevel'NoneHow corners are drawn.
hitStrokeWidthnumberstrokeWidthStroke width used for hit-testing (make thin lines easier to tap).
<Rect
x={20}
y={20}
width={120}
height={80}
fill="#fff"
stroke="#1b0030"
strokeWidth={4}
/>
Fill and stroke

A shape can have both: the fill is painted first, then the stroke on top.

Line caps and joins

lineCap shapes the ends of open paths; lineJoin shapes the corners. They matter most for thick Line strokes:

<Line points={pts} stroke="#22d3ee" strokeWidth={16} lineCap="round" lineJoin="round" />
<Line points={pts} stroke="#ff5aa5" strokeWidth={16} lineCap="butt" lineJoin="miter" />
Line caps and joins

Dashed strokes

PropTypeDefaultDescription
dashnumber[]NoneDash pattern [on, off, on, off, …] in points.
dashOffsetnumber0Starting offset into the pattern.
dashEnabledbooleantrueSet false to disable dashing.
<Rect
x={20}
y={20}
width={140}
height={90}
stroke="#8a2be2"
strokeWidth={3}
dash={[12, 8]}
/>
Dashed stroke

See also