Skip to main content

DiaryCard

The DiaryCard component is a specialized interactive card designed for displaying health measurement data and diary entries. It extends TouchableOpacity with healthcare-specific styling and automatic visual state management based on data availability.

Basic Example​

import { MeasurementTypeKey } from "@ovok/core";
import { DiaryCard } from "@ovok/native";
import * as React from "react";

const BasicDiaryCardExample = () => {
return (
<DiaryCard hasData={false}>
<DiaryCard.StartSection
left={() => (
<DiaryCard.TaskIcon
measurementTypeKey={MeasurementTypeKey.bodyWeight}
/>
)}
/>

<DiaryCard.Title>Body Weight</DiaryCard.Title>

<DiaryCard.MeasuredValue value={"70"} unit={"kg"} time="15:34" />
</DiaryCard>
);
};

export default BasicDiaryCardExample;

Props​

Extends TouchableOpacityProps from React Native.

Primary Props​

PropTypeDefaultDescription
childrenReactNode-Child components to render within the card
hasDatabooleanundefinedWhether the measurement has data (affects styling)
styleViewStyleundefinedAdditional styles to apply to the card
testIDstringundefinedTest identifier for automated testing

Inherited Props​

All TouchableOpacity props are supported:

  • onPress
  • disabled
  • accessibilityLabel
  • accessibilityRole
  • accessibilityState

Compound Components​

DiaryCardProps is exported from @ovok/native for typing wrappers around the card.

Component Behavior​

Visual State Management​

The card automatically adjusts its appearance based on the hasData prop:

Has Data (hasData = true):

  • Background: theme.colors.surface
  • Full opacity and normal interaction
  • Standard shadow and elevation

No Data (hasData = false):

  • Background: theme.colors.surfaceDisabled
  • Reduced visual prominence
  • Maintains touch interaction for data entry

Theme Integration​

  • Background Colors: Uses Material Design 3 surface colors
  • Border: theme.colors.outlineVariant with hairline width
  • Shadow: theme.colors.shadow with consistent elevation
  • Spacing: theme.spacing(4) padding and theme.spacing(2) gap
  • Border Radius: theme.borderRadius(4) for consistent rounding

Styling​

Theme Colors Used​

  • theme.colors.surface - Default card background
  • theme.colors.surfaceDisabled - Background when no data is available
  • theme.colors.outlineVariant - Border color
  • theme.colors.shadow - Shadow color for elevation