first commit

This commit is contained in:
2026-01-07 10:35:00 +00:00
parent 13745ac89e
commit 3c7190bca4
53 changed files with 5538 additions and 531 deletions

3
src/lib/format.ts Normal file
View File

@@ -0,0 +1,3 @@
export const currency = (v: number) => v.toLocaleString('pt-BR', { style: 'currency', currency: 'BRL' });

23
src/lib/storage.ts Normal file
View File

@@ -0,0 +1,23 @@
import AsyncStorage from '@react-native-async-storage/async-storage';
export const storage = {
async get<T>(key: string, fallback: T): Promise<T> {
try {
const raw = await AsyncStorage.getItem(key);
if (!raw) return fallback;
return JSON.parse(raw) as T;
} catch (err) {
console.error('storage parse error', err);
return fallback;
}
},
async set<T>(key: string, value: T): Promise<void> {
try {
await AsyncStorage.setItem(key, JSON.stringify(value));
} catch (err) {
console.error('storage set error', err);
}
},
};