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-trendy

v1.1.0

Published

A powerful, customizable, and type-safe styling library for React Native applications that supports light and dark themes with ease.

Readme

A powerful, customizable, and type-safe styling library for React Native applications that supports light and dark themes with ease.


🌟 Features

  • Dynamic Themes: Supports light and dark mode with seamless transitions.
  • Type-safe: Customizable color palettes and styles with full TypeScript support.
  • Predefined Styles: Includes a wide range of reusable styles for borders, padding, margins, etc.
  • Customizable Components: Prebuilt themed components like ThemedText and ThemedView.

🚀 Getting Started

Installation

npm install react-native-trendy

or

yarn add react-native-trendy

📖 Usage

Setting Up the Theme

Wrap your app with the ThemeProvider from ThemeContext:

import React from 'react';
import { ThemeProvider } from 'react-native-trendy';
import { NewApp } from './App';

const App = () => (
  <ThemeProvider>
    <NewApp />
  </ThemeProvider>
);

export default App;

Accessing Colors

Use the useColors hook to get the theme-specific colors:

import React from 'react';
import { View, Text } from 'react-native';
import { useColors } from 'react-native-trendy';

const MyComponent = () => {
  const colors = useColors();

  return (
    <View style={{ backgroundColor: colors.primary }}>
      <Text style={{ color: colors.text }}>Hello trendy World!</Text>
    </View>
  );
};

export default MyComponent;

Using Custom Colors

import { setCustomColors } from 'react-native-trendy';
import { TouchableOpacity } from 'react-native';


type MyCustomPalette = {
  customPrimary: string;
  customSecondary: string;
};

setCustomColors<MyCustomPalette>({
  light: {
    customPrimary: '#ff5733',
    customSecondary: '#57ff33',
  },
  dark: {
    customPrimary: '#5733ff',
    customSecondary: '#33c1ff',
  },
});

const CustomComponent = () => {
  const colors = useColors<MyCustomPalette>();

  return (
    <TouchableOpacity
      style={[
        {
          backgroundColor: colors.customSecondary,
        },
        paddingStyle.padding12,
        borderRadiusStyle.borderRadius12,
      ]}
      onPress={() => {}}
    >
      <ThemedText>React Native trendy</ThemedText>
    </TouchableOpacity>
  );
};

📦 Components

ThemedView

A View component that adapts to the current theme. Uses the light color as the background color. You can check Predefined Light and Dark Theme Colors.

import { ThemedView } from 'react-native-trendy';

<ThemedView>
  <Text>Hello, Themed World!</Text>
</ThemedView>;

ThemedText

A Text component that applies theme-specific styles. Uses the text color as the text color. You can check Predefined Light and Dark Theme Colors.

import { ThemedText } from 'react-native-trendy';

<ThemedText>Styled Text</ThemedText>;

ScreenLayout

A View component that adapts to the current theme. Uses the screenBackground color as the background color. You can check Predefined Light and Dark Theme Colors.

import { ScreenLayout } from 'react-native-trendy';

<ScreenLayout>{/* Screen components */}</ScreenLayout>;

ErrorBoundary

A component that catches errors.

const CompleteExample = () => (
  <ErrorBoundary
    fallback={({ error, resetError }) => (
      <ThemedView style={flexStyle.flex1}>
        <ThemedText>An error occurred:</ThemedText>
        <ThemedText>{error?.message}</ThemedText>
        <Button title="Reset" onPress={resetError} />
      </ThemedView>
    )}
    onError={(error, errorInfo) => {
      // Log error to service
      console.log('Error:', error);
      console.log('Error Info:', errorInfo);
    }}
  >
    <PotentiallyErrorProneComponent />
  </ErrorBoundary>
);

Hooks

useColors

The useColors hook provides access to the current theme’s colors (light or dark). It returns the extended color palette, including both default and custom colors.

Usage:

import { useColors } from 'react-native-trendy';

const MyComponent = () => {
  const colors = useColors();

  return (
    <View style={{ backgroundColor: colors.primary }}>
      <Text style={{ color: colors.text }}>Hello, World!</Text>
    </View>
  );
};

