react-native-turbo-styles
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

TurboStyles Icon
React Native TurboStyles

👉 Check out the official docs here 👈

React Native Turbo Styles is a TailwindCSS-inspired styling library for React Native with a goal of:

  • Design by constraints (using theme-constraints to guide design).
  • Styling ergonomics (short, nemonic "names" for styles, similar to utility classes in CSS).
  • Strongly-typed.

Example of auto-complete using TurboStyles

Installation

Install the library with:

# With Yarn
yarn add react-native-turbo-styles

# With NPM
npm install react-native-turbo-styles

There are no hard requirements/dependencies for TurboStyles, but the library makes heavy use of TypeScript template literal types. These were release in TS 4.1, and therefore for type-safety/inference to work as intended, you must be using at least TS 4.1.0.

Usage

To use the library, you create a style builder (by providing constraints) and then use the style builder to style things!

import * as React from "react";
import { View } from "react-native";
import {
  createStyleBuilder,
  defaultConstraints,
} from "react-native-turbo-styles";

const { builder: ts } = createStyleBuilder(defaultConstraints);

const MyComponent: React.FC = () => {
  return (
    <View style={ts("flex:1", "justify:center", "items:center", "bg:blue-300")}>
      <View style={ts("w:32", "h:32", "bg:white", "shadow:lg")} />
    </View>
  );
};

TODO:

  • [ ] letterSpacing (tracking)
  • [ ] lineHeight (leading)
  • [ ] Text shadows?

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
0.1.00latest

Version History

VersionDownloads (Last 7 Days)Published
0.1.00
0.0.230
0.0.220
0.0.210
0.0.200
0.0.190
0.0.180
0.0.170
0.0.160
0.0.150
0.0.140
0.0.130
0.0.110
0.0.90
0.0.80
0.0.70
0.0.60
0.0.50
0.0.40
0.0.30
0.0.10

Package Sidebar

Install

npm i react-native-turbo-styles

Weekly Downloads

0

Version

0.1.0

License

MIT

Unpacked Size

71.3 kB

Total Files

24

Last publish

Collaborators

  • gksander