UNPKG

@uiw/react-native

Version:
42 lines (41 loc) 1.23 kB
import React from 'react'; import { Animated, SwitchProps as SwitchPropsDefault, ViewStyle, LayoutChangeEvent } from 'react-native'; export interface SwitchProps extends SwitchPropsDefault { trackStyle?: ViewStyle; thumbStyle?: ViewStyle; checked?: boolean; color?: string; /** * 设置大小 */ size?: 'small' | 'default' | 'large'; } export interface SwitchState { checked: boolean; borderValue: Animated.Value; translateXValue: Animated.Value; bgOpacity: Animated.Value; containerSize: { width: number; height: number; }; control: 'props' | 'state'; animatedStart: (checked: boolean) => void; } export default class Switch extends React.Component<SwitchProps, SwitchState> { translateXValue: number; height: number; static defaultProps: SwitchProps; private animatedStart; constructor(props: SwitchProps); static getDerivedStateFromProps(props: SwitchProps, state: SwitchState): { control: string; checked?: undefined; } | { checked: boolean; control: string; } | null; onPress: () => void; measureContainer: (event: LayoutChangeEvent) => void; render(): JSX.Element; }