@nghinv/react-native-switch
Version:
React Native switch Library
54 lines (53 loc) • 1.42 kB
TypeScript
/**
* Created by nghinv on Fri Jun 18 2021
* Copyright (c) 2021 nghinv@lumi.biz
*/
import React from 'react';
import { StyleProp, ViewStyle, ViewProps } from 'react-native';
import Animated from 'react-native-reanimated';
interface SwitchProps extends ViewProps {
/**
* Size of thumb default = 27
*/
size?: number;
/**
* Color of the foreground switch grip.
*/
thumbColor?: string;
/**
* Custom colors for the switch track
*
* Color when false and color when true
*/
trackColor?: {
false?: string | null;
true?: string | null;
};
/**
* If true the user won't be able to toggle the switch.
* Default value is false.
*/
disabled?: boolean;
/**
* The value of the switch. If true the switch will be turned on.
* Default value is false.
*/
value?: boolean;
/**
* Invoked with the the change event as an argument when the value changes.
*/
onChange?: (value: boolean) => void | null;
style?: StyleProp<ViewStyle>;
progress?: Animated.SharedValue<number>;
}
declare function Switch(props: SwitchProps): JSX.Element;
declare namespace Switch {
var defaultProps: {
size: number;
thumbColor: string;
value: boolean;
disabled: boolean;
};
}
declare const _default: React.MemoExoticComponent<typeof Switch>;
export default _default;