aboutsummaryrefslogtreecommitdiff
path: root/src/components/onboarding/TaggDatePicker.tsx
blob: 39af6234d1c8b06e93213c1af6a8c311c940ccda (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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import React from 'react';
import DatePicker from 'react-native-datepicker';
import {View, StyleSheet, TextInputProps} from 'react-native';

interface TaggDatePickerProps extends TextInputProps {
  width?: number | string;
  date?: string;
  maxDate?: Date | string;
}
/**
 * An input component that receives all props a normal TextInput component does. TaggInput components grow to 60% of their parent's width by default, but this can be set using the `width` prop.
 */
const TaggDatePicker = React.forwardRef(
  (props: TaggDatePickerProps, ref: any) => {
    return (
      <View style={styles.container}>
        <DatePicker
          {...props}
          style={styles.input}
          placeholder={'Date of Birth'}
          showIcon={false}
          ref={ref}
          format={'YYYY-MM-DD'}
          customStyles={{
            placeholderText: {
              color: '#ddd',

              fontSize: 16,
              fontWeight: '600',
            },
            dateText: {
              color: '#fff',
              fontSize: 16,
              fontWeight: '600',
            },
            dateInput: {
              borderColor: '#fffdfd',
              borderWidth: 2,
              borderRadius: 20,
              justifyContent: 'center',
              alignItems: 'flex-start',
              paddingLeft: 13,
            },
          }}
        />
      </View>
    );
  },
);

const styles = StyleSheet.create({
  container: {
    width: '100%',
    alignItems: 'center',
    marginVertical: 11,
  },
  input: {
    minWidth: '67%',
    height: 40,
  },
});

export default TaggDatePicker;