npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

expo-config-plugin-android-styles

v1.0.1

Published

Expo Config Plugin to programmatically modify Android styles.xml during prebuild. Perfect for customizing DatePicker/TimePicker colors and other Android theme attributes.

Downloads

1,038

Readme

Expo Config Plugin: Android Styles Modifier

npm version npm downloads License: MIT

An Expo Config Plugin to programmatically modify the native Android styles.xml file during the prebuild process.

Installation

npm install expo-config-plugin-android-styles
# or
yarn add expo-config-plugin-android-styles

Problem

Sometimes you need to customize native Android theme attributes that aren't directly exposed via React Native component props or standard Expo config options. Manually editing files in the android directory is discouraged in Expo managed projects.

Common examples include:

  • Changing the accent color of native dialogs like the DatePicker or TimePicker.
  • Setting a default android:windowBackground.
  • Overriding specific theme items for AppTheme or other styles.

Solution

This config plugin uses Expo's withAndroidStyles modifier to safely add or modify <item> tags within specified <style> tags in your android/app/src/main/res/values/styles.xml file.

Compatibility

  • Tested with Expo SDK 48+
  • Requires @expo/config-plugins >= 7.0.0 (this is a peer dependency that should be provided by your Expo project)
  • Requires expo-build-properties for native modifications

Usage

Using app.json

{
  "expo": {
    "plugins": [
      [
        "expo-config-plugin-android-styles",
        {
          "styles": [
            {
              "styleName": "DialogDatePicker.Theme",
              "itemName": "colorAccent",
              "itemValue": "#8f78aa",
              "parentTheme": "Theme.AppCompat.Light.Dialog"
            },
            {
              "styleName": "AppTheme",
              "itemName": "android:datePickerDialogTheme",
              "itemValue": "@style/DialogDatePicker.Theme"
            },
            {
              "styleName": "AppTheme",
              "itemName": "android:timePickerDialogTheme",
              "itemValue": "@style/DialogDatePicker.Theme"
            }
          ]
        }
      ]
    ]
  }
}

Using app.config.js

const withAndroidStylesModifier = require("expo-config-plugin-android-styles");

module.exports = ({ config }) => {
  return {
    ...config,
    plugins: [
      [
        withAndroidStylesModifier,
        {
          styles: [
            {
              styleName: "DialogDatePicker.Theme",
              itemName: "colorAccent",
              itemValue: "#8f78aa",
              parentTheme: "Theme.AppCompat.Light.Dialog",
            },
            {
              styleName: "AppTheme",
              itemName: "android:datePickerDialogTheme",
              itemValue: "@style/DialogDatePicker.Theme",
            },
            {
              styleName: "AppTheme",
              itemName: "android:timePickerDialogTheme",
              itemValue: "@style/DialogDatePicker.Theme",
            },
          ],
        },
      ],
    ],
  };
};

Configuration Options

The plugin accepts an options object with the following structure:

interface StyleConfig {
  styleName: string; // The name of the style to modify/create
  itemName: string; // The name of the item to add/modify
  itemValue: string; // The value to set for the item
  parentTheme?: string; // Optional parent theme for new styles
}

interface PluginOptions {
  styles: StyleConfig[]; // Array of style configurations to apply
}

Example: Customizing DatePicker/TimePicker Accent Color

To customize the DatePicker and TimePicker accent color:

[
  "expo-config-plugin-android-styles",
  {
    "styles": [
      {
        "styleName": "DialogDatePicker.Theme",
        "itemName": "colorAccent",
        "itemValue": "#8f78aa",
        "parentTheme": "Theme.AppCompat.Light.Dialog"
      },
      {
        "styleName": "AppTheme",
        "itemName": "android:datePickerDialogTheme",
        "itemValue": "@style/DialogDatePicker.Theme"
      },
      {
        "styleName": "AppTheme",
        "itemName": "android:timePickerDialogTheme",
        "itemValue": "@style/DialogDatePicker.Theme"
      }
    ]
  }
]

How it Works

This plugin hooks into the Expo prebuild process. It parses the existing styles.xml, allows you to programmatically add or modify style items using the configuration, and then writes the updated styles.xml back to the native android project directory.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

MIT License

Links