useTheme

The useTheme hook provides access to the current theme context. It is used internally by useColors but can also be used directly if needed.

Usage:

import { useTheme } from 'react-native-trendy';

const MyComponent = () => {
  const { theme } = useTheme();

  return (
    <View>
      <Text>The current theme is: {theme}</Text>
    </View>
  );
};

useStyles

The useStyles hook provides predefined style functions that are dynamically adjusted based on the current theme and color palette.

Usage:

import useStyles from 'react-native-trendy';

const MyComponent = () => {
  const styles = useStyles();

  return (
    <View style={styles.containerBackgroundColorStyle}>
      <Text style={styles.textColorStyle}>Styled Text</Text>
    </View>
  );
};

Predefined Styles

| Style | Value | Example Usage | |--------------------------|------------|----------------------------| | alignItems | Center, Start, End, Stretch | alignItemsStyle.alignItemsCenter | | alignSelf | Center, Start, End, Stretch | alignSelfStyle.alignSelfCenter | | alignContent | Center, Start, End, Stretch | alignContentStyle.alignContentCenter | | borderBottomLeftRadius | 0-32 | borderBottomLeftRadiusStyle.borderBottomLeftRadius1 | | borderBottomRightRadius | 0-32 | borderBottomRightRadiusStyle.borderBottomRightRadius1 | | borderBottomWidth | 0-32 | borderBottomWidthStyle.borderBottomWidth1 | | borderLeftWidth | 0-32 | borderLeftWidthStyle.borderLeftWidth1 | | borderRadius | 0-32 | borderRadiusStyle.borderRadius1 | | borderRightWidth | 0-32 | borderRightWidthStyle.borderRightWidth1 | | borderTopLeftRadius | 0-32 | borderTopLeftRadiusStyle.borderTopLeftRadius1 | | borderTopRightRadius | 0-32 | borderTopRightRadiusStyle.borderTopRightRadius1 | | borderTopWidth | 0-32 | borderTopWidthStyle.borderTopWidth1 | | flex | 1-32 | flexStyle.flex1 | | flexShrink | -32, -31, -30, ..., 32 | flexShrinkStyle.flexShrink1 | | flexBasis | -32, -31, -30, ..., 32 | flexBasisStyle.flexBasis1 | | flexGrow | -32, -31, -30, ..., 32 | flexGrowStyle.flexGrow1 | | flexWrap | wrap, nowrap, wrapReverse | flexWrapStyle.flexWrap | | flexDirection | Row, Column, RowReverse, ColumnReverse | flexDirectionStyle.flexDirectionRow | | gap | 0-32 | gapStyle.gap1 | | height | 0, 4, 8, ..., 100 | heightStyle.height40 | | justifyContent | Center, Start, End, SpaceBetween, SpaceAround | justifyContentStyle.justifyContentCenter | | margin | -32, -31, -30, ..., 32 | marginStyle.margin32 | | marginBottom | -32, -31, -30, ..., 32 | marginStyle.marginBottom32 | | marginHorizontal | -32, -31, -30, ..., 32 | marginStyle.marginHorizontal32 | | marginLeft | -32, -31, -30, ..., 32 | marginStyle.marginLeft32 | | marginRight | -32, -31, -30, ..., 32 | marginStyle.marginRight32 | | marginTop | -32, -31, -30, ..., 32 | marginStyle.marginTop32 | | marginVertical | -32, -31, -30, ..., 32 | marginStyle.marginVertical32 | | padding | -32, -31, -30, ..., 32 | paddingStyle.padding32 | | paddingBottom | -32, -31, -30, ..., 32 | paddingStyle.paddingBottom32 | | paddingHorizontal | -32, -31, -30, ..., 32 | paddingStyle.paddingHorizontal32 | | paddingLeft | -32, -31, -30, ..., 32 | paddingStyle.paddingLeft32 | | paddingRight | -32, -31, -30, ..., 32 | paddingStyle.paddingRight32 | | paddingTop | -32, -31, -30, ..., 32 | paddingStyle.paddingTop32 | | paddingVertical | -32, -31, -30, ..., 32 | paddingStyle.paddingVertical32 | | position | relative, absolute, fixed | positionStyle.positionRelative | | ratioheight | 0%, 4%, 8%, ..., 100% | ratioheightStyle.height40 | | ratioWidth | 0%, 4%, 8%, ..., 100% | ratioWidthStyle.width40 | | shadow | Color: #000, Offset: (0, 2), Opacity: 0.25, Radius: 3.84, Elevation: 5 | shadowStyle.shadow | | textAlign | center, left, right, justify | textAlignStyle.textAlignCenter | | textFontSize | 6, 8, 10, ..., 32 | textFontSizeStyle.textFontSize6 | | textFontWeight | bold, 100, ..., 900, normal, light | textFontWeightStyle.textFontWeightBold | | width | 0, 4, 8, ..., 100 | widthStyle.width40 |

