Skip to content

Commit a257c71

Browse files
Richardclaude
andcommitted
feat(example): add Expo example app with three demo screens
Demonstrates all three API styles and two real fintech use cases. Screens: - Session Timeout (index): primary fintech use case — 5-min session timer, persisted across app kills, customizable duration, Android notification config, permission check for exact alarms, onBackground/onForeground callbacks - OTP Expiry (otp): 90-second OTP countdown using the hook API, shows urgency color transitions, persist: false since OTPs are ephemeral - API Playground: three concurrent timers using hook / imperative / legacy setTimeout APIs simultaneously with live event logs Components: - TimerRing: animated circular progress ring with drift-aware color states - StatusBadge: status + background indicator chip - theme.ts: shared design tokens (slate/indigo dark theme) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 7901c0c commit a257c71

11 files changed

Lines changed: 1476 additions & 0 deletions

File tree

example/app.json

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
{
2+
"expo": {
3+
"name": "BGTimerExample",
4+
"slug": "bg-timer-example",
5+
"version": "1.0.0",
6+
"orientation": "portrait",
7+
"icon": "./assets/icon.png",
8+
"userInterfaceStyle": "automatic",
9+
"scheme": "bgtimer",
10+
"splash": {
11+
"backgroundColor": "#0F172A"
12+
},
13+
"ios": {
14+
"supportsTablet": false,
15+
"bundleIdentifier": "com.rick427.bgtimer.example",
16+
"infoPlist": {
17+
"UIBackgroundModes": ["processing", "fetch"]
18+
}
19+
},
20+
"android": {
21+
"package": "com.rick427.bgtimer.example",
22+
"adaptiveIcon": {
23+
"backgroundColor": "#0F172A"
24+
}
25+
},
26+
"plugins": [
27+
"expo-router",
28+
[
29+
"@rick427/background-timer",
30+
{
31+
"taskIdentifiers": [
32+
"com.rick427.bgtimer.example.session-timeout",
33+
"com.rick427.bgtimer.example.otp-expiry"
34+
]
35+
}
36+
]
37+
],
38+
"experiments": {
39+
"typedRoutes": true
40+
}
41+
}
42+
}

example/app/(tabs)/_layout.tsx

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
import { Tabs } from 'expo-router';
2+
import { Ionicons } from '@expo/vector-icons';
3+
import { COLORS } from '../../src/theme';
4+
5+
export default function TabLayout() {
6+
return (
7+
<Tabs
8+
screenOptions={{
9+
headerShown: false,
10+
tabBarStyle: {
11+
backgroundColor: COLORS.surface,
12+
borderTopColor: COLORS.border,
13+
},
14+
tabBarActiveTintColor: COLORS.primary,
15+
tabBarInactiveTintColor: COLORS.textMuted,
16+
}}
17+
>
18+
<Tabs.Screen
19+
name="index"
20+
options={{
21+
title: 'Session',
22+
tabBarIcon: ({ color, size }) => (
23+
<Ionicons name="shield-checkmark" size={size} color={color} />
24+
),
25+
}}
26+
/>
27+
<Tabs.Screen
28+
name="otp"
29+
options={{
30+
title: 'OTP',
31+
tabBarIcon: ({ color, size }) => (
32+
<Ionicons name="keypad" size={size} color={color} />
33+
),
34+
}}
35+
/>
36+
<Tabs.Screen
37+
name="playground"
38+
options={{
39+
title: 'Playground',
40+
tabBarIcon: ({ color, size }) => (
41+
<Ionicons name="flask" size={size} color={color} />
42+
),
43+
}}
44+
/>
45+
</Tabs>
46+
);
47+
}

0 commit comments

Comments
 (0)