Closed stepancar closed 9 years ago
Hello, it's okey.
Hi @stepancar I'm using the typed definition in my project, but I keep getting an error on rendering. I'm trying to import the component but it says there has no default export.
Here's how I import the component:
import ReactInputCalendar from 'react-input-calendar';
I tried this way as well
import * as ReactInputCalendar from 'react-input-calendar';
But I'm getting a console error on rendering
Warning: React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: object.
Uncaught Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object.
Here's the entire code in my component:
import * as React from "react";
import {observer} from "mobx-react";
import * as ReactInputCalendar from 'react-input-calendar';
import KonaComponent from "../KonaComponent/KonaComponent";
interface Props {
date?: string | Date;
startDate?: string | Date;
endDate?: string | Date;
format?: string;
onChange?: (date: string) => void;
placeholder?: string;
}
@observer
export default class DatePicker extends KonaComponent<Props> {
render(): any {
const {date, startDate, endDate, format, onChange, placeholder} = this.props;
return (
<div>
<ReactInputCalendar date={date} placeholder={placeholder} />
</div>
);
}
}
@abelski21 , as I understand, definitions is obsolete. I will try to update it at next week. But its free to send PR. I can help you with review
Hello! Thank you for this calendar! I added defintions for typescript please, check definitions for your library if all correct - add comment that all ok Thank you!