This documentation is available as Markdown for AI agents and LLMs. See the full Markdown index or append .md to any documentation URL.
Shape
用于绘制几何形状的 Jetpack Compose Shape 组件。
Expo UI Shape 与官方 Jetpack Compose Shapes API 相匹配,并提供一组子组件,用于绘制星形、圆形、矩形、药丸形和多边形等几何形状。


安装
If you are installing this in an existing React Native app, make sure to install expo in your project.
用法
基本形状
使用 Shape 子组件渲染常见形状。
圆角形状
使用 cornerRounding 和 smoothing 自定义形状的外观。
多边形和星形变体
使用 verticesCount 和 innerRadius 控制形状的几何结构。
API
import { Shape } from '@expo/ui/jetpack-compose';
Constants
Type: {
Circle: (props: Pick<ShapeProps, 'radius' | 'verticesCount' | 'color' | 'modifiers'>) => ShapeJSXElement,
Pill: (props: Pick<ShapeProps, 'smoothing' | 'color' | 'modifiers'>) => ShapeJSXElement,
PillStar: (props: ShapeProps) => ShapeJSXElement,
Polygon: (props: Pick<ShapeProps, 'smoothing' | 'cornerRounding' | 'verticesCount' | 'color' | 'modifiers'>) => ShapeJSXElement,
Rectangle: (props: Pick<ShapeProps, 'smoothing' | 'cornerRounding' | 'color' | 'modifiers'>) => ShapeJSXElement,
RoundedCorner: (props: Pick<ShapeProps, 'cornerRadii' | 'color' | 'modifiers'>) => ShapeJSXElement,
Star: (props: ShapeProps) => ShapeJSXElement
}
Props
CornerRadiiCorner radii for RoundedCorner shape. Values are in dp.
number • Default: 0.0Corner rounding percentage. Multiplied by the shorter dimension of the view to produce pixel values.
number • Default: 1.0Inner radius of star-related shapes ('STAR' and 'PILL_STAR'). Multiplied by the shorter dimension of the view to produce pixel values.
number • Default: 1.0Radius of the circular shape. Multiplied by the shorter dimension of the view to produce pixel values.
number • Default: 0.0Number between 0.0 and 1.0 that determines how much each line between vertices is "smoothed".