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 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-native-web-tailwindcss

v1.0.10

Published

A React Native translation of TailwindCSS

Downloads

28

Readme

react-native-tailwindcss npm npm

A react native styling system, based on TailwindCSS

Easily apply styles to react native components in a tailwindCSS-like fashion. The utility classes are transformed to object valid names and are all children from an object t, tw, theme or tailwind.

import {t} from 'react-native-tailwindcss';

<View style={[t.absolute, t.inset0, t.p4, t.bgBlue500]} />

Use the tailwind.config.js file as you know and love to customize or just use the default tailwind styles.

In react native sometimes you only need a color value, we've got you covered. The color object contains all your defined colors.

import {color} from 'react-native-tailwindcss';

<StatusBar backgroundColor={color.blue500} />

React native is no css styling so there are some "special cases". Some elements are not necessary and are ignored. Things like breakpoints, plugins, corePlugin disabling, prefixes, separators, variation and the important toggle.

You should also take a look at some special cases:

Usage

Install this package

npm install react-native-tailwindcss

Initialize a new tailwindCSS config file

npx tailwind init

or the complete tailwindCSS config file

npx tailwind init --full

or just use an existing one.

General conversions

Every 'class' becomes CamelCase instead of tailwindCSS default - separated.

border-t-2 => tw.borderT2

A - in the beginning of a 'class' becomes a _.

-mt-2 => tw._mt2

A / also becomes a _ to separate the numbers.

w-1/3 => tw.w1_3

These conversions happen also when adding new items to the config file. If there is anything not working or working different then expected please create an issue.

Special cases

Shadows

  • Android does not use the shadow props to cast shadows, just an elevation value.

    • The elevation value is by default the shadowRadius / 2
    • It can be changed by adding the elevation value after the shadow separated by a ,. (eg.: default: '0 1px 3px 0 rgba(0, 0, 0, .1), 5')
  • Text shadows use the same shadows as box shadows

  • Multiple shadows are not supported in React native. (the first shadow will be used)

  • inner and outline shadows are ignored

Directional Layout

When you need directional layout React Native offers variations to make life easier. Instead of using 'left' or 'right', 'start' and 'end' can be used.

react-native-tailwindcss offers classes to embrace this way of directional layout. every 'class' with L or R, has also an S and E 'class' for start and end.

Testing

npm run test