| 123456789101112131415161718192021222324252627282930 |
- import React from 'react';
- import { Switch, SwitchProps, Text, View } from 'react-native';
- import Animated from 'react-native-reanimated';
- import utils from '../utils/utils';
- //const switchStyle = { false: "#B2B2B2", true: colorAccent };
- export default SwitchBase = (props, {...SwitchProps}) => {
- const colors = utils.hexColorToRgb(colorAccent);
- var thumbColor = null;
- var trackColor = { false: "#B2B2B2", true: colorAccent }
- if (!isIOS) {
- thumbColor = (props.value ? utils.getRgbaColor(colors, 0.9) : "#EBEDEC")
- trackColor = {false: "#B2B2B2", true: utils.getRgbaColor(colors, 0.3)}
- }
- return (
- <Animated.View style={ui.flexc}>
- <Switch
- {...props}
- trackColor={trackColor}
- thumbColor={thumbColor}
- />
- {/* <Switch
- {...props}
- />
- <Text style={{color: utils.getRgbaColor(colors, 0.9)}}>■■■</Text>
- <Text style={{color: utils.getRgbaColor(colors, 0.3)}}>■■■</Text> */}
- </Animated.View>
- );
- }
|