All Projects → SmallStoneSK → react-native-draggable-calendar

SmallStoneSK / react-native-draggable-calendar

Licence: other
A calendar component supporting dragging.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to react-native-draggable-calendar

react-activity-calendar
A React component to display activity data in a calendar (heatmap)
Stars: ✭ 69 (-27.37%)
Mutual labels:  calendar
github-issue-due-dates-action
📆 GitHub Issue Due Dates Action
Stars: ✭ 63 (-33.68%)
Mutual labels:  calendar
date-range-picker
⚛️📆 Flexible React date range picker calendar with no dependencies.
Stars: ✭ 94 (-1.05%)
Mutual labels:  calendar
yii2-fullcalendar
Yii 2 component for easy fullcalendar integration
Stars: ✭ 21 (-77.89%)
Mutual labels:  calendar
CalendarView
日历控件
Stars: ✭ 14 (-85.26%)
Mutual labels:  calendar
fscalendar-ios-binding
Xamarin Binding Library - FSCalendar for iOS https://github.com/WenchaoD/FSCalendar
Stars: ✭ 12 (-87.37%)
Mutual labels:  calendar
contao-events subscriptions
Contao extension that allows members of your website to subscribe to the events
Stars: ✭ 12 (-87.37%)
Mutual labels:  calendar
nlp-calendar
2022 call-for-paper ai nlp cv
Stars: ✭ 37 (-61.05%)
Mutual labels:  calendar
calendar
R interface to iCal (.ics files)
Stars: ✭ 30 (-68.42%)
Mutual labels:  calendar
toast-ui.react-calendar
TOAST UI Calendar wrapper for React.js
Stars: ✭ 150 (+57.89%)
Mutual labels:  calendar
webcalendar
WebCalendar is a PHP application used to maintain a calendar for a single user or an intranet group of users. It can also be configured as an event calendar.
Stars: ✭ 113 (+18.95%)
Mutual labels:  calendar
remarkable-calendar-creator
Create calendars to display on a reMarkable device as the suspend screen or to write notes on, including events from your own online iCal calendar
Stars: ✭ 28 (-70.53%)
Mutual labels:  calendar
darim
🏕 A private journal service that supports client-side encryption
Stars: ✭ 33 (-65.26%)
Mutual labels:  calendar
modoboa-radicale
The Radicale frontend of Modoboa
Stars: ✭ 18 (-81.05%)
Mutual labels:  calendar
foundryvtt-simple-calendar
A simple calendar module for the FoundryVTT system
Stars: ✭ 25 (-73.68%)
Mutual labels:  calendar
groupoffice
Group Office groupware and CRM
Stars: ✭ 80 (-15.79%)
Mutual labels:  calendar
ioBroker.trashschedule
Calculates trash pickup dates by using an ical calendar
Stars: ✭ 20 (-78.95%)
Mutual labels:  calendar
sugarcalendar-core
Sugar Calendar plugin for WordPress
Stars: ✭ 40 (-57.89%)
Mutual labels:  calendar
PrimeCalendar
PrimeCalendar provides all of the java.util.Calendar functionalities for Persian, Hijri, and ... dates. It is also possible to convert dates to each other.
Stars: ✭ 45 (-52.63%)
Mutual labels:  calendar
react-native-beautiful-timeline
Fully customizable, beautifully designed Timeline for React Native.
Stars: ✭ 111 (+16.84%)
Mutual labels:  calendar

DraggableCalendar

A calendar component supporting dragging operation.

1. Examples

Download the repository, cd the examples directory, and run it on simulator.

git clone [email protected]:SmallStoneSK/react-native-draggable-calendar.git
cd examples
react-native run-ios      # for ios
react-native run-android  # for android

2. Usage

At first, you should install react-native-draggable-calendar. Like this:

npm install react-native-draggable-calendar --save
  1. For basic usage, you can use it as following:
export class BasicUsageDemo extends Component {

  constructor(props) {
    super(props);
  }

  onGetTime = () => {
    // you can get the selected time.
    console.log('onGetTime: ', this._calendar.getSelection());
  };

  onSelectionChange = (newSelection) => {
    // when selected time changes, this func will be called.
    console.log('onSelectionChange', newSelection);
  };

  render() {
    return (
      <View style={{flex: 1}}>
        <DraggableCalendar
          ref={_ => this._calendar = _}
          onSelectionChange={this.onSelectionChange}
        />
        <TouchableOpacity onPress={this.onGetTime} style={{
          justifyContent: 'center', alignItems: 'center',
          left: 0, right: 0, bottom: 0, paddingVertical: 15,
          position: 'absolute', backgroundColor: '#4291EF'
        }}>
          <Text style={{color: '#FFF'}}>Get Time</Text>
        </TouchableOpacity>
      </View>
    );
  }
}
  1. As it has provided a default style, you can use it as following for in-depth customization.
export class CustomizationDemo extends Component {
  _genStyles() {
    return {
      style: styles.draggableContainer,
      headerTextStyle: styles.dayText,
      monthHeaderTextStyle: styles.dayText,
      dayTextStyle: styles.dayText,
      selectedDayTextStyle: styles.selectedDayText,
      singleDayContainerStyle: styles.selectedDayContainer,
      beginDayContainerStyle: styles.selectedDayContainer,
      middleDayContainerStyle: styles.selectedDayContainer,
      endDayContainerStyle: styles.selectedDayContainer
    };
  }
  render() {
    return (
      <DraggableCalendar {...this._genStyles()}/>
    );
  }
}

const styles = StyleSheet.create({
  draggableContainer: {
    backgroundColor: '#303E4D'
  },
  dayText: {
    color: '#EAC351'
  },
  selectedDayText: {
    color: '#303E4D'
  },
  selectedDayContainer: {
    backgroundColor: '#EAC351'
  }
});

For detailed xxxStyle meaning, you can see the following picture:

3. Others

1. Decide how many month to render.

You have two ways to deside this.

  1. pass fullDateRange and availableDateRange. Like this:
<DraggableCalendar
  fullDateRange={[new Date(2018, 4, 1, 0, 0, 0), new Date(2018, 6, 31, 0, 0, 0)]}
  availableDateRange={[new Date(2018, 4, 21, 0, 0, 0), new Date(2018, 6, 31, 0, 0, 0)]}
  />

So, the date between 5.1~5.20 will not be selected. You'd better specify the first day of a month and the last day of a month to fullDateRange.

  1. pass maxDays. Like this:
<DraggableCalendar maxDays={180}/>

In this way, the availableDateRange will be [today, today + 180]. And the fullDateRange will be [first day of this month, last day of the month containing (today + 180)].

2. Customize your render content.

If you are not satisfied with the customization above, you can even pass renderMonthHeader/renderDay function to DraggableCalendar. Like this:

<DraggableCalendar
  renderDay={data => this.yourRenderDay(data)}
  renderMonthHeader={identifier => this.yourRenderMonthHeader(identifier)}
  />

Note

The data passed to yourRenderDay is an object:

{
  date        // a date obj
  status      // indicating its selected status. (enum value: see DAY_STATUS in Helper.js)
  available   // indicating whether this day is touchable
}

the identifier passed to yourRenderMonthHeader is a string:

'2018-05'   // you can use identifier.split('-') to get the year and month
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].