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, May 23, 11:05 AM
Unknown Object (File)
Sun, Apr 28, 3:51 PM
Unknown Object (File)
Apr 22 2024, 10:58 AM
Unknown Object (File)
Apr 22 2024, 10:58 AM
Unknown Object (File)
Apr 22 2024, 10:57 AM
Unknown Object (File)
Apr 22 2024, 10:57 AM
Unknown Object (File)
Apr 22 2024, 10:54 AM
Unknown Object (File)
Apr 8 2024, 12:51 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.