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

react-native-theme-mk

v0.6.2

Published

Package for managing theme in react-native

Readme

react-native-theme-mk

⚡ Powerful and simple theming system for React Native
with auto-scaling, device awareness, and full TypeScript support.

Build scalable, responsive, and maintainable themes
with light/dark mode and dynamic updates --- without boilerplate.


✨ Features

  • ✅ Light / Dark / Custom themes
  • ✅ Automatic screen scaling
  • ✅ Device & orientation detection
  • ✅ Safe area support
  • ✅ Type-safe themes (TypeScript)
  • ✅ Runtime theme updates
  • ✅ React Hooks API
  • ✅ Zero config setup
  • ✅ Production-tested

📦 Installation

npm install react-native-theme-mk react-native-safe-area-context

or

yarn add react-native-theme-mk react-native-safe-area-context

Usage

ThemeManager

Constructor options

| Option | Description | | -------------------------- | --------------------------------------------- | | dimensionsDesignedDevice | Dimensions of the designed device (optional). | | autoScale | Enables auto-scaling (optional). | | maxWidth | Caps device width (window.width / screen.width) to this value (optional). |

Methods and fields

| Method/Field | Description | | -------------------------- | -------------------------------------------------------- | | name | The name of the current theme. | | theme | The current theme object. | | context | The React context for the current theme. | | set | Sets the current theme by name. | | get | Gets a theme by name. | | update | Performs a deep merge to update/extend themes. | | onChangeName | Registers a callback for theme name changes. | | removeAllListeners | Removes all registered listeners. | | createStyleSheet | Creates a style sheet using the provided styles creator. | | useTheme | Hook to use the current theme. | | useDevice | Hook to use the device information. | | useScale | Hook to use the scale factor. | | device | The device information. | | dimensionsDesignedDevice | The dimensions of the designed device. |

createStyleSheet

| Parameter | Type | Description | | --------------- | ------------ | ---------------------------------------------- | | params | object | An object containing the following properties: | | params.theme | C[keyof C] | The current theme object. | | params.device | IDevice | The device information. | | params.scale | number | The scale factor. |

Device

| Property | Type | Description | |---------------------|-----------|-----------------------------------------------| | isAndroid | boolean | True if the device is running Android. | | isIOS | boolean | True if the device is running iOS. | | isTablet | boolean | True if the device is a tablet. | | isIphoneX | boolean | True if the device is an iPhone X. | | window | object | Dimensions of the device's window { width, height }. | | maxWidth | number | Configured max width cap from ThemeManager options. | | screen | object | Dimensions of the device's screen { width, height }. | | orientation | enum | Current orientation (Portrait or Landscape). | | isLandscape | boolean | True if the device is in landscape mode. | | isPortrait | boolean | True if the device is in portrait mode. | | insets | object | Insets of the device's screen { top, right, bottom, left }. | | frame | object | Insets of the device's screen { width, height, x, y }. | | isSmallScreen | boolean | True if the device has a small screen. | | screenSize | string | Current width bucket: xs / sm / md / lg / xl / xxl. | | isXsScreen | boolean | True when screenSize is xs. | | isSmScreen | boolean | True when screenSize is sm. | | isMdScreen | boolean | True when screenSize is md. | | isLgScreen | boolean | True when screenSize is lg. | | isXlScreen | boolean | True when screenSize is xl. | | isXxlScreen | boolean | True when screenSize is xxl. | | isAtLeast(size) | function | Checks whether current screenSize is >= size. | | isBetween(min,max)| function | Checks whether current screenSize is in range (inclusive). | | isShortScreen | boolean | Deprecated: use screenSize and size-bucket helpers. | | screenAspectRatio | number | Aspect ratio of the device's screen. | | key | string | Unique key for the device dimensions. |

Example

import { themePrimary } from './primary-theme';
import { ThemeManager as ThemeManagerCreator } from 'react-native-theme-mk';
import { type IThemeManagerSchema } from './types';

## ⚡ Quick Start (30 seconds)

### 1️⃣ Create Theme Manager

``` ts
import { ThemeManager as ThemeManagerCreator } from 'react-native-theme-mk';

export const ThemeManager = new ThemeManagerCreator(
  'dark',
  {
    light: {
      colors: {
        background: '#ffffff',
        text: '#000000',
        accent: '#ff9800',
      },
    },
    {
        autoScale: true,
        maxWidth: 480,
        //@default designed device dimensions
        dimensionsDesignedDevice: {
            width: 375,
            height: 812,
        }
    },
  },
  {
    autoScale: true,
  }
);

2️⃣ Wrap Application

import { SafeAreaProvider } from 'react-native-safe-area-context';
import { ThemeManager } from './theme';

const { ThemeProvider } = ThemeManager;

export default function App() {
  return (
    <SafeAreaProvider>
      <ThemeProvider>
        <Root />
      </ThemeProvider>
    </SafeAreaProvider>
  );
}

3️⃣ Create Typed Styles

export const useStyles = ThemeManager.createStyleSheet(({ theme, scale }) => ({
  container: {
    flex: 1,
    backgroundColor: theme.colors.background,
    padding: scale(16),
  },

  text: {
    color: theme.colors.text,
    fontSize: scale(16),
  },

  button: {
    height: scale(48),
    borderRadius: scale(12),
    backgroundColor: theme.colors.accent,
  },
}));

4️⃣ Use in Component

import { View, Text, TouchableOpacity } from 'react-native';
import { useStyles } from './styles';

export function HomeScreen() {
  const styles = useStyles();

  return (
    <View style={styles.container}>
      <Text style={styles.text}>Hello Theme 👋</Text>

      <TouchableOpacity style={styles.button}>
        <Text style={styles.text}>Button</Text>
      </TouchableOpacity>
    </View>
  );
}

🎨 Switch Theme

ThemeManager.set('light');
ThemeManager.set('dark');

🔄 Update Theme Dynamically

ThemeManager.update({
  light: {
    colors: {
      success: '#4CAF50',
    },
  },

  dark: {
    colors: {
      success: '#81C784',
    },
  },
});

📱 Device & Scale API

const { useDevice, useScale, useTheme } = ThemeManager;

const device = useDevice();
const scale = useScale();
const theme = useTheme();

⚙️ ThemeManager Options


Option Type Description


autoScale boolean Enable automatic scaling

dimensionsDesignedDevice object Reference device size for scaling


🚀 Used in Production

This library is actively used in real-world React Native applications.


🤝 Contributing

Contributions, issues, and feature requests are welcome.


⭐ Support

If this library saved you time, consider giving it a star ⭐


📄 License

MIT