Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6287

DatePicker style container not

$
0
0

hey everybody I'm still new to the react native world.I'm using expo and the project is in typescript

I get this error when I try style date picker

eg<DatePickerstyle={styles.datepicker}. <-- error happens here

Type '{ style: { width: number; marginTop: number; }; date: string; mode: string; placeholder: string; format: string; minDate: string; maxDate: string; confirmBtnText: string; cancelBtnText: string; customStyles: { ...; }; onDateChange: (date: any) => void; }' is not assignable to type 'IntrinsicAttributes'.Property 'style' does not exist on type 'IntrinsicAttributes'.ts(2322)

import React, { use state } from 'react';import { Platform, View, Button,Text ,StyleSheet} from 'react-native';export default function DatePicker () {    const [date, setDate] = useState('09-10-2020');    return (<View style={styles.container}><Text style={styles.title}>            React Native Date Picker – To Pick the Date using Native Calendar</Text><DatePicker            style={styles.datePickerStyle}            date={date} //initial date from state            mode="date" //The enum of date, datetime and time            placeholder="select date"            format="DD-MM-YYYY"            minDate="01-01-2016"            maxDate="01-01-2019"            confirmBtnText="Confirm"            cancelBtnText="Cancel"            customStyles={{              dateIcon: {                //display: 'none',                position: 'absolute',                left: 0,                top: 4,                marginLeft: 0,              },              dateInput: {                marginLeft: 36,              },            }}            onDateChange={(date) => {              setDate(date);            }}          /></View>    );  };  const styles = StyleSheet.create({    container: {      flex: 1,      padding: 10,      justifyContent: 'center',      alignItems: 'center',    },    title: {      textAlign: 'center',      fontSize: 20,      fontWeight: 'bold',      padding: 20,    },    datePickerStyle: {      width: 200,      marginTop: 20,    },  }); ```

Viewing all articles
Browse latest Browse all 6287

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>