Page MenuHomePhabricator

[lib/native] introduce useUpdateThemePreference
ClosedPublic

Authored by ginsu on Oct 20 2023, 12:34 AM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Dec 20, 7:18 AM
Unknown Object (File)
Sat, Nov 30, 4:38 PM
Unknown Object (File)
Mon, Nov 25, 7:57 AM
Unknown Object (File)
Nov 22 2024, 3:41 AM
Unknown Object (File)
Nov 22 2024, 2:14 AM
Unknown Object (File)
Nov 21 2024, 9:20 PM
Unknown Object (File)
Nov 14 2024, 11:08 PM
Unknown Object (File)
Nov 14 2024, 11:25 AM
Subscribers

Details

Summary

We are going to want this exact logic in our web AppearanceChangeModal. Rather than copy + paste this logic, this diff preemptively factors out this logic into a seperate hook that can be conusmed by each platform

Part of https://linear.app/comm/issue/ENG-4958/update-theme-based-on-the-active-theme-redux-state

Depends on D9552

Test Plan

flow + confirmed that there were no regressions with updating the app theme

Diff Detail

Repository
rCOMM Comm
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

lib/hooks/theme.js
53–56 ↗(On Diff #32246)

I thought this was more readable than

const theme =
  themePreference === 'system'
    ? this.props.globalThemeInfo.systemTheme
    : themePreference;

happy to change it back to this if people prefer this

atul added inline comments.
native/profile/appearance-preferences.react.js
63 ↗(On Diff #32246)

Almost got me, but looks like this is class component

This revision is now accepted and ready to land.Oct 20 2023, 10:47 AM
This revision was landed with ongoing or failed builds.Oct 23 2023, 11:15 AM
This revision was automatically updated to reflect the committed changes.