2.3.17 • Published 5 years ago

react-native-daterange v2.3.17

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

react-native-daterange

npm version npm downloads

Getting started

$ npm install react-native-daterange --save

alt text

Usage

import DatePicker from 'react-native-daterange';

//range picker
<DatePicker
  style={{ width: 350, height: 45 }}
  customStyles={{
    placeholderText:{ fontSize:20 } // placeHolder style
    headerStyle: {},			// title container style
    headerMarkTitle : {}, // title mark style
    headerDateTitle: {}, // title Date style
    contentInput: {}, //content text container style
    contentText: {}, //after selected text Style
  }} // optional
  centerAlign // optional text will align center or not
  allowFontScaling={false} // optional
  placeholder={'Apr 27, 2018 → Jul 10, 2018'}
  mode={'range'}
/>

//single picker
<DatePicker
  style={{ width: 350, height: 45 }}
  customStyles={{
    placeholderText:{ fontSize:20 }, // placeHolder style
    headerStyle : {},			// title container style
    headerMarkTitle : {}, // title mark style
    headerDateTitle: {}, // title Date style
    contentInput: {}, //content text container style
    contentText: {}, //after selected text Style
  }} // optional
  centerAlign // optional text will align center or not
  allowFontScaling = {false} // optional
  placeholder={'Apr 27, 2018'}
  selectedBgColor="black"
  selectedTextColor="blue"
/>


//customButton usage...
export default class NewPicker extends React.Component{
  customButtonOnPress = () => {
    console.log('customButton');
    this.picker.onConfirm();
  }
  render(){
    const {
      ...rest
    } = this.props;
    const customButton = (<Button onPress={this.customButtonOnPress} style={{ container:{ width:'80%', marginHorizontal:'3%' }, text:{ fontSize: 20 } }} primary text={'Set'}/>);
    return(
      <DatePicker
        ref = {(ref)=> this.picker = ref}
        {...rest}
        customButton = {customButton}
      />
    )
  }
}

Props

PropTypeDescription
placeholderStringoptional.
customStylesObjectoptional. customize style e.g.({ placeholderText:{}, headerStyle:{} ... })
styleObjectOptional. date picker's style
onConfirmFunctionOptional. call function after click button, that would return a date object {startDate:'', endDate:''} e.g( value=>console.log(value))
selectedBgColorStringOptional. custom your selected date background color e.g {"black"}
selectedTextColorStringOptional. custom your selected date text color e.g {"black"}
ButtonStyleObjectOptional. custom your save button container style
ButtonTextStyleObjectOptional. custom your save button Text style
returnFormatStringOptional. custom your datetime format e.g.('YYYY/MM/DD') at onConfirm
headFormatStringOptional. custom your datetime format showing at headBlock e.g.('YYYY/MM/DD')
outFormatStringOptional. custom your datetime format showing at outline touchable filed e.g.('YYYY/MM/DD')
modeStringone of 'range', 'single' , default as single
customButtoncomponentOptional (total custom your button component)e.g.(<Button></Button>)
blockBeforeBooloptional. default is false, decide blocke date before today or not
markTextStringoptional. default is "Select Date", you can custom this prop to label text with ur own
buttonTextStringoptional. you can modify default button't label with your own
blockAfterBooloptional. default is false, decide blocke date after today or not

....

2.3.17

5 years ago

2.3.16

5 years ago

2.3.15

5 years ago

2.3.14

5 years ago

2.3.13

5 years ago

2.3.12

5 years ago

2.3.11

5 years ago

2.3.10

5 years ago

2.3.9

5 years ago

2.3.8

5 years ago

2.3.6

5 years ago

2.3.5

5 years ago

2.3.4

5 years ago

2.3.3

5 years ago

2.3.2

5 years ago