This repository has been archived on 2026-04-20. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
interaktive-systeme/components/home/addItem/DateSelectorButton.tsx
2024-01-05 00:46:40 +01:00

38 lines
No EOL
1.3 KiB
TypeScript

import { View, Text, StyleSheet, TouchableOpacity, TouchableOpacityProps } from 'react-native'
import React, { useState } from 'react'
import { useTheme } from '../../../app/contexts/ThemeContext';
import { SIZES } from '../../../constants/theme';
import { SimpleDate } from '../../../util/SimpleDate';
import { ViewProps } from 'react-native/Libraries/Components/View/ViewPropTypes';
interface DateSelectorProps extends ViewProps {
onPress?: ()=>void | undefined;
selectedDate: Date
}
const DateSelectorButton:React.FC<DateSelectorProps> = (props: DateSelectorProps) => {
const {onPress, selectedDate, ...restProps} = props;
const {colors} = useTheme();
return (
<TouchableOpacity onPress={onPress} {...restProps} style={[styles.inputContainer, {backgroundColor: colors.elementDefaultColor}]}>
<Text style={[styles.text, {color: colors.primaryText}]}>Date:</Text>
<Text style={[styles.text, {color: colors.primaryText}]}>{new SimpleDate(selectedDate).format("DD.MM.YYYY")}</Text>
</TouchableOpacity>
)
}
const styles = StyleSheet.create({
inputContainer: {
minHeight: 50,
borderRadius: 20,
flexDirection: "row",
justifyContent: 'space-between',
alignItems: "center"
},
text:{
fontSize: SIZES.large,
marginHorizontal: 15,
},
})
export default DateSelectorButton