mirror of
https://gitcode.com/GitHub_Trending/ji/jitsi-meet.git
synced 2026-04-30 16:00:19 +00:00
Replace tokens with ones that are part of the Design System and are either the same or very similar
53 lines
1.0 KiB
TypeScript
53 lines
1.0 KiB
TypeScript
import React from 'react';
|
|
import { ColorValue } from 'react-native';
|
|
import { Switch as NativeSwitch } from 'react-native-paper';
|
|
|
|
import { ISwitchProps } from '../types';
|
|
|
|
import {
|
|
DISABLED_TRACK_COLOR,
|
|
ENABLED_TRACK_COLOR,
|
|
THUMB_COLOR
|
|
} from './switchStyles';
|
|
|
|
interface IProps extends ISwitchProps {
|
|
|
|
/**
|
|
* Custom styles for the switch.
|
|
*/
|
|
style?: Object;
|
|
|
|
/**
|
|
* Color of the switch button.
|
|
*/
|
|
thumbColor?: ColorValue;
|
|
|
|
/**
|
|
* Color of the switch background.
|
|
*/
|
|
trackColor?: Object;
|
|
}
|
|
|
|
const Switch = ({
|
|
checked,
|
|
disabled,
|
|
onChange,
|
|
thumbColor = THUMB_COLOR,
|
|
trackColor = {
|
|
true: ENABLED_TRACK_COLOR,
|
|
false: DISABLED_TRACK_COLOR
|
|
},
|
|
style
|
|
}: IProps) => (
|
|
<NativeSwitch
|
|
disabled = { disabled }
|
|
ios_backgroundColor = { DISABLED_TRACK_COLOR }
|
|
onValueChange = { onChange }
|
|
style = { style }
|
|
thumbColor = { thumbColor }
|
|
trackColor = { trackColor }
|
|
value = { checked } />
|
|
);
|
|
|
|
export default Switch;
|