aboutsummaryrefslogtreecommitdiff
path: root/src/hooks
diff options
context:
space:
mode:
Diffstat (limited to 'src/hooks')
-rw-r--r--src/hooks/use-app-hooks.ts20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/hooks/use-app-hooks.ts b/src/hooks/use-app-hooks.ts
new file mode 100644
index 0000000..f10d1ef
--- /dev/null
+++ b/src/hooks/use-app-hooks.ts
@@ -0,0 +1,20 @@
+import { useFonts } from 'expo-font';
+import { DMSans_300Light, DMSans_400Regular, DMSans_600SemiBold, DMSans_700Bold } from '@expo-google-fonts/dm-sans';
+import { calcularSalarioLiquido, type ResultadoCalculo } from '@/utils/tax-calculator';
+
+export function useAppFonts() {
+ const [loaded, error] = useFonts({
+ DMSans_300Light,
+ DMSans_400Regular,
+ DMSans_600SemiBold,
+ DMSans_700Bold,
+ });
+
+ return { fontsLoaded: loaded, fontsError: error };
+}
+
+export function useSalaryCalculator(grossSalaryStr: string): ResultadoCalculo | null {
+ const value = parseFloat(grossSalaryStr.replace(',', '.'));
+ if (isNaN(value) || value <= 0) return null;
+ return calcularSalarioLiquido(value);
+} \ No newline at end of file