diff --git a/app/(tabs)/_layout.tsx b/app/(tabs)/_layout.tsx index a3fb5d5..5148202 100644 --- a/app/(tabs)/_layout.tsx +++ b/app/(tabs)/_layout.tsx @@ -10,7 +10,7 @@ import { setupStore } from '../store'; export default function TabLayout() { const colorScheme = useColorScheme(); const store = setupStore({ - products: fixtures + products: fixtures.map(p => p.asObject) }); return ( diff --git a/app/(tabs)/index.tsx b/app/(tabs)/index.tsx index e0f8fe6..1a9e66e 100644 --- a/app/(tabs)/index.tsx +++ b/app/(tabs)/index.tsx @@ -23,17 +23,23 @@ export default function HomeScreen() { if (!activeProduct) return; const l = Number.parseInt(length); const w = Number.parseInt(width); - console.log("l=%d, w=%d", l, w); + // console.log("l=%d, w=%d", l, w); const u = units; const d: dimensions_t = activeProduct.area ? { l, w, u } : { l, u }; - const p = activeProduct.priceFor(d); - console.log("set price %s", p); - const s = p.toLocaleString(undefined, { - minimumFractionDigits: 2, - maximumFractionDigits: 2, - }) - setPrice(s == "NaN" ? "0.00" : s); - }, 10); + try { + const p = activeProduct.priceFor(d); + console.log("set price %s", p); + const s = p.toLocaleString(undefined, { + minimumFractionDigits: 2, + maximumFractionDigits: 2, + }) + setPrice(s == "NaN" ? "0.00" : s); + } catch (err) { + console.log(activeProduct); + console.error(err) + return null; + } + }, 50); return function () { clearInterval(iv); } @@ -67,13 +73,13 @@ export default function HomeScreen() { {units} ) } + +