Page MenuHomePhabricator

[lib/native] introduce useUpdateThemePreference
ClosedPublic

Authored by ginsu on Oct 20 2023, 12:34 AM.
Tags
None
Referenced Files
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
Unknown Object (File)
Thu, Nov 7, 3:54 PM
Unknown Object (File)
Oct 15 2024, 2:58 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
Lint Not Applicable
Unit
Tests Not Applicable

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.