Predefined Colors

Here is the list of predefined colors available in the library:

Light Theme Colors

| Name | Hex Value | Preview | |-----------------------|-------------|---------------------------------------| | light | #fff | #fff | | dark | #000 | #000 | | screenBackground | #EDF0F8 | #EDF0F8 | | text | #11181C | #11181C | | primary | #1B84FF | #1B84FF | | lightPrimary | #E9F3FF | #E9F3FF | | danger | #F8285A | #F8285A | | lightDanger | #FFEEF3 | #FFEEF3 | | success | #17C653 | #17C653 | | lightSuccess | #EAFFF1 | #EAFFF1 | | secondary | #F1F1F4 | #F1F1F4 | | lightSecondary | #F9F9F9 | #F9F9F9 | | info | #7239EA | #7239EA | | lightInfo | #F8F5FF | #F8F5FF | | warning | #F6C000 | #F6C000 | | lightWarning | #FFF8DD | #FFF8DD | | brand | #FF6F1E | #FF6F1E | | lightBrand | #FFF5EF | #FFF5EF | | gray100 | #F9F9F9 | #F9F9F9 | | gray200 | #F1F1F4 | #F1F1F4 | | gray300 | #DBDFE9 | #DBDFE9 | | gray400 | #C4CADA | #C4CADA | | gray500 | #99A1B7 | #99A1B7 | | gray600 | #78829D | #78829D | | gray700 | #4B5675 | #4B5675 | | gray800 | #252F4A | #252F4A | | gray900 | #071437 | #071437 |

Dark Theme Colors

| Name | Hex Value | Preview | |-----------------------|-------------|---------------------------------------| | light | #000 | #000 | | dark | #fff | #fff | | screenBackground | #1a1b24 | #1a1b24 | | text | #ECEDEE | #ECEDEE | | primary | #006AE6 | #006AE6 | | lightPrimary | #172331 | #172331 | | danger | #E42855 | #E42855 | | lightDanger | #302024 | #302024 | | success | #00A261 | #00A261 | | lightSuccess | #1F2623 | #1F2623 | | secondary | #363843 | #363843 | | lightSecondary | #363843 | #363843 | | info | #883FFF | #883FFF | | lightInfo | #272134 | #272134 | | warning | #C59A00 | #C59A00 | | lightWarning | #242320 | #242320 | | brand | #D74E00 | #D74E00 | | lightBrand | #272320 | #272320 | | gray100 | #1B1C22 | #1B1C22 | | gray200 | #26272F | #26272F | | gray300 | #363843 | #363843 | | gray400 | #464852 | #464852 | | gray500 | #636674 | #636674 | | gray600 | #808290 | #808290 | | gray700 | #9A9CAE | #9A9CAE | | gray800 | #B5B7C8 | #B5B7C8 | | gray900 | #F5F5F5 | #F5F5F5 |


🛠️ Contributing

  1. Fork the repository.
  2. Create a feature branch (git checkout -b feature-name).
  3. Commit your changes (git commit -m 'Add a new feature').
  4. Push to the branch (git push origin feature-name).
  5. Open a pull request.

⚖️ License

This project is licensed under the MIT License. See the LICENSE file for details.