rmc-calendar
React Mobile Calendar Component (web)
Screenshots
Development
npm i
npm start
Example
http://localhost:8000/examples/
online example: http://react-component.github.io/m-calendar/
react-native (TBC)
./node_modules/rc-tools run react-native-init
npm run watch-tsc
react-native start
react-native run-ios
install
docs
Usage
import React, { Component } from 'react';
import { Calendar } from 'rmc-calendar';
import 'rmc-calendar/assets/index.css';
class App extends Component {
constructor(props) {
super(props);
this.state = {
visible: false,
};
}
setVisiable = () => {
this.setState({
visible: !this.state.visible,
});
}
render() {
return (
<div className="App">
<Calendar
visible={this.state.visible}
onCancel={this.setVisiable}
onConfirm={this.setVisiable}
/>
</div>
);
}
}
export default App;
API
Calendar props
interface PropsType {
enterDirection?: 'horizontal' | 'vertical';
locale?: GlobalModels.Locale;
onCancel?: () => void;
onConfirm?: (startDateTime?: Date, endDateTime?: Date) => void;
pickTime?: boolean;
prefixCls?: string;
renderShortcut?: (select: (startDate?: Date, endDate?: Date) => void) => React.ReactNode;
showHeader?: boolean;
showShortcut?: boolean;
title?: string;
type?: 'one' | 'range';
visible?: boolean;
defaultDate?: Date;
getDateExtra?: (date: Date) => DateModels.ExtraData;
infinite?: boolean;
infiniteOpt?: boolean;
initalMonths?: number;
maxDate?: Date;
minDate?: Date;
onSelectHasDisableDate?: (date: Date[]) => void;
defaultTimeValue?: Date;
}
DatePicker props
export default interface PropsType {
defaultDate?: Date;
startDate?: Date;
endDate?: Date;
getDateExtra?: (date: Date) => Models.ExtraData;
infinite?: boolean;
infiniteOpt?: boolean;
initalMonths?: number;
locale?: GlobalModels.Locale;
maxDate?: Date;
minDate?: Date;
onCellClick?: (date: Date) => void;
onSelectHasDisableDate?: (date: Date[]) => void;
prefixCls?: string;
type?: 'one' | 'range';
}
Test Case
npm test
npm run chrome-test
Coverage
npm run coverage
open coverage/ dir
License
rmc-calendar is released under the MIT license.