DocsHooks & utilities
Special core
The ruler, dial, zoom and haptics helpers the special components share.
The special language: a ruler that scrolls a value under a pointer, a windowed tick strip, rotary and zoom gestures, step haptics, adjustable accessibility, unit conversion and the capture adapter type.
ProVersion 1.0.1Released 11 Nov 2026iOS and Android
When to use it
- Building a ruler, tape, dial, wheel or zoomable canvas that should feel like the rest of the special family.
- Scrolling a value under a fixed pointer with momentum, snapping, a rubber band and a tick per step.
- Adding pinch, pan and double-tap zoom to a map of seats, tables or anything else.
When not to use it
- Picking a height, a weight or a seat in an app screen: use the special items, which compose this.
- A plain slider with a thumb on a track: use Slider.
Installation
Installs with a Pro licence
Everything on this page is public except the source. Founder pre-sale opens around 5 January 2027.
Usage
import { RulerStrip, useRulerScroll } from '@/components/swipeui/lib/special-core';
const ruler = useRulerScroll({
value: age,
min: 13,
max: 100,
step: 1,
pointsPerStep: 12,
axis: 'x',
direction: -1,
onChange: setAge,
onCommit: saveAge,
});
<GestureDetector gesture={ruler.gesture}>
<View className="h-20 overflow-hidden">
<RulerStrip position={ruler.position} window={ruler.window} min={13} step={1} pointsPerStep={12} axis="x" direction={-1} />
</View>
</GestureDetector>;useRulerScrollmoves a value under a fixed pointer: momentum that lands on a step, a rubber band at the ends, fine scrubbing across the ruler, oneonChangeper step and oneonCommitwhen it settles.RulerStripdraws the ticks and labels for the window the hook returns, so a ruler with thousands of steps mounts about a hundred views.useRotaryGesture, withangleOf,shortestDelta,polarandarcPath, handles dragging round a centre.useZoomPanadds pinch, pan and double-tap zoom to a canvas, withzoomToandreset.useStepHapticsplays throttled per-part ticks, anduseAdjustablegives any scrub a screen-reader path.CaptureAdapteris the type of the function you pass to save a view as an image; SwipeUI ships no capture dependency.
Behavior and gestures
- useRulerScroll: drag to move the value; a flick carries on and lands on a step; the ends stretch and spring back; moving across the ruler slows the rate.
- useRotaryGesture: drag round a centre; it reports small signed turns and the release speed.
- useZoomPan: pinch about the fingers, drag to pan, double-tap to zoom in and back out; everything springs back inside its bounds.
Accessibility
- useAdjustable gives any scrub one adjustable element with a spoken value and increment and decrement actions.
- RulerStrip is decoration and is hidden from screen readers; the element that owns the gesture carries the name and value.
Motion
- Uses the
dragmotion role, so it follows your app's feel. Passmotionto tune this one instance. - Glides and spring-backs use the drag role with overshoot clamped, so a value never passes where it lands.
- Reduce Motion: the ruler still follows the finger; flings, glides and rubber bands go, and the value lands at once.
Performance
- A ruler with thousands of steps mounts only the ticks near the value, and re-windows in React once every dozen steps.
- Step callbacks are compared on the UI thread and cross to React once per step; haptics are throttled to one every 30 milliseconds.
Notes for AI
- Values have a canonical unit (centimetres, kilograms); convert only for display so switching units never drifts.
- Worklet callbacks given to useRotaryGesture must be worklets; read shared values directly inside animated styles.
- CaptureAdapter is a type only: pass captureRef from react-native-view-shot or a Skia snapshot.
Compatibility
| Runs on | Supported |
|---|---|
| Expo SDK 57 | Yes |
| Expo SDK 58 | Yes |
| React Native CLI (with Expo modules) | Yes |
| Expo Go | Yes |
| iOS | Yes |
| Android | Yes |
This table describes API support and static bundle checks. Native runtime, device accessibility and bare Uniwind compatibility remain pending.