A utility-first universal design system - powered by Tailwind CSS

Overview

tailwindcss-react-native uses Tailwind CSS as universal design system for all React Native platforms. It lets you share code between all React Native platforms and improves DX, performance and code maintainability.

At during your applications build, it uses the Tailwind CSS compiler to process the styles, themes, and conditional logic. It uses a minimal runtime to selectively apply reactive styles (eg changes to device orientation).

import { Text } from "react-native";

/**
 * A button that changes color when hovered or pressed
 * The text will change font weight when the Pressable is pressed
 */
export function MyFancyButton(props) {
  return (
    <Pressable className="component bg-violet-500 hover:bg-violet-600 active:bg-violet-700">
      <Text className="font-bold component-active:font-extrabold" {...props} />;
    </Pressable>
  );
}

Features

  • Works on all RN platforms
  • Uses the Tailwind compiler - styles computed at build time
  • Small runtime
  • Babel plugin for simple setup and better intellisense support
  • Respects all tailwind.config.js settings, including themes, custom values, plugins
  • dark mode / arbitrary classes / media queries
  • pseudo classes - hover / focus / active on compatble components (docs)
  • styling based on parent state - automacialy style children based upon parent psuedo classes (docs)
  • children styles - create simple layouts based upon parent class

Documentation

All documenation is on our website https://tailwindcss-react-native.vercel.app

In action

You can use the Babel plugin to instantly start writing code! This will also enable your editor's language support and provide features such as autocomplete with no extra setup!

import { Text } from "react-native";

export function BoldText(props) {
  return <Text className="text-bold" {...props} />;
}

Or use the Component API to be more explicit about what gets the styles.

import { Text } from "react-native";
import { styles } from "tailwindcss-react-native";

const StyledText = styled(Text);

export function BoldText(props) {
  return <StyledText className="text-bold" {...props} />;
}

You still have the ability to perform conditional logic and built up complex style objects.

import { Text } from "react-native";

export function MyText({ bold, italic, lineThrough, ...props }) {
  const classNames = [];

  if (bold) classNames.push("font-bold");
  if (italic) classNames.push("italic");
  if (lineThrough) classNames.push("line-through");

  return <Text className={classNames.join(" ")} {...props} />;
}

And access the styles directly

import { Text } from "react-native";
import { useTailwind } from "tailwindcss-react-native";

export function MyActivityIndicator(props) {
  const tw = useTailwind();

  const { color } = tw("text-blue-500");

  return <ActivityIndicator size="small" color={color} {...props} />;
}

Quick start guide

There are more setup configurations and in-depth guides on our website

1. Create a new React Native application

npx create-react-native-app my-tailwind-native-app;

Choose "Default new app"

Then change your cwd to the folder containing the project

cd my-tailwind-native-app

2. Install the dependancies

You will need to install tailwindcss-react-native and it's peer dependancy tailwindcss.

npm install tailwindcss-react-native
npm install --save-dev tailwindcss

3. Setup Tailwind CSS

Run npx tailwindcss init to create a tailwind.config.ts file

Add the paths to all of your component files in your tailwind.config.js file.

// tailwind.config.js
module.exports = {
- content: [],
+ content: ["./**/*.{js,jsx,ts,tsx}"],
  theme: {
    extend: {},
  },
  plugins: [],
}

4. Add the Babel plugin

Modify your babel.config.js

// babel.config.js
module.exports = {
- plugins: [],
+ plugins: ["tailwindcss-react-native/babel"],
};

5. Add the TailwindProvider

Modify your App.js to add the TailwindProvider

// App.js
import { StatusBar } from 'expo-status-bar';
import React from 'react';
import { StyleSheet, Text, View } from 'react-native';
+ import { TailwindProvider } from 'tailwindcss-react-native';

export default function App() {
  return (
+   <TailwindProvider>
      <View style={styles.container}>
        <Text>Open up App.js to start working on your app!</Text>
        <StatusBar style="auto" />
      </View>
+   </TailwindProvider>
  );
}

Thats it 🎉

Start writing code!

import { StatusBar } from 'expo-status-bar';
import React from 'react';
- import { StyleSheet, Text, View } from 'react-native';
+ import { Text, View } from 'react-native';
import { TailwindProvider } from 'tailwindcss-react-native';

export default function App() {
  return (
    <TailwindProvider>
-     <View style={styles.container}>
+     <View className="flex-1 items-center justify-center bg-white">
        <Text>Open up App.js to start working on your app!</Text>
        <StatusBar style="auto" />
      </View>
    </TailwindProvider>
  );
}

