Skip to main content

Types

As exported from expo-screen-time (source of truth: ExpoScreenTime.types.ts).

TokenHandle

Opaque, stable reference to a native token. Never parse or construct one in JS.

type TokenHandle = {
handle: string; // opaque, stable across app launches
type: "application" | "category" | "webDomain";
};

SelectionMetadata

Counts for a stored selection — no token data.

type SelectionMetadata = {
applicationCount: number;
categoryCount: number;
webDomainCount: number;
};

OnSelectionChangeEvent

Payload of the picker's onSelectionChange (event.nativeEvent).

type OnSelectionChangeEvent = {
metadata: SelectionMetadata;
tokens: TokenHandle[];
};

DeviceActivitySchedule

type DeviceActivitySchedule = {
intervalStart: DateComponents;
intervalEnd: DateComponents;
repeats: boolean;
warningTime?: number; // seconds
};

type DateComponents = {
hour: number; // 0-23
minute: number; // 0-59
second?: number; // 0-59
weekday?: number; // 1 = Sunday … 7 = Saturday
};

MonitoringConfiguration

type MonitoringConfiguration = {
activityName: string;
schedule: DeviceActivitySchedule;
/** Selection to block when the interval starts — a stored selection ID */
selectionId?: string;
events?: DeviceActivityEventThreshold[];
/** Restrict to specific weekdays (1 = Sunday … 7 = Saturday) */
weekdays?: number[];
};

type DeviceActivityEventThreshold = {
eventName: string;
/** Stored selection to meter */
selectionId: string;
threshold: number; // seconds
includesPastActivity?: boolean;
};

ShieldConfig

Text elements and buttons are nested objects.

type ShieldConfig = {
title?: { text: string; color?: string };
subtitle?: { text: string; color?: string };
icon?: string; // SF Symbol name
backgroundColor?: string; // hex color
backgroundBlurStyle?: UIBlurEffectStyle; // 'light' | 'dark' | 'regular' | …
primaryButton?: { text: string; color?: string; backgroundColor?: string };
secondaryButton?: { text: string; color?: string };
};

ShieldActionConfig

type ShieldActionConfig = {
primaryAction: ShieldActionType | { type: "snooze"; duration: number };
secondaryAction?: ShieldActionType | { type: "snooze"; duration: number };
};

type ShieldActionType = "close" | "unblock" | "defer";

Snooze is expressed as an object with its duration in seconds.

MonitorEvent

type MonitorEvent = {
activityName: string;
eventType: MonitorEventType;
eventName?: string; // for threshold events
timestamp: number; // Unix milliseconds
};

type MonitorEventType =
| "intervalDidStart"
| "intervalDidEnd"
| "eventDidReachThreshold"
| "intervalWillEndWarning"
| "eventWillReachThresholdWarning";

ReportStyle

Styling forwarded to the report extension (set automatically by <DeviceActivityReport /> props, or manually via setReportStyle).

interface ReportStyle {
accentColor?: string;
backgroundColor?: string;
textColor?: string;
showPickups?: boolean;
showTopApps?: boolean;
showChart?: boolean;
chartStyle?: "bar" | "pie";
}