Page MenuHomePhabricator

[lib/native] introduce useUpdateThemePreference
ClosedPublic

Authored by ginsu on Oct 20 2023, 12:34 AM.
Tags
None
Referenced Files
F3342864: D9553.id32327.diff
Fri, Nov 22, 2:14 AM
F3340057: D9553.diff
Thu, Nov 21, 9:20 PM
Unknown Object (File)
Thu, Nov 14, 11:08 PM
Unknown Object (File)
Thu, Nov 14, 11:25 AM
Unknown Object (File)
Thu, Nov 14, 11:25 AM
Unknown Object (File)
Thu, Nov 14, 11:25 AM
Unknown Object (File)
Thu, Nov 14, 11:23 AM
Unknown Object (File)
Thu, Nov 14, 11:00 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

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

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.