1.2.1 • Published 9 months ago

@dietime/react-native-date-picker v1.2.1

Weekly downloads
15
License
MIT
Repository
github
Last release
9 months ago

React Native customizable date picker component for iOS and Android. Designed using ScrollView. Looks identical on all devices.

💻 Example

💬 Installation

  1. Add dependencies to the project

    yarn add @dietime/react-native-date-picker
    
    npm install @dietime/react-native-date-picker --save
  2. Install additional dependencies

    yarn add expo-linear-gradient
    
    npm install expo-linear-gradient --save
  3. Then, import with ...

    import DatePicker from '@dietime/react-native-date-picker';
  4. If you are not using Expo

    You should also follow these additional installation instructions.

👩‍💻 Usage

  • Simple code example
    import React, {useState} from "react";
    import {Text, View} from "react-native";
    
    import DatePicker from "@dietime/react-native-date-picker";
    
    export default function App() {
        const [date, setDate] = useState();
    
        return (
            <View>
                <Text>{date ? date.toDateString() : "Select date..."}</Text>
                <DatePicker
                    value={date}
                    onChange={(value) => setDate(value)}
                    format="yyyy-mm-dd"
                />
            </View>
        );
    }

📚 Documentation

PropRequiredTypeDescription
valueDate or null or undefinedInitial date for component
onChange(value: Date) : voidCallback on date change event
heightnumberCustom component height
widthnumber or stringCustom component width such as 100 or '50%'
fontSizenumberCustom digits font size
textColorstringCustom digits text color such as hex, rgb or rgba
endYearnumberMax year in component, default is current year
startYearnumberMin year in component, default is endYear - 100
markColorstringCustom middle mark color such as hex, rgb or rgba
markHeightnumberCustom height of middle mark
markWidthnumber or stringCustom width of middle mark such as 100 or '50%'
fadeColorstringCustom color for top and bottom fade effect only hex colors!
formatstringCustom picker format like reshuffle of yyyy, mm, dd. Example: 'yyyy-mm-dd' or 'dd-mm-yyyy' and other

📂 Project Layout

  • example Simple project with date picker. It is presented on gif.
  • src Source code of date picker.
  • lib Shared packages.

📃 License

Source code is made available under the MIT license. Some dependencies may be licensed differently.

☕ Support

You can support me so that there will be more good open source projects in the future

1.2.1

9 months ago

1.2.0

2 years ago

1.1.2

3 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.0

3 years ago