ts
import { Blur, Label } from "@apricotjs/react-native";
import type { BlurProps, LabelProps } from "@apricotjs/react-native";Label#
A React Native view pinned to a point in the scene. It can hold any views. Put it inside <Scene>.
It hides when the point is behind the camera or far off screen. It stays hidden until the scene has drawn its content.
With Reanimated installed, labels move without a React render per frame. Without it, each label re-renders as it moves, which is fine for a few labels.
| Prop | Type | Default | Description |
|---|---|---|---|
attach |
RefObject<SceneObject | null> | SceneObject | null |
The object to follow, such as a train car or a model | |
position |
Vec3 |
[0, 0, 0] |
Without attach, the point in its parent's space (a <Group>'s, inside one). With attach, an offset from the object along world axes, so the label stays above a turning car |
anchor |
"bottom" | "center" | "top" |
"bottom" |
Which part of the label sits on the point. "bottom" places it above the point, like a map pin |
style |
StyleProp<ViewStyle> |
Style for the label's view | |
children |
ReactNode |
The views to show |
The label's view does not take touches itself (pointerEvents: "box-none"). Buttons inside it do.
tsx
<Label attach={car} position={[0, 2, 0]}>
<Text style={{ backgroundColor: "white", padding: 4, borderRadius: 6 }}>Your ride</Text>
</Label>Blur#
Draws its children out of focus, behind everything else. They are lit like the rest of the scene.
| Prop | Type | Default | Description |
|---|---|---|---|
radius |
points | 6 |
How soft. You can change it at any time |
children |
ReactNode |
What to blur |
- Blurred objects are always behind the sharp ones, whatever their depth.
- Use one
<Blur>per scene. - The layer is blank until the blurred objects are ready to draw.