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:
Robert Pintilii
2022-08-24 12:46:22 +03:00
committed by GitHub
parent 6d39d13af7
commit 8dd71a921b
11 changed files with 153 additions and 114 deletions

View 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;