expo-datetimepicker
v1.0.3
Published
```md # expo-datetimepicker
Readme
# expo-datetimepicker
A lightweight, customizable DateTimePicker component for React Native and Expo projects, built with TypeScript.
Wraps `@react-native-community/datetimepicker` with added convenience and Expo compatibility.Features
- Supports both iOS and Android
- Date and time modes
- TypeScript-ready
- Easy to use with React Native & Expo
- Peer dependencies to keep your bundle size small
Installation
npm install expo-datetimepicker
# or
yarn add expo-datetimepickerMake sure to also install peer dependencies if you don’t have them already:
npm install react react-native @react-native-community/datetimepicker
# or
yarn add react react-native @react-native-community/datetimepickerUsage
import React, { useState } from "react";
import { View, Button } from "react-native";
import DateTimePicker from "expo-datetimepicker";
export default function Example() {
const [date, setDate] = useState(new Date());
const [show, setShow] = useState(false);
const onChange = (event: any, selectedDate?: Date) => {
setShow(false);
if (selectedDate) setDate(selectedDate);
};
return (
<View style={{ padding: 20 }}>
<Button title="Pick a Date" onPress={() => setShow(true)} />
{show && (
<DateTimePicker
value={date}
mode="date"
display="default"
onChange={onChange}
/>
)}
</View>
);
}API
Props extend from @react-native-community/datetimepicker with added convenience if any (document your custom props
here).
Refer to official docs for full API details.
Peer Dependencies
This package relies on:
react(>=17.0.0)react-native(>=0.68.0)@react-native-community/datetimepicker(>=8.4.1)
Ensure these are installed in your project.
Development
git clone https://github.com/Valenciatv001/expo-datetimepicker
cd expo-datetimepicker
npm install
npm run buildLicense
MIT © Ezekiel Agwu
Contact
Created by Ezekiel Agwu
