react-native-redash
Version:
Utility library for React Native Reanimated
126 lines (125 loc) • 2.7 kB
TypeScript
import React from "react";
import Animated from "react-native-reanimated";
import { StyleProp, ViewStyle } from "react-native";
interface SnapPoint {
x?: number;
y?: number;
damping?: number;
tension?: number;
id?: string;
}
interface InfluenceArea {
left?: number;
right?: number;
top?: number;
bottom?: number;
}
interface SpringPoint {
x?: number;
y?: number;
tension?: number;
damping?: number;
influenceArea?: InfluenceArea;
}
interface GravityPoint {
x?: number;
y?: number;
strength?: number;
falloff?: number;
damping?: number;
influenceArea?: InfluenceArea;
}
interface FrictionArea {
damping?: number;
influenceArea?: InfluenceArea;
}
interface Position {
x: number;
y: number;
}
interface Boundaries {
left?: number;
right?: number;
top?: number;
bottom?: number;
bounce?: number;
}
export interface InteractableProps {
snapPoints: SnapPoint[];
springPoints?: SpringPoint[];
gravityPoints?: GravityPoint[];
frictionAreas?: FrictionArea[];
horizontalOnly?: boolean;
verticalOnly?: boolean;
animatedValueX?: any;
animatedValueY?: any;
style?: StyleProp<ViewStyle>;
dragEnabled: boolean;
onSnap?: (e: {
nativeEvent: SnapPoint & {
index: number;
};
}) => void;
onStop?: (e: {
nativeEvent: {
x: number;
y: number;
};
}) => void;
onDrag?: (e: {
nativeEvent: {
x: number;
y: number;
state: "start" | "end";
};
}) => void;
initialPosition: Position;
dragToss: number;
dragWithSpring?: {
tension: number;
damping: number;
};
boundaries?: Boundaries;
}
export declare class Interactable extends React.PureComponent<InteractableProps> {
static defaultProps: {
dragToss: number;
dragEnabled: boolean;
initialPosition: {
x: number;
y: number;
};
};
transY: any;
transX: any;
onGestureEvent: any;
position: {
x: any;
y: any;
};
dragging: {
x?: any;
y?: any;
};
snapAnchor: {
x: any;
y: any;
tension: any;
damping: any;
};
velocity: {
x?: any;
y?: any;
};
constructor(props: InteractableProps);
setVelocity({ x, y }: {
x: Animated.Adaptable<number>;
y: Animated.Adaptable<number>;
}): void;
changePosition({ x, y }: {
x: Animated.Adaptable<number>;
y: Animated.Adaptable<number>;
}): void;
render(): JSX.Element;
}
export {};