Skip to content

Update Tailwind theme variables for PortalProvider #95

@joshuadutton

Description

@joshuadutton

My app has the ability to dynamically change the Tailwind theme. This is handled with the Nativewind var function documented here: https://www.nativewind.dev/docs/core-concepts/functions-and-directives#var

Here is an example of my ThemeProvider code:

  return (
    <NavigationThemeProvider value={themeToNavigationTheme(theme)}>
      <StatusBar style={colorScheme} />
      <ThemeContext.Provider value={value}>
        <View className="flex-1" style={vars(themeToCSSVariables(theme))}>
          {children}
          {/* TODO: fix it so that this respects theme changes set by themeToCSSVariables in theme provider */}
          <PortalHost />
        </View>
      </ThemeContext.Provider>
    </NavigationThemeProvider>
  );

PortalHost doesn't respect the dynamic change in theme variables, but it does respect the variables defined in global.css and tailwind.config.ts.

Is there currently a way I can update the style of PortalHost dynamically, or do we need to expose a way for the PortalHost to pass a style prop to it's root view?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions