{"id":25757580,"url":"https://github.com/shervin-ghajar/react-native-stylewind","last_synced_at":"2025-05-13T00:06:38.561Z","repository":{"id":270122873,"uuid":"909400425","full_name":"shervin-ghajar/react-native-stylewind","owner":"shervin-ghajar","description":"react-native-stylewind is a utility-first styling framework specifically designed for React Native. ","archived":false,"fork":false,"pushed_at":"2025-03-12T11:21:38.000Z","size":10693,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-13T00:06:30.124Z","etag":null,"topics":["css","design-system","react-native","reactnative","styled-components","tailwindcss"],"latest_commit_sha":null,"homepage":"https://shervin-ghajar.github.io/react-native-stylewind/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shervin-ghajar.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-12-28T15:37:51.000Z","updated_at":"2025-03-12T11:20:17.000Z","dependencies_parsed_at":"2025-02-18T15:38:48.620Z","dependency_job_id":null,"html_url":"https://github.com/shervin-ghajar/react-native-stylewind","commit_stats":null,"previous_names":["shervin-ghajar/react-native-tailwind","shervin-ghajar/react-native-stylewind"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shervin-ghajar%2Freact-native-stylewind","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shervin-ghajar%2Freact-native-stylewind/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shervin-ghajar%2Freact-native-stylewind/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shervin-ghajar%2Freact-native-stylewind/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shervin-ghajar","download_url":"https://codeload.github.com/shervin-ghajar/react-native-stylewind/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253843215,"owners_count":21972873,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["css","design-system","react-native","reactnative","styled-components","tailwindcss"],"created_at":"2025-02-26T16:24:11.443Z","updated_at":"2025-05-13T00:06:38.551Z","avatar_url":"https://github.com/shervin-ghajar.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"# React Native Stylewind\n\nEver wished you had the flexibility of utility-first styling in React Native, but with **better maintainability, type-safety**, and more developer freedom? Well, that's exactly what **React Native Stylewind** delivers! 🎉 With this library, you can enjoy dynamic style generation based on your custom theme, and still keep your styles clean, reusable, and highly maintainable.\n\nUse **utility styles** for quick styling or leverage **createStyle** for more structured, theme-based styles. With full TypeScript support, you get the best of both worlds—**ease of use** and **robust, type-safe development**.\n\n## ✨ Features\n\n- **🎨 Dynamic Theming** – Utility styles are generated on the fly based on your `theme.config.ts`.\n- **⚡ Tailwind-Like Styling** – Use familiar utility styles for a seamless styling experience.\n- **🛠️ Highly Customizable** – Define your own colors, utilities, spacing, typography.\n- **🔐 Type-Safe** – Full TypeScript support ensures your styles are always correct.\n- **🚀 Real-Time Updates** – Styles regenerate automatically when your theme changes.\n- **🛆 Tree-Shaking for Performance** – Unused styles get kicked out, keeping your bundle lean.\n- **💡 Flexible Usage** – Use utility-first styles or `createStyle` with theme configurations.\n\n## 👥 Installation\n\nFirst, install the package via npm or yarn:\n\n```bash\nnpm install rn-stylewind\n# or\nyarn add rn-stylewind\n```\n\n## 🛠️ Setup\n\nBefore diving in, wrap your **Metro bundler config** to enable dynamic style generation.\n\n### 1️⃣ Add to `metro.config.js`\n\n```javascript\nconst { getDefaultConfig } = require('expo/metro-config');\nconst withRNStylewind = require('rn-stylewind/metro');\n\nconst defaultConfig = getDefaultConfig(__dirname);\n\nmodule.exports = withRNStylewind(defaultConfig);\n```\n\n### 2️⃣ Initialize Default Theme Configuration\n\nTo initialize and create the default `theme.config.mjs` file, run the following command:\n\n```bash\nnpx init-rn-stylewind\n```\n\nThis will generate a `theme.config.mjs` file in the root directory of your project as below. You can customize this file to define your theme colors, spacing, typography, utilities.\n```javascript\n// theme.config.mjs\nimport { createTheme } from 'rn-stylewind';\n\nexport default await createTheme({\n  mode:'light',\n  colors: {\n    primary: {\n      default: '#1D4ED8',\n      light: '#93C5FD',\n      dark: '#1E3A8A',\n    },\n  },\n  spacing: {\n    default: 8,\n  },\n  // Modify other theme settings if needed\n});\n```\n\n## 🎯 Usage\n\nWrap your application with `ThemeProvider` to ensure your styles and theme configurations are accessible throughout the project:\n\n```tsx\nimport { ThemeProvider } from 'rn-stylewind';\nimport MyComponent from './MyComponent';\n\nfunction App() {\n  return (\n    \u003cThemeProvider\u003e\n      \u003cMyComponent /\u003e\n    \u003c/ThemeProvider\u003e\n  );\n}\n```\nHere’s how simple and powerful `stylewind` is:\n\n```tsx\nimport { Text, Pressable } from 'react-native';\nimport {  styles } from 'rn-stylewind';\n\n// 🚀 Utility-first styling at its finest!\nexport const Button = ({ title, ...rest }) =\u003e {\n  return (\n    \u003cPressable style={styles(['bgError', 'p-5'])} {...rest}\u003e\n      \u003cText style={styles(['bgBackgroundLight', 'textCenter'])}\u003e{title}\u003c/Text\u003e\n    \u003c/Pressable\u003e\n  );\n};\n```\n\n### Using `styles` Function\n\nThe `styles` function allows developers to apply utility styles easily. If a color-based utility class does not specify a Dark or Light mode variant, `styles` will automatically pick the appropriate color based on the current theme `mode`.\n\n```tsx\n\u003cView style={styles(['bgPrimary'])}\u003e // if mode is `light`, `bgPrimary` will return `bgPrimaryLight` color\n  \u003cText style={styles(['textSecondary'])}\u003eDynamic Themed Text\u003c/Text\u003e \n\u003c/View\u003e\n```\n\n### Using `createStyle`\n\nThe `createStyle` function enables structured, reusable styles with full TypeScript support and theme-based values.\n\n```tsx\nimport { createStyle, styles } from 'rn-stylewind';\n\nconst useMyStyles = createStyle({\n  container: (theme) =\u003e ({\n    padding: theme.spacing.md,\n    backgroundColor: theme.utilities.bgBackground.backgroundColor // using specific style of an utility,\n    ...theme.utilities['p-1'] // using utility style\n  }),\n  text: {\n    padding: 4\n  },\n});\n\nfunction MyComponent() {\n  const myStyles = useMyStyles();\n  return (\n    \u003cView style={styles([myStyles.container])}\u003e\n      \u003cText style={styles([myStyles.text])}\u003eHello, world!\u003c/Text\u003e\n    \u003c/View\u003e\n  );\n}\n```\n\n### Using `useTheme` Hook\n\nTo access the theme context, use the `useTheme` hook:\n\n```tsx\nimport { useTheme,styles } from 'rn-stylewind';\n\nexport const MyComponent = () =\u003e {\n  const { theme, isDarkMode, toggleMode } = useTheme();\n  \n  return (\n    \u003cView style={styles([isDarkMode ? 'bgBlack' : 'bgWhite'])}\u003e\n      \u003cText style={styles(['textSecondary'])}\u003eCurrent Theme: {theme.mode}\u003c/Text\u003e\n      \u003cButton title=\"Toggle Theme\" onPress={toggleMode} /\u003e\n    \u003c/View\u003e\n  );\n}\n```\n\nNow, you can use `useTheme()` in your components to access the theme and utilities dynamically.\n\n## 📚 Documentation\n\nFor full documentation, visit [React Native Stylewind](https://shervin-ghajar.github.io/react-native-stylewind/).\n\n## Platform Support\n\n[![supports Expo](https://img.shields.io/badge/Expo-4630EB.svg?style=for-the-badge\u0026logo=EXPO\u0026labelColor=000\u0026logoColor=fff)](https://expo.dev/)\n[![supports iOS](https://img.shields.io/badge/iOS-555555.svg?style=for-the-badge\u0026logo=APPLE\u0026labelColor=000\u0026logoColor=fff)](https://reactnative.dev/)\n[![supports Android](https://img.shields.io/badge/Android-A4C639.svg?style=for-the-badge\u0026logo=ANDROID\u0026labelColor=000\u0026logoColor=fff)](https://reactnative.dev/)\n[![supports web](https://img.shields.io/badge/Web-4285F4.svg?style=for-the-badge\u0026logo=GOOGLE-CHROME\u0026labelColor=000\u0026logoColor=fff)](https://necolas.github.io/react-native-web/)\n\n**React Native Stylewind** is 100% compatible with the [Expo Framework](https://expo.io/) and works with both [Expo Go](https://expo.dev/client) and in the [bare workflow](https://docs.expo.dev/bare/exploring-bare-workflow/).\n\n\n## 🔥 Why You'll Love It\n\n✅ **No more inline styles cluttering your components**\\\n✅ **Faster development with utility-driven styling**\\\n✅ **Built for performance with tree-shaking**\\\n✅ **Theming that just makes sense**\\\n✅ **Flexibility to use utility styles or structured styles**\n\nNow go forth and **style like a boss**! 🚀\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshervin-ghajar%2Freact-native-stylewind","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshervin-ghajar%2Freact-native-stylewind","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshervin-ghajar%2Freact-native-stylewind/lists"}