- const styles = StyleSheet.create({
-   container: {
-     flex: 1,
-     backgroundColor: '#fff',
-     alignItems: 'center',
-     justifyContent: 'center',
-   },
- });
Comments
  • custom color in tailwind config file not being recognized

    custom color in tailwind config file not being recognized

    Everything works great on this package. The docs are clear and helpful. I only have one issue. When I add a custom color to tailwind.config.js it's not registering. I've restarted expo but still doesn't work. This is my config file for tailwind:

    /** @type {import('tailwindcss').Config} */
    module.exports = {
      content: [
        "./screens/**/*.{js,ts,jsx,tsx}",
        "./pages/**/*.{js,ts,jsx,tsx}",
        "./components/**/*.{js,ts,jsx,tsx}",
      ],
      theme: {
        extend: {
          colors: {
            "regal-blue": "#50d71e",  // this part is not working
          },
        },
      },
      plugins: [],
    };
    
    

    Do you have any suggestions? It's running expo 5.4.11 react-native": "0.68.2 react": "17.0.2

    opened by vital-tech-results 29
  • NativeWind & v2.0.0

    NativeWind & v2.0.0

    This is mostly an issue for myself. to track my progress on v2.0.0.

    v2.0.0 started as a small cleanup but has grown into a large refactor fixing many underlying issues. It will also be released under a new name NativeWind :tada:

    The new (in progress) documentation can be found here: https://www.nativewind.dev

    A migration guide can be found here: https://www.nativewind.dev/guides/tailwindcss-react-native

    Features

    • [x] StyleSheetStore
    • [x] Rename component to group-scoped-start
    • [x] Refactor useTailwind()
    • [x] Platform functions
    • [x] PixelRatio functions
    • [x] Stylesheet functions
    • [x] Per platform theme
    • [x] Group
    • [x] vw/vh units
    • [x] Refactor topics into static output
    • [x] Refactor state bit masks into static output
    • [x] optimise pseudo classes
    • [x] optimise child styles classes

    Testing

    • [x] Vanilla (native)
    • [x] Vanilla (web)
    • [x] Expo (native)
    • [x] Expo (web)
    • [x] NextJS (web)
    • [x] Platforms
    • [x] Light/dark
    • [x] Responsive classes
    • [x] Platform functions
    • [x] PixelRatio functions
    • [x] Stylesheet functions
    • [x] Per platform theme
    • [x] Group
    • [x] Group-scoped
    • [x] Parent
    • [x] Pseudo classes
    • [x] Child styles
    • [x] Units
    • [x] PixelRatio functions
    • [x] vw/vh units
    • [x] EAS build pipeline

    Website

    • [x] Rebrand
    • [x] Remove TaiwindProvider from setup
    • [x] Rewrite setup as "native" and "web" sections
    • [x] Move frameworks to top level
    • [x] Add live example on introduction
    • [x] Add platform variants page
    • [x] Add responsive design page
    • [x] Add typescript page
    • [x] Add themes page
    • [x] Add light/dark mode page
    • [x] Rewrite useTailwind docs
    • [x] Rewrite TailwindProvider docs
    • [x] Rewrite useColorScheme docs
    • [x] Rewrite parent state styling page
    • [x] Rewrite preview features pages
    • [x] Algolia search

    Repo

    • [ ] Release announcement
    • [x] Rebrand readme
    • [ ] Deprecate tailwindcss-react-native
    • [x] Rename repo
    • [x] Update Solito PR

    Post 2.0

    • [ ] RTL support
    • [ ] group-scoped-end
    opened by marklawlor 23
  • No border on android images

    No border on android images

    Describe the bug On Android the border does not apply to images. On iOS it works but not the 1px border (has to be 2px)

    To Reproduce Steps to reproduce the behavior: This does not show any border on Android or iOS:

    <StyledImage 
            className="h-12 w-12 rounded-full border border-red-600" 
            source={require('./no-profile-icon.jpg')}/>
    

    This only shows a 2px border on iOS:

    <StyledImage 
            className="h-12 w-12 rounded-full border-2 border-red-600" 
            source={require('./no-profile-icon.jpg')}/>
    

    I also added a non-rounded image in the snack example to make sure that the issue was not caused by the rounded shape.

    Expected behavior The image should have a red border.

    Expo Snack https://snack.expo.dev/@stesvis/image-border?platform=android

    Screenshots See snack example.

    opened by stesvis 20
  • Module parse failed: Identifier 'StyleSheet' has already been declared

    Module parse failed: Identifier 'StyleSheet' has already been declared

    While trying to use with the Expo and React Native.

    Running with: expo start --web

    Getting this output:

    ./node_modules/react-native-web/dist/vendor/react-native/FlatList/index.js 105:7 Module parse failed: Identifier 'StyleSheet' has already been declared (105:7) File was processed with these loaders:

    • ./node_modules/@expo/webpack-config/node_modules/babel-loader/lib/index.js You may need an additional loader to handle the result of these loaders. | import deepDiffer from "../deepDiffer"; | import * as React from 'react';

    import StyleSheet from "../../../exports/StyleSheet"; | import View from "../../../exports/View"; | import ScrollView from "../../../exports/ScrollView"; ./node_modules/react-native-web/dist/vendor/react-native/VirtualizedList/index.js 146:7 Module parse failed: Identifier 'StyleSheet' has already been declared (146:7) File was processed with these loaders:

    • ./node_modules/@expo/webpack-config/node_modules/babel-loader/lib/index.js You may need an additional loader to handle the result of these loaders. | import RefreshControl from "../../../exports/RefreshControl"; | import ScrollView from "../../../exports/ScrollView";

    import StyleSheet from "../../../exports/StyleSheet"; | import UIManager from "../../../exports/UIManager"; | import View from "../../../exports/View"; ./node_modules/react-native-web/dist/modules/createDOMProps/index.js 22:7 Module parse failed: Identifier 'StyleSheet' has already been declared (22:7) File was processed with these loaders:

    • ./node_modules/@expo/webpack-config/node_modules/babel-loader/lib/index.js You may need an additional loader to handle the result of these loaders. | import AccessibilityUtil from "../AccessibilityUtil"; | import css from "../../exports/StyleSheet/css";

    import StyleSheet from "../../exports/StyleSheet"; | import styleResolver from "../../exports/StyleSheet/styleResolver"; | import { STYLE_GROUPS } from "../../exports/StyleSheet/constants"; ./node_modules/react-native-web/dist/exports/ProgressBar/index.js 39:7 Module parse failed: Identifier 'StyleSheet' has already been declared (39:7) File was processed with these loaders:

    • ./node_modules/@expo/webpack-config/node_modules/babel-loader/lib/index.js You may need an additional loader to handle the result of these loaders. | | import * as React from 'react';

    import StyleSheet from "../StyleSheet"; | import View from "../View"; | var ProgressBar = React.forwardRef(function (props, ref) { ./node_modules/react-native-web/dist/exports/ActivityIndicator/index.js 39:7 Module parse failed: Identifier 'StyleSheet' has already been declared (39:7) File was processed with these loaders:

    • ./node_modules/@expo/webpack-config/node_modules/babel-loader/lib/index.js You may need an additional loader to handle the result of these loaders. | | import * as React from 'react';

    import StyleSheet from "../StyleSheet"; | import View from "../View"; | var accessibilityValue = { ./node_modules/react-native-web/dist/exports/SafeAreaView/index.js 40:7 Module parse failed: Identifier 'StyleSheet' has already been declared (40:7) File was processed with these loaders:

    • ./node_modules/@expo/webpack-config/node_modules/babel-loader/lib/index.js You may need an additional loader to handle the result of these loaders. | import * as React from 'react'; | import { canUseDOM } from 'fbjs/lib/ExecutionEnvironment';

    import StyleSheet from "../StyleSheet"; | import View from "../View"; | ./node_modules/react-native-web/dist/exports/ImageBackground/index.js 41:7 Module parse failed: Identifier 'StyleSheet' has already been declared (41:7) File was processed with these loaders:

    • ./node_modules/@expo/webpack-config/node_modules/babel-loader/lib/index.js You may need an additional loader to handle the result of these loaders. | import { forwardRef } from 'react'; | import Image from "../Image";

    import StyleSheet from "../StyleSheet"; | import View from "../View"; | var emptyObject = {}; ./node_modules/react-native-web/dist/exports/TouchableOpacity/index.js 44:7 Module parse failed: Identifier 'StyleSheet' has already been declared (44:7) File was processed with these loaders:

    • ./node_modules/@expo/webpack-config/node_modules/babel-loader/lib/index.js You may need an additional loader to handle the result of these loaders. | import useMergeRefs from "../../modules/useMergeRefs"; | import usePressEvents from "../../modules/usePressEvents";

    import StyleSheet from "../StyleSheet"; | import View from "../View"; | ./node_modules/react-native-web/dist/exports/TouchableHighlight/index.js 44:7 Module parse failed: Identifier 'StyleSheet' has already been declared (44:7) File was processed with these loaders:

    • ./node_modules/@expo/webpack-config/node_modules/babel-loader/lib/index.js You may need an additional loader to handle the result of these loaders. | import useMergeRefs from "../../modules/useMergeRefs"; | import usePressEvents from "../../modules/usePressEvents";

    import StyleSheet from "../StyleSheet"; | import View from "../View"; | ./node_modules/react-native-web/dist/exports/Pressable/index.js 45:7 Module parse failed: Identifier 'StyleSheet' has already been declared (45:7) File was processed with these loaders:

    • ./node_modules/@expo/webpack-config/node_modules/babel-loader/lib/index.js You may need an additional loader to handle the result of these loaders. | import useHover from "../../modules/useHover"; | import usePressEvents from "../../modules/usePressEvents";

    import StyleSheet from "../StyleSheet"; | import View from "../View"; | ./node_modules/react-native-web/dist/exports/Button/index.js 5:7 Module parse failed: Identifier 'StyleSheet' has already been declared (5:7) File was processed with these loaders:

    • ./node_modules/@expo/webpack-config/node_modules/babel-loader/lib/index.js You may need an additional loader to handle the result of these loaders. | import { StyledComponent } from "tailwindcss-react-native"; | import * as React from 'react';

    import StyleSheet from "../StyleSheet"; | import TouchableOpacity from "../TouchableOpacity"; | import Text from "../Text"; ./node_modules/react-native-web/dist/exports/AppRegistry/AppContainer.js 5:7 Module parse failed: Identifier 'StyleSheet' has already been declared (5:7) File was processed with these loaders:

    • ./node_modules/@expo/webpack-config/node_modules/babel-loader/lib/index.js You may need an additional loader to handle the result of these loaders. | import { StyledComponent } from "tailwindcss-react-native"; | import * as React from 'react';

    import StyleSheet from "../StyleSheet"; | import View from "../View"; | var RootTagContext = React.createContext(null); ./node_modules/react-native-web/dist/exports/Modal/ModalAnimation.js 5:7 Module parse failed: Identifier 'StyleSheet' has already been declared (5:7) File was processed with these loaders:

    • ./node_modules/@expo/webpack-config/node_modules/babel-loader/lib/index.js You may need an additional loader to handle the result of these loaders. | import { StyledComponent } from "tailwindcss-react-native"; | import * as React from 'react';

    import StyleSheet from "../StyleSheet"; | import createElement from "../createElement"; | var ANIMATION_DURATION = 300; ./node_modules/react-native-web/dist/exports/StyleSheet/index.js 5:7 Module parse failed: Identifier 'StyleSheet' has already been declared (5:7) File was processed with these loaders:

    • ./node_modules/@expo/webpack-config/node_modules/babel-loader/lib/index.js You may need an additional loader to handle the result of these loaders. | import { StyledComponent } from "tailwindcss-react-native"; | import { canUseDOM } from 'fbjs/lib/ExecutionEnvironment';

    import StyleSheet from "./StyleSheet"; | | if (canUseDOM && window.REACT_DEVTOOLS_GLOBAL_HOOK) { ./node_modules/react-native-web/dist/exports/View/index.js 63:7 Module parse failed: Identifier 'StyleSheet' has already been declared (63:7) File was processed with these loaders:

    • ./node_modules/@expo/webpack-config/node_modules/babel-loader/lib/index.js You may need an additional loader to handle the result of these loaders. | import usePlatformMethods from "../../modules/usePlatformMethods"; | import useResponderEvents from "../../modules/useResponderEvents";

    import StyleSheet from "../StyleSheet"; | import TextAncestorContext from "../Text/TextAncestorContext"; | ./node_modules/react-native-web/dist/exports/Text/index.js 63:7 Module parse failed: Identifier 'StyleSheet' has already been declared (63:7) File was processed with these loaders:

    • ./node_modules/@expo/webpack-config/node_modules/babel-loader/lib/index.js You may need an additional loader to handle the result of these loaders. | import usePlatformMethods from "../../modules/usePlatformMethods"; | import useResponderEvents from "../../modules/useResponderEvents";

    import StyleSheet from "../StyleSheet"; | import TextAncestorContext from "./TextAncestorContext"; | ./node_modules/react-native-web/dist/exports/TextInput/index.js 64:7 Module parse failed: Identifier 'StyleSheet' has already been declared (64:7) File was processed with these loaders:

    • ./node_modules/@expo/webpack-config/node_modules/babel-loader/lib/index.js You may need an additional loader to handle the result of these loaders. | import usePlatformMethods from "../../modules/usePlatformMethods"; | import useResponderEvents from "../../modules/useResponderEvents";

    import StyleSheet from "../StyleSheet"; | import TextInputState from "../../modules/TextInputState"; | ./node_modules/react-native-web/dist/exports/Picker/index.js 74:7 Module parse failed: Identifier 'StyleSheet' has already been declared (74:7) File was processed with these loaders:

    • ./node_modules/@expo/webpack-config/node_modules/babel-loader/lib/index.js You may need an additional loader to handle the result of these loaders. | import usePlatformMethods from "../../modules/usePlatformMethods"; | import PickerItem from "./PickerItem";

    import StyleSheet from "../StyleSheet"; | var Picker = React.forwardRef(function (props, forwardedRef) { | var children = props.children, ./node_modules/react-native-web/dist/exports/Modal/ModalContent.js 7:7 Module parse failed: Identifier 'StyleSheet' has already been declared (7:7) File was processed with these loaders:

    • ./node_modules/@expo/webpack-config/node_modules/babel-loader/lib/index.js You may need an additional loader to handle the result of these loaders. | import { canUseDOM } from 'fbjs/lib/ExecutionEnvironment'; | import View from "../View";

    import StyleSheet from "../StyleSheet"; | var ModalContent = React.forwardRef(function (props, forwardedRef) { | var active = props.active, ./node_modules/react-native-web/dist/exports/CheckBox/index.js 89:7 Module parse failed: Identifier 'StyleSheet' has already been declared (89:7) File was processed with these loaders:

    • ./node_modules/@expo/webpack-config/node_modules/babel-loader/lib/index.js You may need an additional loader to handle the result of these loaders. | import * as React from 'react'; | import createElement from "../createElement";

    import StyleSheet from "../StyleSheet"; | import View from "../View"; | var CheckBox = React.forwardRef(function (props, forwardedRef) { ./node_modules/react-native-web/dist/exports/Modal/ModalFocusTrap.js 8:7 Module parse failed: Identifier 'StyleSheet' has already been declared (8:7) File was processed with these loaders:

    • ./node_modules/@expo/webpack-config/node_modules/babel-loader/lib/index.js You may need an additional loader to handle the result of these loaders. | import View from "../View"; | import createElement from "../createElement";

    import StyleSheet from "../StyleSheet"; | import UIManager from "../UIManager"; | ./node_modules/react-native-web/dist/exports/Switch/index.js 90:7 Module parse failed: Identifier 'StyleSheet' has already been declared (90:7) File was processed with these loaders:

    • ./node_modules/@expo/webpack-config/node_modules/babel-loader/lib/index.js You may need an additional loader to handle the result of these loaders. | import createElement from "../createElement"; | import multiplyStyleLengthValue from "../../modules/multiplyStyleLengthValue";

    import StyleSheet from "../StyleSheet"; | import View from "../View"; | var emptyObject = {}; ./node_modules/react-native-web/dist/exports/ScrollView/index.js 93:7 Module parse failed: Identifier 'StyleSheet' has already been declared (93:7) File was processed with these loaders:

    • ./node_modules/@expo/webpack-config/node_modules/babel-loader/lib/index.js You may need an additional loader to handle the result of these loaders. | import ScrollResponder from "../../modules/ScrollResponder"; | import ScrollViewBase from "./ScrollViewBase";

    import StyleSheet from "../StyleSheet"; | import View from "../View"; | import React from 'react'; ./node_modules/react-native-web/dist/exports/Image/index.js 94:7 Module parse failed: Identifier 'StyleSheet' has already been declared (94:7) File was processed with these loaders:

    • ./node_modules/@expo/webpack-config/node_modules/babel-loader/lib/index.js You may need an additional loader to handle the result of these loaders. | import ImageLoader from "../../modules/ImageLoader"; | import PixelRatio from "../PixelRatio";

    import StyleSheet from "../StyleSheet"; | import TextAncestorContext from "../Text/TextAncestorContext"; | import View from "../View"; ./node_modules/tailwindcss-react-native/dist/context/platform.js 11:11 Module parse failed: Unexpected token (11:11) You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders | }); | function PlatformProvider({ preview = false, platform = react_native_1.Platform.OS, ...props }) { return <PlatformContext.Provider value={{ preview, platform }} {...props}/>; | } | exports.PlatformProvider = PlatformProvider; ./node_modules/tailwindcss-react-native/dist/context/color-scheme.js 13:84 Module parse failed: Unexpected token (13:84) You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders | }); | function ColorSchemeProvider({ initialColorScheme, ...props }) { const [colorScheme, setColorScheme] = (0, react_1.useState)(initialColorScheme ?? react_native_1.Appearance.getColorScheme() ?? "light"); | return (<ColorSchemeContext.Provider value={{ | colorScheme, ./node_modules/tailwindcss-react-native/dist/context/device-media.js 19:12 Module parse failed: Unexpected token (19:12) You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders | ? "portrait" | : "landscape"; return (<DeviceMediaContext.Provider value={{ | width, | height, ./node_modules/tailwindcss-react-native/dist/styled.js 21:23 Module parse failed: Unexpected token (21:23) You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders | const baseClassName = typeof styledBaseClassNameOrOptions === "string" | ? styledBaseClassNameOrOptions : maybeOptions?.baseClassName; | function Styled({ className, tw: twClassName, baseTw, style: styleProp, children: componentChildren, ...componentProps }, ref) { | const { platform, preview } = (0, platform_1.usePlatform)(); ./node_modules/tailwindcss-react-native/dist/styled-component.js 32:11 Module parse failed: Unexpected token (32:11) You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders | exports.StyledComponent = React.forwardRef(({ component, ...options }, ref) => { | const Component = (0, styled_1.styled)(component); return <Component {...options} ref={ref}/>; | }); | ./node_modules/tailwindcss-react-native/dist/provider.js 32:131 Module parse failed: Unexpected token (32:131) You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders | const device_media_1 = require("./context/device-media"); | const style_sheet_1 = require("./context/style-sheet"); function TailwindProvider({ styles = globalThis.tailwindcss_react_native_style, media = globalThis.tailwindcss_react_native_media ?? {}, initialColorScheme, preview, platform, children, }) { | const stylesheet = { styles, media }; | return (<platform_1.PlatformProvider preview={preview} platform={platform}> ./node_modules/tailwindcss-react-native/dist/context/style-sheet.js 5:43 Module parse failed: Unexpected token (5:43) You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders | exports.useStyleSheet = exports.StyleSheetContext = void 0; | const react_1 = require("react"); globalThis.tailwindcss_react_native_style ?? (globalThis.tailwindcss_react_native_style = {}); | globalThis.tailwindcss_react_native_media ?? (globalThis.tailwindcss_react_native_media = {}); | exports.StyleSheetContext = (0, react_1.createContext)({

    // tailwind.config.js <-- trying to avoid processing node_modules, same problem with ["./**/*.{js,jsx,ts,tsx}"],

    module.exports = {
        content: ["./src/*.{js,jsx,ts,tsx}"],
        theme: {
            extend: {},
        },
        plugins: [],
    }
    

    // babel.config.js

    module.exports = function(api) {
      api.cache(true);
      return {
        presets: ['babel-preset-expo'],
        plugins: ["tailwindcss-react-native/babel"]
      };
    };
    
    
    opened by p4bl1t0 16
  • Cannot use import statement outside a module

    Cannot use import statement outside a module

    tailwind.config.js

    /** @type {import('tailwindcss').Config} */

    // const nativewind = require("nativewind/tailwind")

    module.exports = { content: [ "./App.{js,jsx,ts,tsx}", "./pages//*.{js,jsx,ts,tsx}", "./components//*.{js,ts,jsx,tsx}", ], plugins: [require('nativewind/tailwind/css')], // presets: [nativewind], important: 'html', theme: { extend: {}, }, }

    babel.config.js

    module.exports = { presets: ["babel-preset-expo"], plugins: ['nativewind/babel'], };

    Screenshot 2022-11-28 at 11 49 52 AM

    opened by chirag-codealchemy 15
  • Integrating with Solito

    Integrating with Solito

    Describe the bug I'm trying to create an example repo with Solito and Nativewind. I previously did set up Nativewind with the Expo app and it's working well. Today when I try to make it work with Solito I got the following error. It might be a dependency issue but couldn't figure it out. Any idea how to solve it?

    To Reproduce Reproducible example repo: https://github.com/enesozturk/solito-nativewind You can find the babel config and Tailwind config here.

    Steps to reproduce the behavior:

    1. Fork the repo
    2. Install dependencies with yarn
    3. Run yarn native
    4. See error

    Expected behavior Style the components with Nativewind.

    Screenshots

    See Image Screen Shot 2022-08-11 at 21 43 26

    Also, @nandorojo might have an idea for this. I would appreciate any help 🙌🏽

    opened by enesozturk 14
  • TypeError: Cannot convert undefined value to object on first launch

    TypeError: Cannot convert undefined value to object on first launch

    Hello,

    I hope I'm not doing something wrong as this is the 3rd issue we've run into setting up this library. When the app is first launched in the development environment (not sure about production), we are faced with this error

    The only way around this was to remove all classNames and re-add them while the app is running, which is just not feasible if the app is any more complex than a hello world application. Followed the simplest version of the instructions on the documentation website.

    Environment

    [email protected]
    [email protected]
    
    pending feedback released on @next released 
    opened by thespacemanatee 13
  • Enhance RN style inheritance capability

    Enhance RN style inheritance capability

    RN Component has almost no style inheritance ability. On the Web platform, there are many CSS properties that have the ability to inherit values from parent elements.

    For example, implementing a button with an icon on RN platform.

    <Pressable className="... text-white">
        <MailIcon className="text-white" />
        <Text className="text-white">Button text</Text>
    </Pressable>
    

    Need to set the font color on every child element, which is kind of annoying. The approach I would like.

    <Pressable className="... text-white">
        <MailIcon/>
        <Text>Button text</Text>
    </Pressable>
    

    This is actually the CSS behavior on the Web platform. I see this library can implement Styling based on parent state, so I was wondering if this library could also enhance RN's inheritance ability.

    enhancement 
    opened by timedtext 13
  • [Docs] Missing documentation for fontFamily

    [Docs] Missing documentation for fontFamily

    When i want to use custom font name inside Text element and use tailwindcss-react-native classes

    The font does not work with the classes used, unlike the use of the rest of the available features, is there any solution?

    opened by Ahmedreda20 12
  • I can't make it work on Windows

    I can't make it work on Windows

    Hello,

    I'm super exited by this project, but I can't manage to make it work in my current expo project. (I'm on the currently on the last version of expo)

    I followed all installation steps, and I have no error/warning, it just don't work with Expo GO.

    Maybe it's not compatible ? Thx

    pending feedback 
    opened by alexandreandriesse 12
  • [Bug] Invalid guessAtPath crashes babel plugin

    [Bug] Invalid guessAtPath crashes babel plugin

    We have some aliased paths in our tsconfig.json for sharing code between web/RN, so we import common code like:

    import { Info } from 'common/Interfaces'
    

    This import causes the babel plugin to crash on lstatSync in get-import-blocked-components.js because the guessAtPath is not respecting the paths defined in tsconfig.json, so it's an invalid directory.

    These lines in tsconfig.json set up that path alias:

    {
        "compilerOptions": {
            "paths": {
                "common/*": [
                    "../common/*"
                ]
            }
        }
    }
    

    For our usage we're using allowModules so we can just patch these lines out for now.

    opened by jmeistrich 12
  • [Question] How to configure nativewind in @nrwl/expo app?

    [Question] How to configure nativewind in @nrwl/expo app?

    I'm trying to configure nativewind in my nx app generated with @nrwl/expo. I followed official doc at https://www.nativewind.dev/quick-starts/expo

    yarn add nativewind
    yarn add --dev tailwindcss
    
    // tailwind.config.js
    
    module.exports = {
      content: ['./src/app/**/*.{js,jsx,ts,tsx}'],
      theme: {
        extend: {},
      },
      plugins: [],
    }
    
    // babel.config.js
    module.exports = function (api) {
      api.cache(true);
      return {
        presets: ['babel-preset-expo'],
        plugins: ['nativewind/babel'],
      };
    };
    

    I get the following error

    iOS Bundling failed 95ms
    error: src/app/App.tsx: /Volumes/Storage/work/nx-app/apps/my-app/src/app/App.tsx: Failed to parse declaration "boxShadow: 0 1px 2px 0 rgb(0 0 0 / 0.05)"
    

    What am I missing?

    opened by SurjitSahoo 0
  • npm instead of Yarn

    npm instead of Yarn

    I followed the instruction here to install and configure the package on my expo project. I did everything as instructed except for using npm instead of yarn to install the package and tailwindcss. It seems like the class names don't work.

    I have tried installing using Yarn and it worked fine. Is this the intended behavior? Any insights?

    opened by AkbarBakhshi 0
  • How to generate pre-compiled RN StyleSheet objects in V3?

    How to generate pre-compiled RN StyleSheet objects in V3?

    Describe the bug I am trying to generate pre-compiled RN StyleSheet objects in V3, but since postcss is no longer supported, I cannot find a way to do this.

    To Reproduce N/A

    Expected behavior Output a output file with pre compiled components.

    Expo Snack N/A

    Screenshots N/A

    Additional context Would like to know a solution for this, also, would be nice if you could --watch the output aswell.

    opened by fendyk 0
  • Can't define custom font sizes

    Can't define custom font sizes

    Describe the bug When trying to define custom font sizes for different devices dpi, it doesn't compile.

    index.js: [BABEL] C:\Users\conta\Desktop\Dev\my-proj\index.js: Cannot use import statement outside a module (While processing: "C:\Users\conta\Desktop\Dev\my-proj\node_modules\nativewind\babel.js")

    To Reproduce Steps to reproduce the behavior:

    1. Use nativewind ^2.0.11
    2. Go to tailwind.config.js
    3. Import const { fontScale } = require("nativewind");
    4. Define any custom fontSizes using fontScale
    5. Use the class on any Text component
    6. See error
    opened by fmcalado 10
  • Undefined is not a function - with-conditionals.js

    Undefined is not a function - with-conditionals.js

    Describe the bug 'Undefined is not a function', happens somewhere inside Nativewind's code. It comes out of the node_modules/nativewind/dist/runtime/native/styled/with-conditionals.js" file.

    To Reproduce Cannot show due to being a private application. I've used 2.0.0 before and everything seems to be working, but when I upgraded to 3.0.0, this happened.

    Expected behavior Should work after compilation and loading the application.

    Expo Snack It's a React Native app

    Screenshots Scherm­afbeelding 2022-12-15 om 11 12 44

    Additional context For some reason, my Login page styling works but other wont. I have tried changing the 'content' in tailwind.config.js to different directories but it does not seem to help or dissolve the issue.

    The issue even persists when I don't set a path at all in my tailwind.config.js. NativeWind: warn - No utility classes were detected in your source files. If this is unexpected, double-check the 'content' option in your Tailwind CSS configuration.

    opened by fendyk 0
Web UI kit following simply superb.'s design system, based on Tailwind CSS.

ui-kit TailwindCSS powered UI kit following simply superb.'s design system. ➡️ Demo available here Why I am building few applications (iOS / Android /

simply superb. 8 Mar 4, 2022
The Frontend of Escobar's Inventory Management System, Employee Management System, Ordering System, and Income & Expense System

Usage Create an App # with npx $ npx create-nextron-app my-app --example with-javascript # with yarn $ yarn create nextron-app my-app --example with-

Viver Bungag 4 Jan 2, 2023
Kaol Stack - Prisma, Expo, Next, TRPC, Solito, Tailwind - A monorepo template for a truly universal app

Kaol Stack ?? About A monorepo with Prisma, Next.js, Expo, tRPC, Authentication and Solito setup and configured to work together. With this setup you

Matheus Vicente 187 Dec 21, 2022
An npm package with Tailwind CSS utility classes for creating responsive grid columns without media queries using auto fit.

Grid Auto Fit for Tailwind CSS A plugin that helps you create a responsive grid layout in Tailwind CSS without using media queries. It uses the auto-f

Thirus 80 Dec 28, 2022
⏪ Rewinds – Remix Tailwind Starter Kit with Tailwind CSS, Headless UI, Radix UI, and more

⏪ Rewinds – Remix Tailwind Starter Kit Rewinds is a Remix starter kit with Tailwind CSS v3 family of libraries. This is an example demo to combine the

M Haidar Hanif 81 Dec 24, 2022
Discover a vast library of open-source Tailwind CSS components and Mobile UI design elements 🚀

SundarUI ?? Discover a vast library of open-source Tailwind CSS components and Mobile UI design elements ?? What is SundarUI? Sundar UI is a library o

Raj Patel 4 Mar 19, 2023
⚡ the first open-source redis client made with care and acessibility-first 🚀

⚡ Redis UI The first open-source project to create an awesome and accessible UI for Redis as a native desktop application. ✨ ?? ?? How to develop loca

Nicolas Lopes Aquino 14 Dec 5, 2022
The CSS design system that powers GitHub

Primer CSS The CSS implementation of GitHub's Primer Design System Documentation Our documentation site lives at primer.style/css. You'll be able to f

Primer 11.6k Jan 7, 2023
A utility for creating toggleable items with JavaScript. Inspired by bootstrap's toggle utility. Implemented in vanillaJS in a functional style.

LUX TOGGLE Demo: https://jesschampion.github.io/lux-toggle/ A utility for creating toggleable dom elements with JavaScript. Inspired by bootstrap's to

Jess Champion 2 Oct 3, 2020
A Tailwind plugin that allows to create multiple groups utilities such as group-card or group-1 and works with Tailwind 3 features and all variations.

Tailwind Labeled Groups A plugin that allows to create multiple groups utilities such as group-card or group-1 and works with Tailwind 3 features and

Max 18 Nov 21, 2022
Notion-powered blog starter with Nextjs and Tailwind

Nextjs Notion Blog Starter Default demo - Deployed from main branch Blog setup - I wrote an article on how to use this starter to start your blog My p

Tuan Phung 94 Dec 29, 2022
Notion-powered blog starter with Nextjs and Tailwind

Nextjs Notion Blog Starter Default demo - Deployed from main branch Blog setup - I wrote an article on how to use this starter to start your blog My p

Tuan Phung 63 Oct 11, 2022
🚀 Blazing Fast S3 Powered CDN ✨ Powered By Fastify, S3 Buckets & Docker!

?? WasiCDN Blazing Fast S3 Powered CDN, Powered By Fastify, S3 Compatible Buckets & Docker! Core DockerHub: https://hub.docker.com/r/maximking19/wasic

Maxim 5 Aug 31, 2022
A local-first personal finance system

Note from maintainer: don't expect responses or PR merges until May 16th. ??️ I (@jlongster) am currently away on vacation and not checking this. I am

null 5.7k Dec 31, 2022
Arabic-first task management system

Labeeb An Arabic-first, open-source Tasks Management System created for Damascus University's third year project, Faculty of Information Technology. F

Yaman Qassas 8 Dec 30, 2022
⚡ A blazing fast, lightweight, and open source comment system for your static website, blogs powered by Supabase

SupaComments ⚡ A blazing fast, lightweight, and open source comment system for your static website, blogs ?? Demo You can visit the Below demo blog po

MC Naveen 112 Dec 27, 2022
The PatternFly Design Kit is a Sketch library used for creating PatternFly accurate design mockups

PatternFly Design Kit The PatternFly Design Kit is a collection of Sketch assets that make it easy for designers to create high-fidelity design mockup

PatternFly 44 Jan 2, 2023
Just a Universal Mineflayer Bot (Opensourced)

❓ What is JUMBO? JUMBO (Just a Universal Mineflayer Bot - Opensourced) is a Minecraft robot made using Mineflayer package and its addons. Supports MC

Hedgie 16 Dec 9, 2022
Universal interface for web3 wallets

Universal interface for web3 wallets

WeBill.io 76 Dec 31, 2022