2024-03-16 14:11:43 +08:00

73 lines
2.2 KiB
TypeScript

import { Component } from 'react';
import { Animated, PanResponderInstance, ViewStyle } from 'react-native';
export interface SwitchProps {
testID?: string;
style?: ViewStyle | ViewStyle[];
value?: boolean;
disabled?: boolean;
rockerSize?: 'lg' | 'sm';
activeColor?: string;
onChange?: Function;
}
export interface SwitchState {
value: boolean;
toggleable: boolean;
alignItems: 'flex-end' | 'flex-start';
handlerAnimation: Animated.Value;
switchAnimation: Animated.Value;
}
export declare class Switch extends Component<SwitchProps, SwitchState> {
static defaultProps: {
style: {};
value: boolean;
disabled: boolean;
rockerSize: string;
activeColor: any;
};
offset: number;
panResponder: PanResponderInstance;
shadowColor: string;
constructor(props: any);
componentWillReceiveProps(nextProps: any): void;
componentWillMount(): void;
onPanResponderGrant: () => void;
onPanResponderMove: (evt: any, gestureState: any) => void;
onPanResponderRelease: () => void;
/**
* 切换
*/
toggleSwitch: (result: any, callback: Function) => void;
toggleSwitchToValue: (result: any, toValue?: any, callback?: Function) => void;
animateSwitch: (value: any, callback?: () => any) => void;
animateHandler: (value: any, callback?: () => any) => void;
circlePosition: (value: any) => number;
getContainBaseStyle: () => {
width: number;
height: number;
alignItems: "flex-start" | "flex-end";
borderRadius: number;
borderWidth: number;
borderColor: string;
backgroundColor: Animated.AnimatedInterpolation;
};
getRockerBaseStyle: () => {
backgroundColor: Animated.AnimatedInterpolation;
width: Animated.Value;
height: number;
marginHorizontal: number;
borderRadius: number;
shadowColor: any;
shadowOffset: {
h: number;
w: number;
};
shadowRadius: number;
shadowOpacity: number;
transform: {
translateX: Animated.AnimatedInterpolation;
}[];
borderColor: any;
};
render(): JSX.Element;
}