Skip to content

palette not regenerating when app is in background #19

@jkotra

Description

@jkotra

Hello,

I noticed that when i manually change color palette of system from settings (while app is running in background), the app's color palette is not automatically updated. I could only refresh it by two ways:

  • Toggle Dark Mode
  • Restart App

I attached a small clip to demonstrate the bug.

bug.mp4

more interestingly, getPaletteSync() is returning the same old palette even after it's changed, contrary to my assumption that it returns latest palette on each call.

I went through the code a bit (i know very little about android API), this looked interesting..

const subscription = AppState.addEventListener('focus', () => {
materialYouApi._refresh();
});

I cant determine if it's a issue of android API or RN library.


  • example snippet of my dark mode implementation:
const Navigation = () => {
  const isDarkMode = useColorScheme() === 'dark';
  const palette = useMaterialYouPalette();

  const styles = StyleSheet.create({
    tabBarStyle: {
      backgroundColor: isDarkMode ? palette.system_accent2[10] : palette.system_accent1[2],
      height: 75,
      borderTopWidth: 0, // to remove white line at top of tab navigation

    },
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions