feat: initial project scaffold with Watch companion app

This commit is contained in:
2026-08-04 17:28:06 +02:00
parent adbb4f01c5
commit 43b6467efb
65 changed files with 6361 additions and 166 deletions
+36
View File
@@ -0,0 +1,36 @@
import { createContext, useContext, useEffect, useState, type ReactNode } from "react";
import { MMKV } from "react-native-mmkv";
const storage = new MMKV();
type SettingsContextType = {
poolLength: number;
setPoolLength: (length: number) => void;
};
const SettingsContext = createContext<SettingsContextType>({
poolLength: 25,
setPoolLength: () => {},
});
export function useSettings() {
return useContext(SettingsContext);
}
export function SettingsProvider({ children }: { children: ReactNode }) {
const [poolLength, setPoolLengthState] = useState<number>(() => {
const stored = storage.getNumber("poolLength");
return stored ?? 25;
});
const setPoolLength = (length: number) => {
setPoolLengthState(length);
storage.set("poolLength", length);
};
return (
<SettingsContext.Provider value={{ poolLength, setPoolLength }}>
{children}
</SettingsContext.Provider>
);
}