From 2d9a5db967c7eb98228ae372c1139e4069974b90 Mon Sep 17 00:00:00 2001
From: Hailey <me@haileyok.com>
Date: Wed, 6 Mar 2024 11:13:03 -0800
Subject: Switch date picker libraries (#3126)

* Revert other base PR changes, switch date picker library

rm expo-linear-gradient

Revert "remove unused packages, switch to `expo-linear-gradient`"

This reverts commit 20a0ffcf

Revert "upgrade expo deps"

This reverts commit a43dca92caa120d45fb771431752dd2db3b37ab5.

Revert other library changes

This reverts commit 5219f66e

Revert "re-add normalize-url"

This reverts commit 654019c4babe2e455f6069a6c725eb51140ab1ab.

Revert "add `expo-haptics`"

This reverts commit ff3a0399b1c7eae07b83946f13543eedf7cdfe82.

Revert "add `expo-clipboard`"

This reverts commit 440ae91632153e22ff79050d8ac803a7305e88a0.

Revert "add `expo-file-system`"

This reverts commit c0fe0c94534564982399c22299a8a19052bf3e54.

fix android alf

use modal on android

migrate to `react-native-date-picker`

rm `@reactnativecommunity/datetimepicker`

add `react-native-date-picker`

add `expo-file-system`

add `expo-clipboard`

add `expo-haptics`

re-add normalize-url

rm blur view

upgrade expo deps

remove unused packages, switch to `expo-linear-gradient`

* rm old library

* Use UTC for dates

---------

Co-authored-by: Eric Bailey <git@esb.lol>
---
 src/components/forms/DateField/index.tsx | 20 ++++++++------------
 1 file changed, 8 insertions(+), 12 deletions(-)

(limited to 'src/components/forms/DateField/index.tsx')

diff --git a/src/components/forms/DateField/index.tsx b/src/components/forms/DateField/index.tsx
index e65936e0e..49e47a01e 100644
--- a/src/components/forms/DateField/index.tsx
+++ b/src/components/forms/DateField/index.tsx
@@ -1,13 +1,11 @@
 import React from 'react'
 import {View} from 'react-native'
-import DateTimePicker, {
-  DateTimePickerEvent,
-} from '@react-native-community/datetimepicker'
 
 import {useTheme, atoms} from '#/alf'
 import * as TextField from '#/components/forms/TextField'
 import {toSimpleDateString} from '#/components/forms/DateField/utils'
 import {DateFieldProps} from '#/components/forms/DateField/types'
+import DatePicker from 'react-native-date-picker'
 
 export * as utils from '#/components/forms/DateField/utils'
 export const Label = TextField.Label
@@ -28,7 +26,7 @@ export function DateField({
   const t = useTheme()
 
   const onChangeInternal = React.useCallback(
-    (event: DateTimePickerEvent, date: Date | undefined) => {
+    (date: Date | undefined) => {
       if (date) {
         const formatted = toSimpleDateString(date)
         onChangeDate(formatted)
@@ -39,17 +37,15 @@ export function DateField({
 
   return (
     <View style={[atoms.relative, atoms.w_full]}>
-      <DateTimePicker
+      <DatePicker
+        theme={t.name === 'light' ? 'light' : 'dark'}
+        date={new Date(value)}
+        onDateChange={onChangeInternal}
+        mode="date"
+        testID={`${testID}-datepicker`}
         aria-label={label}
         accessibilityLabel={label}
         accessibilityHint={undefined}
-        testID={`${testID}-datepicker`}
-        mode="date"
-        timeZoneName={'Etc/UTC'}
-        display="spinner"
-        themeVariant={t.name === 'light' ? 'light' : 'dark'}
-        value={new Date(value)}
-        onChange={onChangeInternal}
       />
     </View>
   )
-- 
cgit 1.4.1

