aboutsummaryrefslogtreecommitdiff
path: root/src/components/profile/ToggleButton.tsx
blob: 4c8cb5b95164f0facb6053a7fb77e0262d58c596 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import * as React from 'react';
import {StyleSheet, Text} from 'react-native';
import {TouchableOpacity} from 'react-native-gesture-handler';
import { TAGG_TEXT_LIGHT_BLUE } from '../../constants';
import {getToggleButtonText, SCREEN_HEIGHT, SCREEN_WIDTH} from '../../utils';

type ToggleButtonProps = {
  toggleState: boolean;
  handleToggle: Function;
  buttonType: string;
};

const ToggleButton: React.FC<ToggleButtonProps> = ({
  toggleState,
  handleToggle,
  buttonType,
}) => {
  return (
    <TouchableOpacity style={styles.button} onPress={() => handleToggle()}>
      <Text style={styles.text}>
        {getToggleButtonText(buttonType, toggleState)}
      </Text>
    </TouchableOpacity>
  );
};

const styles = StyleSheet.create({
  button: {
    justifyContent: 'center',
    alignItems: 'center',
    width: SCREEN_WIDTH * 0.25,
    height: SCREEN_WIDTH * 0.1,
    borderRadius: 8,
    marginTop: '3%',
    borderColor: TAGG_TEXT_LIGHT_BLUE,
    backgroundColor: 'white',
    borderWidth: 3,
    marginHorizontal: '1%',
  },
  text: {
    fontWeight: 'bold',
    color: TAGG_TEXT_LIGHT_BLUE,
  },
});
export default ToggleButton;