### Installation Source: https://github.com/react-native-datetimepicker/datetimepicker/blob/master/README.md Instructions for installing the React Native DateTimePicker module using npm or yarn. ```APIDOC ## Installation ### npm ```bash npm install @react-native-community/datetimepicker --save ``` ### yarn ```bash yarn add @react-native-community/datetimepicker ``` **Note:** For iOS, run `npx pod-install` after installation and rebuild your project. Autolinking is not yet implemented on Windows, requiring manual installation. ``` -------------------------------- ### Clone and Install Dependencies Source: https://github.com/react-native-datetimepicker/datetimepicker/blob/master/CONTRIBUTING.md Clone the repository and install project dependencies using Yarn. ```sh git clone https://github.com/react-native-community/datetimepicker.git cd datetimepicker yarn ``` -------------------------------- ### Install React Native DateTimePicker Source: https://context7.com/react-native-datetimepicker/datetimepicker/llms.txt Install the package using npm, yarn, or Expo. For iOS, ensure pods are installed. Expo managed projects or dev clients require a specific Expo install command. ```bash # npm npm install @react-native-community/datetimepicker --save ``` ```bash # yarn yarn add @react-native-community/datetimepicker ``` ```bash # iOS – install pods npx pod-install ``` ```bash # Expo managed / dev client npx expo install @react-native-community/datetimepicker ``` -------------------------------- ### Run Jest Tests Source: https://github.com/react-native-datetimepicker/datetimepicker/blob/master/CONTRIBUTING.md Install dependencies and run Jest tests for the project. ```sh yarn yarn test ``` -------------------------------- ### Install DateTimePicker with yarn Source: https://github.com/react-native-datetimepicker/datetimepicker/blob/master/README.md Use this command to install the React Native DateTimePicker module using yarn. ```bash yarn add @react-native-community/datetimepicker ``` -------------------------------- ### Install DateTimePicker with npm Source: https://github.com/react-native-datetimepicker/datetimepicker/blob/master/README.md Use this command to install the React Native DateTimePicker module using npm. ```bash npm install @react-native-community/datetimepicker --save ``` -------------------------------- ### display prop Source: https://context7.com/react-native-datetimepicker/datetimepicker/llms.txt Shows examples of using the `display` prop to customize the picker's appearance on different platforms. ```APIDOC ## `display` prop Overrides the visual style of the picker. Platform-specific values are ignored silently on other platforms. ```jsx // Android spinner wheel {}} /> // Android calendar grid {}} /> // iOS compact inline button (expands to calendar on tap) – iOS 14+ {}} /> // iOS fully-inline calendar – iOS 14+ {}} /> ``` ``` -------------------------------- ### DateTimePicker Display Options Source: https://context7.com/react-native-datetimepicker/datetimepicker/llms.txt Shows examples of different 'display' prop values for the DateTimePicker. Platform-specific values are ignored silently on other platforms. ```jsx // Android spinner wheel {}} /> ``` ```jsx // Android calendar grid {}} /> ``` ```jsx // iOS compact inline button (expands to calendar on tap) – iOS 14+ {}} /> ``` ```jsx // iOS fully-inline calendar – iOS 14+ {}} /> ``` -------------------------------- ### Jest Testing Setup for DateTimePicker Source: https://context7.com/react-native-datetimepicker/datetimepicker/llms.txt Configure Jest to use the provided mock for @react-native-community/datetimepicker. This setup file should be included in your Jest configuration. ```javascript // jest.config.js module.exports = { preset: 'react-native', setupFilesAfterFramework: ['@react-native-community/datetimepicker/jest/setup'], }; ``` -------------------------------- ### Basic DateTimePicker Component Usage Source: https://context7.com/react-native-datetimepicker/datetimepicker/llms.txt Demonstrates the basic setup for the DateTimePicker component, including state management for visibility and handling date selection. Use the 'show' state pattern to toggle visibility on Android. ```jsx import React, {useState} from 'react'; import {Button, SafeAreaView, Text} from 'react-native'; import DateTimePicker from '@react-native-community/datetimepicker'; export default function App() { const [date, setDate] = useState(new Date()); const [show, setShow] = useState(false); const onValueChange = (event, selectedDate) => { setShow(false); // hide after selection on Android if (selectedDate) { setDate(selectedDate); } }; const onDismiss = () => setShow(false); return ( Selected: {date.toLocaleString()}