npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-native-jalali-persian-date-picker

v0.4.4

Published

React Native Jalali Date Picker Component

Downloads

31

Readme

React Native Jalali Date Picker

A simple, customizable Calendar and Date/Time Picker for React native.

Installation

npm i react-native-jalali-persian-date-picker @react-native-picker/picker

# or if you prefer Yarn:
yarn add react-native-jalali-persian-date-picker @react-native-picker/picker

Usage

Date Picker

Here is a simple example of how to use the DatePicker component:

import DatePicker from 'react-native-jalali-persian-date-picker';

export default function Example() {
  const [value, setValue] = useState <string | undefined>();

  return (
    <DatePicker value={value} onChange={(date) => setValue(date)} />
  )
}

Date Picker (Dark)

Here is a simple example of how to have a dark theme for the DatePicker component:

import DatePicker from 'react-native-jalali-persian-date-picker';

export default function Example() {
  const [value, setValue] = useState <string | undefined>();

  return (
    <DatePicker style={{ backgroundColor: '#161616' }} selectTimeDropdownIconColor={'white'}
                eachMonthTextStyle={{ color: 'white' }} eachYearTextStyle={{ color: 'white' }}
                selectTimePickerItemStyle={{ color: 'white', backgroundColor: '#161616' }}
                datePickerDismissIconColor={'white'} yearMonthTextStyle={{ color: 'white' }}
                datePickerModalStyle={{ backgroundColor: '#161616' }} dayTextColor={'#fff'}
                value={value} onChange={(date) => setValue(date)} />
  );
}

Calendar

Here is a simple example of how to use the Calendar component:

import { Calendar } from 'react-native-jalali-persian-date-picker';

export default function Example() {
  const [value, setValue] = useState < string | undefined > ();

  return (
    <Calendar value={value} style={styles.calendar} onChange={(date) => setValue(date)} />
  )
}
const styles = StyleSheet.create({
  calendar: {
    borderColor: '#ccc',
    borderWidth: 1,
    margin: 10,
    height: 450,
    paddingVertical: 10,
    paddingHorizontal: 5,
    borderRadius: 10,
  }
});

Time Picker

You can include a time picker by adding the isShowSelectTime prop to both the Calendar and DatePicker components.

import DatePicker from 'react-native-jalali-persian-date-picker';

export default function Example() {
  const [value, setValue] = useState < string | undefined > ();

  return (
    <DatePicker isShowSelectTime={true} value={value} onChange={(date) => setValue(date)} />
  )
}

Available props

| Prop | Default | Type | Availability (DatePicker/ Calendar) | |:---------------------------:|:---------------------------------------------------------------------:|:--------------------------------------------:|:-----------------------------------:| | style | see Props.ts | ViewStyle | both | | value | today | string | both | | isShowSelectTime | false | boolean | both | | showMonthLabel | false | boolean | both | | dateSeparator | / | string | both | | minDate | last year | string | both | | maxDate | next year | string | both | | onChange | date => console.log(date) | Function | both | | headerContainerStyle | see Props.ts | ViewStyle | both | | yearMonthBoxStyle | see Props.ts | ViewStyle | both | | yearMonthTextStyle | { fontSize: 22, color: 'black' } | TextStyle | both | | iconContainerStyle | see Props.ts | ViewStyle | both | | backIcon | see Props.ts | ImageSourcePropType or undefined | both | | backIconStyle | see Props.ts | ImageStyle | both | | nextIcon | see Props.ts | ImageSourcePropType or undefined | both | | nextIconStyle | see Props.ts | ImageStyle | both | | selectTimeContainerStyle | see Props.ts | ViewStyle | both | | selectTimePickerStyle | see Props.ts | ViewStyle | both | | selectTimeDropdownIconColor | #000 | ColorValue | both | | selectTimePickerItemStyle | see Props.ts | TextStyle | both | | selectTimePickerMode | 'dropdown' | dialog or dropdown | both | | eachYearStyle | see Props.ts | ViewStyle | both | | selectedEachYearStyle | see Props.ts | ViewStyle | both | | eachYearTextStyle | { fontSize: 16 } | TextStyle | both | | selectedEachYearTextStyle | { fontSize: 16, color: 'white',fontWeight: 'bold' } | TextStyle | both | | eachMonthStyle | see Props.ts | ViewStyle | both | | selectedEachMonthStyle | see Props.ts | ViewStyle | both | | eachMonthTextStyle | { fontSize: 16 } | TextStyle | both | | selectedEachMonthTextStyle | { fontSize: 16, color: 'white',fontWeight: 'bold' } | TextStyle | both | | weekdaysContainerStyle | see Props.ts | ViewStyle | both | | weekdayStyle | see Props.ts | ViewStyle | both | | weekdayTextStyle | { fontSize: 16, color: 'coral', marginBottom: 5, fontWeight: 'bold' } | TextStyle | both | | dayStyle | see Props.ts | ViewStyle | both | | selectedDayStyle | see Props.ts | ViewStyle | both | | selectedDayColor | coral | string | both | | dayTextStyle | { fontSize: 18 } | TextStyle | both | | selectedDayTextColor | #FFFFFF | string | both | | dayTextColor | #111111 | string | both | | disabledTextColor | #999999 | string | both | | datePickerModalStyle | | ViewStyle | DatePicker | | datePickerDismissIconColor | #000 | ColorValue | DatePicker | | renderItem | | Element | DatePicker |

Example

Take a look at example:

git clone https://github.com/realmahd1/react-native-jalali-persian-date-picker

cd example

yarn

react-native run-android

# OR

react-native run-ios

Contributing

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

License

MIT