Skip to content

Commit 83ac511

Browse files
committed
chore: update package for bolt
1 parent 6ce9675 commit 83ac511

File tree

7 files changed

+2213
-13799
lines changed

7 files changed

+2213
-13799
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Expo Local-first Template [![Twitter](https://img.shields.io/twitter/url/https/twitter.com/cloudposse.svg?style=social&label=Follow%20%40expostarter)](https://twitter.com/expostarter)
22

3+
[Open in Bolt.new](https://bolt.new/~github.com/expo-starter/expo-local-first-template)
4+
35
<p align="center">
46
<a href="https://expostarter.com/"><img src="assets/github-banner.png?raw=true" alt="Expo Starter Kit"></a>
57
</p>

app.config.ts

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,19 +32,10 @@ export default ({ config }: ConfigContext): ExpoConfig => ({
3232
},
3333
web: {
3434
bundler: "metro",
35-
output: "server",
35+
output: "static",
3636
favicon: "./assets/images/favicon.png",
3737
},
38-
plugins: [
39-
[
40-
"expo-router",
41-
{
42-
origin: "https://n",
43-
},
44-
],
45-
["expo-sqlite"],
46-
["expo-font"],
47-
],
38+
plugins: [["expo-router"], ["expo-sqlite"], ["expo-font"]],
4839
experiments: {
4940
typedRoutes: true,
5041
baseUrl: "/expo-local-first-template",

app/(tabs)/index.tsx

Lines changed: 30 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,19 @@
1-
import {View, Pressable} from "react-native";
2-
import {useScrollToTop} from "@react-navigation/native";
3-
import {FlashList} from "@shopify/flash-list";
4-
import {eq} from "drizzle-orm";
5-
import {Link, Stack} from "expo-router";
1+
import { View, Pressable, Platform } from "react-native";
2+
import { useScrollToTop } from "@react-navigation/native";
3+
import { FlashList } from "@shopify/flash-list";
4+
import { eq } from "drizzle-orm";
5+
import { Link, Stack } from "expo-router";
66
import * as React from "react";
7-
import {useLiveQuery} from "drizzle-orm/expo-sqlite";
8-
9-
10-
import {Text} from "@/components/ui/text";
11-
import {habitTable} from "@/db/schema";
12-
import {Plus} from "@/components/Icons";
13-
import {useMigrationHelper} from "@/db/drizzle";
14-
import {useDatabase} from "@/db/provider";
15-
import {HabitCard} from "@/components/habit";
16-
import type {Habit} from "@/lib/storage";
7+
import { useLiveQuery } from "drizzle-orm/expo-sqlite";
8+
import { Text } from "@/components/ui/text";
9+
import { habitTable, type Habit } from "@/db/schema";
10+
import { Plus } from "@/components/Icons";
11+
import { useMigrationHelper } from "@/db/drizzle";
12+
import { useDatabase } from "@/db/provider";
13+
import { HabitCard } from "@/components/habit";
1714

1815
export default function Home() {
19-
const {success, error} = useMigrationHelper();
16+
const { success, error } = useMigrationHelper();
2017

2118
if (error) {
2219
return (
@@ -37,19 +34,28 @@ export default function Home() {
3734
}
3835

3936
function ScreenContent() {
40-
const {db} = useDatabase();
41-
const {data: habits, error} = useLiveQuery(
42-
db?.select().from(habitTable).where(eq(habitTable.archived, false)),
43-
);
37+
const { db } = useDatabase();
4438

4539
const ref = React.useRef(null);
4640
useScrollToTop(ref);
4741

4842
const renderItem = React.useCallback(
49-
({item}: {item: Habit}) => <HabitCard {...item} />,
43+
({ item }: { item: Habit }) => <HabitCard {...item} enableNotifications={item.enableNotifications ?? false} archived={item.archived ?? false} />,
5044
[],
5145
);
5246

47+
if (!db) {
48+
return (
49+
<View className="flex-1 items-center justify-center bg-secondary/30">
50+
<Text>Loading database...</Text>
51+
</View>
52+
);
53+
}
54+
55+
const { data: habits, error } = useLiveQuery(
56+
db.select().from(habitTable).where(eq(habitTable.archived, false)),
57+
);
58+
5359
if (error) {
5460
return (
5561
<View className="flex-1 items-center justify-center bg-secondary/30">
@@ -76,7 +82,7 @@ function ScreenContent() {
7682
<Text className="text-sm">
7783
This example use sql.js on Web and expo/sqlite on native
7884
</Text>
79-
<Text className="text-sm">
85+
{Platform.OS !== "web" && <Text className="text-sm">
8086
If you change the schema, you need to run{" "}
8187
<Text className="text-sm font-mono text-muted-foreground bg-muted">
8288
bun db:generate
@@ -87,13 +93,13 @@ function ScreenContent() {
8793
<Text className="text-sm font-mono text-muted-foreground bg-muted">
8894
bun migrate
8995
</Text>
90-
</Text>
96+
</Text>}
9197
</View>
9298
)}
9399
ItemSeparatorComponent={() => <View className="p-2" />}
94100
data={habits}
95101
renderItem={renderItem}
96-
keyExtractor={(_, index) => `item-${ index }`}
102+
keyExtractor={(_, index) => `item-${index}`}
97103
ListFooterComponent={<View className="py-4" />}
98104
/>
99105
<View className="absolute web:bottom-20 bottom-10 right-8">

biome.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323
},
2424
"style": {
2525
"useSelfClosingElements": "off",
26-
"noUnusedTemplateLiteral": "off"
26+
"noUnusedTemplateLiteral": "off",
27+
"noNonNullAssertion": "off"
2728
}
2829
}
2930
},

0 commit comments

Comments
 (0)