mirror of
https://gitcode.com/GitHub_Trending/ji/jitsi-meet.git
synced 2026-05-13 13:52:29 +00:00
ref(ui-components) Improve native and web Switch (#12061)
Bring Switch component more in line Convert some files to TS
This commit is contained in:
35
react/features/base/ui/components/native/Switch.tsx
Normal file
35
react/features/base/ui/components/native/Switch.tsx
Normal file
@@ -0,0 +1,35 @@
|
||||
import React from 'react';
|
||||
import { ColorValue } from 'react-native';
|
||||
import { Switch as NativeSwitch } from 'react-native-paper';
|
||||
|
||||
import { SwitchProps } from '../types';
|
||||
|
||||
interface Props extends SwitchProps {
|
||||
|
||||
/**
|
||||
* 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, trackColor, style }: Props) => (
|
||||
<NativeSwitch
|
||||
disabled = { disabled }
|
||||
onValueChange = { onChange }
|
||||
style = { style }
|
||||
thumbColor = { thumbColor }
|
||||
trackColor = { trackColor }
|
||||
value = { checked } />
|
||||
);
|
||||
|
||||
export default Switch;
|
||||
Reference in New Issue
Block a user