1.0.12 • Published 4 months ago

txend-react-native-ui-datepicker v1.0.12

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

txend-react-native-ui-datepicker


txend-react-native-ui-datepicker

styled with prettier license

DateTimePicker component for React Native that allows you to create a customizable date and time picker. The component uses Day.js library and it contains a set of style props that allows you to change every item of calendar based on your own UI design. Please visit demo.

Installation

npm install txend-react-native-ui-datepicker

Or

yarn add txend-react-native-ui-datepicker

Usage

import DateTimePicker from 'txend-react-native-ui-datepicker';
import dayjs from 'dayjs';

export default function App() {
  const [value, setValue] = useState(dayjs());
  
  return (
    <View style={styles.container}>
      <DateTimePicker
        value={value}
        onValueChange={(date) => setValue(date)}
      />
    </View>
  )
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: '#F5FCFF',
  },
});

For more, take a look at the /example directory.

react-native-ui-datepicker-styles

Available props

NameTypeDefaultDescription
valueDateTypeDayjsDatePicker value to display selected date
onValueChangefunc() => {}Called when the new date selected from DatePicker
modestring'datetime'Defines the DatePicker mode ['datetime', 'date', 'time']
localestring'en'Defines the DatePicker locale
minimumDateDateTypenullDefines DatePicker minimum selectable date
maximumDateDateTypenullDefines DatePicker maximum selectable date
firstDayOfWeeknumber0Defines the starting day of week, number 0-6, 0 - Sunday, 6 - Saturday
displayFullDaysbooleanfalseDefines show previous and next month's days in the current calendar view
calendarTextStyleTextStylenullDefines all text styles inside the calendar (Days, Months, Years, Hours, and Minutes)
selectedTextStyleTextStylenullDefines selected (Day, Month, Year) text styles
selectedItemColorstring'#0047FF'Defines selected (Day, Month, Year) background and border colors
headerContainerStyleViewStylenullDefines calendar header container style
headerTextContainerStyleViewStylenullDefines calendar header texts (Month, Year, Time) containers style
headerTextStyleTextStylenullDefines calendar header text styles (Month, Year, Time)
headerButtonStyleViewStylenullDefines calendar header "prev and next buttons" containers style
headerButtonColorstringnullDefines calendar header "prev and next buttons" icon color
headerButtonSizenumber18Defines calendar header "prev and next buttons" icon size
headerButtonsPositionstring'around'Defines calendar header "prev and next buttons" positions ['around', 'right', 'left']
buttonPrevIconReactNodeundefinedDefines calendar header "prev button" custom icon
buttonNextIconReactNodeundefinedDefines calendar header "next button" custom icon
dayContainerStyleViewStylenullDefines days containers style
todayContainerStyleViewStylenullDefines today container style
todayTextStyleTextStylenullDefines today text style
monthContainerStyleViewStylenullDefines months containers style
yearContainerStyleViewStylenullDefines years containers style
weekDaysContainerStyleViewStylenullDefines weekdays container style
weekDaysTextStyleTextStylenullDefines weekdays texts style
timePickerContainerStyleViewStylenullDefines time picker container style
timePickerTextStyleTextStylenullDefines time picker (Hours, Minutes) texts style

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

Consider supporting with a ⭐️ Star on GitHub

If you are using the library in one of your projects, please consider supporting it with a star.

License

MIT