motion
Create an instance-local motion value during component initialization.
In a native module's spec, motion<T>() declares one the platform writes
(docs/native-modules.md#motion-values).
Verwendung
Drag and release
import { Box, decay, motion, pan } from 'kuito';
export function Drawer() {
const drag = pan({ axis: 'y' }).release(decay({ clamp: [0, 400] }));
const y = motion(0).follows(drag.y);
return <Box gestures={[drag]} translateY={y} height={120} backgroundColor="#0f172a" />;
}Signaturen
Überladung 1
<T>(): Motion<T | null>Typparameter
| Name | Einschränkung | Standard |
|---|---|---|
T | — | — |
Parameter
Keine Parameter.
Rückgabe
Motion<T>
Überladung 2
<T>(initial: T, name?: string): Motion<T>Typparameter
| Name | Einschränkung | Standard |
|---|---|---|
T | — | — |
Parameter
| Name | Typ | Erforderlich | Beschreibung |
|---|---|---|---|
initial | T | Ja | — |
name | string | Nein | — |
Rückgabe
Motion<T>
Generiert aus den öffentlichen TypeScript-Deklarationen: Signaturen, Props und Standardwerte stammen aus der geprüften Quelle, Beschreibungen aus deren JSDoc. Kein Standardwert ist erfunden.