A Pressable that will open the picker

This commit is contained in:
Johannes Klein committed 2026-07-06 14:27:07 +02:00
1 parent 5c26a88c19
commit bfa5603895
1 file changed
+14 -6
@@ -1,5 +1,6 @@
import { Body3 } from "components/SharedComponents";
import React, { useMemo } from "react";
import { Pressable } from "components/styledComponents";
import React, { useMemo, useState } from "react";
import type { RealmObservationField } from "realmModels/types";
import { useTranslation } from "sharedHooks";
@@ -14,6 +15,8 @@ const DateFieldInput = ( { obsField }: Props ) => {
const { datatype, id } = obsField;
const { value, setValue } = useObservationFieldValue( id );
console.log( setValue );
const [showPicker, setShowPicker] = useState( false );
console.log( "showPicker", showPicker );
const placeholder = useMemo( () => {
switch ( datatype ) {
case "date":
@@ -28,12 +31,17 @@ const DateFieldInput = ( { obsField }: Props ) => {
}, [datatype, t] );
return (
<Body3 className={value
? "pt-1"
: "pt-1 color-darkGrayDisabled"}
<Pressable
accessibilityRole="button"
onPress={( ) => setShowPicker( true )}
>
{value || placeholder}
</Body3>
<Body3 className={value
? "pt-1"
: "pt-1 color-darkGrayDisabled"}
>
{value || placeholder}
</Body3>
</Pressable>
);
};