Alfie Kemp

Alfie Kemp

1587829020

A Calendar Component Supporting Dragging Operation

DraggableCalendar A calendar component supporting dragging operation.

1. Examples

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

git clone git@github.com: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

Download Details:

Author: SmallStoneSK

GitHub: https://github.com/SmallStoneSK/react-native-draggable-calendar

#react-native #programming

What is GEEK

Buddha Community

A Calendar Component Supporting Dragging Operation
Ray  Patel

Ray Patel

1619565060

Ternary operator in Python?

  1. Ternary Operator in Python

What is a ternary operator: The ternary operator is a conditional expression that means this is a comparison operator and results come on a true or false condition and it is the shortest way to writing an if-else statement. It is a condition in a single line replacing the multiline if-else code.

syntax : condition ? value_if_true : value_if_false

condition: A boolean expression evaluates true or false

value_if_true: a value to be assigned if the expression is evaluated to true.

value_if_false: A value to be assigned if the expression is evaluated to false.

How to use ternary operator in python here are some examples of Python ternary operator if-else.

Brief description of examples we have to take two variables a and b. The value of a is 10 and b is 20. find the minimum number using a ternary operator with one line of code. ( **min = a if a < b else b ) **. if a less than b then print a otherwise print b and second examples are the same as first and the third example is check number is even or odd.

#python #python ternary operator #ternary operator #ternary operator in if-else #ternary operator in python #ternary operator with dict #ternary operator with lambda

Rahim Makhani

Rahim Makhani

1618806778

Get the best Magento maintenance service for your e-commerce store

Magento is the most demanded technology for developing online eCommerce stores and Magento service is important for better working of the online store. Nevina Infotech provides you with Magento maintenance and services.

Magento maintenance is the process of checking the performance of the website and checking the regular updates, backups, online store management, and much more.

You can choose Nevina Infotech for Magento maintenance service for your eCommerce store. We provide the best Magento support and maintenance for eCommerce stores.

#magento maintenance and support services #magento support services #magento support and maintenance #magento support #magento maintenance support #magento technical support

Rahim Makhani

Rahim Makhani

1626851156

Get the latest Features in your current eCommerce App

Are you tired of outdated features in your eCommerce app and do you want some latest and trending features in your eCommerce app? Then you need to update your app regularly to stay updated with the latest and trending features to add to your app. For updating it you need to update to the latest version of the Magento so that whatever update occurs in the latest version can also occur in your eCommerce app.

You can hire Nevina Infotech that can help you to provide Magento support and maintenance and will also guide you to update your eCommerce app for adding the latest features to your app. Our team is great and enthusiastic about their work. You can easily rely on us to get the latest features in your eCommerce app.

#magento maintenance and support services #magento support services #magento support and maintenance #magento support #magento maintenance support #magento technical support

Rahim Makhani

Rahim Makhani

1621223780

Maintain your Magento web app for better Performance

Magento is the best cross-platform framework that helps you to develop the best eCommerce web apps. It is important to maintain your Magento eCommerce web app to increase the performance of your web application.

Magento maintenance and support services play a vital role in maintaining the website because if the website or web app is not maintained properly it can create bugs in the future and many more problems can occur through which there is a chance that customers get frustrated and won’t visit your website again.

Nevina Infotech is the best choice for Magento maintenance and service of your web apps. We have a hardworking team of developers that will help you to increase the performance of your web apps.

#magento maintenance and support services #magento support services #magento support and maintenance #magento support #magento maintenance support #magento technical support

Rahim Makhani

Rahim Makhani

1622519505

Maintain your Magento app for a smoother and faster user Experience

Magento is the best open-source eCommerce platform for website development. We all know the importance of a website in every sector; whether it is about business or anything else, it can represent the look and feel of your company. So to maintain these websites, it is essential to do Magento support and maintenance so that you can also maintain your website.

Nevina Infotech is the best Magento app development company that can guide you to maintain and support your Magento app. We have a dedicated team of developers who will help you with the maintenance and support of your app.

#magento maintenance and support services #magento support services #magento support and maintenance #magento support #magento maintenance support #magento technical support