🔖 Title
Extract Settings screen logic into a dedicated useSettingsScreen hook
📄 Description
SettingsScreen currently mixes UI rendering with internal state and behavior (preferences state, toggle handlers, and animated toggle behavior). This issue introduces a dedicated hook to centralize screen logic and keep the screen component focused on presentation.
Create a useSettingsScreen hook that encapsulates all non-visual logic currently inside components/pages/SettingsScreen.tsx. After the refactor, SettingsScreen should keep only visual structure and bindings to values/handlers returned by the hook.
Scope includes extracting state, handlers, and any related logic into the hook while preserving existing behavior and UX. Scope excludes redesigning the settings UI, changing copy/content, or altering navigation flow beyond keeping the current onBack behavior.
Regression constraints:
- Preserve all current toggle behavior and initial preference values.
- Preserve current animation behavior for custom toggles.
- Preserve current
onBack behavior and accessibility labels/roles.
- Follow existing TypeScript and hooks conventions in the repository.
- Avoid introducing
any unless strictly justified.
Pull request (definition of done): The implementer must open the PR with the repository PR template fully completed, stating which parts of this issue were completed, checklist per what was done, screenshots/test evidence when required, and a link to this issue. Do not leave required sections empty.
Current structure:
components/pages/SettingsScreen.tsx: contains both presentation and logic (prefs state, togglePref, animation setup in CustomToggle via Animated.Value and useEffect).
Target structure:
hooks/settings/use-settings-screen.ts (or project-standard equivalent): exposes typed state and handlers required by SettingsScreen and the toggle UI behavior.
components/pages/SettingsScreen.tsx: visual-only component consuming values and callbacks from useSettingsScreen.
- Optional: if needed for clarity, keep
CustomToggle as a presentational component and pass in already-prepared values/handlers from the hook contract.
✅ Tasks to complete
📚 Documentation/context for AI
components/pages/SettingsScreen.tsx
hooks/invest/use-invest.ts
hooks/auth/use-create-account.ts
hooks/auth/use-sign-in.ts
components/shared/MainLayout.tsx
theme/colors.json
- Repository PR template (
.github/pull_request_template.md or equivalent location)
🗒️ Additional notes
- Keep the change focused on separation of concerns (logic vs. UI), not feature expansion.
- Minimal internal refactors are allowed only if needed to support clean hook extraction.
- Do not modify unrelated screens or shared layout behavior.
- PRs with incomplete template sections are not acceptable.
🎨 Design Reference
No design changes requested; keep current visual output unchanged.
🔖 Title
Extract Settings screen logic into a dedicated
useSettingsScreenhook📄 Description
SettingsScreencurrently mixes UI rendering with internal state and behavior (preferences state, toggle handlers, and animated toggle behavior). This issue introduces a dedicated hook to centralize screen logic and keep the screen component focused on presentation.Create a
useSettingsScreenhook that encapsulates all non-visual logic currently insidecomponents/pages/SettingsScreen.tsx. After the refactor,SettingsScreenshould keep only visual structure and bindings to values/handlers returned by the hook.Scope includes extracting state, handlers, and any related logic into the hook while preserving existing behavior and UX. Scope excludes redesigning the settings UI, changing copy/content, or altering navigation flow beyond keeping the current
onBackbehavior.Regression constraints:
onBackbehavior and accessibility labels/roles.anyunless strictly justified.Pull request (definition of done): The implementer must open the PR with the repository PR template fully completed, stating which parts of this issue were completed, checklist per what was done, screenshots/test evidence when required, and a link to this issue. Do not leave required sections empty.
Current structure:
components/pages/SettingsScreen.tsx: contains both presentation and logic (prefsstate,togglePref, animation setup inCustomToggleviaAnimated.ValueanduseEffect).Target structure:
hooks/settings/use-settings-screen.ts(or project-standard equivalent): exposes typed state and handlers required bySettingsScreenand the toggle UI behavior.components/pages/SettingsScreen.tsx: visual-only component consuming values and callbacks fromuseSettingsScreen.CustomToggleas a presentational component and pass in already-prepared values/handlers from the hook contract.✅ Tasks to complete
hooks/invest/use-invest.tsandhooks/auth/*useSettingsScreenhook with a typed return contract (interface/type) for all logic consumed bySettingsScreencomponents/pages/SettingsScreen.tsxinto the new hookSettingsScreenremains presentation-focusedcomponents/pages/SettingsScreen.tsxto consume only hook outputs and render UIanyunless justified📚 Documentation/context for AI
components/pages/SettingsScreen.tsxhooks/invest/use-invest.tshooks/auth/use-create-account.tshooks/auth/use-sign-in.tscomponents/shared/MainLayout.tsxtheme/colors.json.github/pull_request_template.mdor equivalent location)🗒️ Additional notes
🎨 Design Reference
No design changes requested; keep current visual output unchanged.