├── .circleci └── config.yml ├── .editorconfig ├── .eslintrc ├── .gitattributes ├── .gitignore ├── .prettierrc.js ├── .yarn └── install-state.gz ├── CHANGELOG.md ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── babel.config.js ├── commitlint.config.js ├── docs ├── .gitignore ├── .prettierignore ├── LICENSE ├── next.config.js ├── package.json ├── pages │ ├── _app.js │ ├── apis │ │ ├── gradient.mdx │ │ ├── makeTheme.mdx │ │ ├── meta.json │ │ ├── styled.mdx │ │ ├── useDripsyTheme.mdx │ │ └── useSx.mdx │ ├── fonts.mdx │ ├── get-started │ │ ├── installation.mdx │ │ ├── meta.json │ │ ├── monorepo.mdx │ │ ├── setup.mdx │ │ └── web │ │ │ ├── expo.mdx │ │ │ ├── meta.json │ │ │ ├── next.mdx │ │ │ └── seo.mdx │ ├── index.mdx │ ├── meta.json │ ├── typescript │ │ ├── exports.mdx │ │ ├── meta.json │ │ ├── native.mdx │ │ ├── setup.mdx │ │ ├── strict.mdx │ │ └── variants.mdx │ ├── usage │ │ ├── meta.json │ │ ├── overview.mdx │ │ ├── responsive-design.mdx │ │ └── theming │ │ │ ├── color-modes.mdx │ │ │ ├── create.mdx │ │ │ ├── fonts.mdx │ │ │ ├── gradients.mdx │ │ │ ├── meta.json │ │ │ ├── shadows.mdx │ │ │ ├── types.mdx │ │ │ └── variants.mdx │ └── v3.mdx ├── public │ ├── favicon.png │ ├── og.png │ └── view-variant.png ├── theme.config.js └── yarn.lock ├── examples ├── example │ ├── App.tsx │ ├── CHANGELOG.md │ ├── __generated__ │ │ └── AppEntry.js │ ├── app.json │ ├── babel.config.js │ ├── hook.tsx │ ├── metro.config.js │ ├── package.json │ ├── tsconfig.json │ ├── view.tsx │ ├── web-build │ │ └── register-service-worker.js │ └── webpack.config.js └── next-example │ ├── .gitignore │ ├── App.tsx │ ├── CHANGELOG.md │ ├── README.md │ ├── __generated__ │ └── AppEntry.js │ ├── app.json │ ├── babel.config.js │ ├── metro.config.js │ ├── next-env.d.ts │ ├── next.config.js │ ├── package.json │ ├── pages │ ├── _document.js │ └── index.tsx │ └── tsconfig.json ├── lerna-debug.log ├── lerna.json ├── package.json ├── packages └── dripsy │ ├── .eslintrc.js │ ├── .yarnml │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── babel.config.js │ ├── gradient │ ├── index.d.ts │ ├── index.js │ └── index.native.js │ ├── index.d.ts │ ├── package.json │ ├── src │ ├── core │ │ ├── components │ │ │ ├── A.ts │ │ │ ├── Container.ts │ │ │ ├── FlatList.ts │ │ │ ├── Flex.ts │ │ │ ├── H1.ts │ │ │ ├── H2.ts │ │ │ ├── H3.ts │ │ │ ├── H4.ts │ │ │ ├── H5.ts │ │ │ ├── H6.ts │ │ │ ├── Image.ts │ │ │ ├── P.ts │ │ │ ├── SafeAreaView.ts │ │ │ ├── ScrollView.tsx │ │ │ ├── Text.tsx │ │ │ ├── TextInput.tsx │ │ │ ├── View.ts │ │ │ ├── activity-indicator.tsx │ │ │ ├── defaultStyle.ts │ │ │ ├── index.tsx │ │ │ └── pressable.tsx │ │ ├── container-query │ │ │ └── index.tsx │ │ ├── css │ │ │ ├── breakpoint-context.ts │ │ │ ├── breakpoints.tsx │ │ │ ├── cache.ts │ │ │ ├── create-themed-component.tsx │ │ │ ├── get-breakpoint-index.ts │ │ │ ├── get.test.ts │ │ │ ├── get.ts │ │ │ ├── index.tsx │ │ │ ├── map-props.ts │ │ │ ├── scales.ts │ │ │ ├── ssr-component.tsx │ │ │ ├── styled.tsx │ │ │ └── use-responsive-value.ts │ │ ├── index.ts │ │ ├── provider │ │ │ ├── context.ts │ │ │ ├── fresnel.tsx │ │ │ └── index.tsx │ │ ├── types-v2 │ │ │ ├── declarations.ts │ │ │ ├── sx-helpers.ts │ │ │ ├── sx.ts │ │ │ └── type-helpers.ts │ │ ├── use-dripsy-theme.ts │ │ ├── use-sx.ts │ │ └── utils │ │ │ ├── deprecated-ssr.ts │ │ │ ├── rem-to-pts.ts │ │ │ └── use-stable-memo.ts │ ├── gradient │ │ └── index.tsx │ └── index.ts │ └── tsconfig.json ├── tsconfig.json └── yarn.lock /.circleci/config.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | 3 | defaults: &defaults 4 | docker: 5 | - image: circleci/node:10 6 | working_directory: ~/project 7 | 8 | jobs: 9 | install-dependencies: 10 | <<: *defaults 11 | steps: 12 | - checkout 13 | - attach_workspace: 14 | at: ~/project 15 | - restore_cache: 16 | keys: 17 | - dependencies-{{ checksum "package.json" }} 18 | - dependencies- 19 | - restore_cache: 20 | keys: 21 | - dependencies-example-{{ checksum "example/package.json" }} 22 | - dependencies-example- 23 | - run: | 24 | yarn install --cwd example --frozen-lockfile 25 | yarn install --frozen-lockfile 26 | - save_cache: 27 | key: dependencies-{{ checksum "package.json" }} 28 | paths: node_modules 29 | - save_cache: 30 | key: dependencies-example-{{ checksum "example/package.json" }} 31 | paths: example/node_modules 32 | - persist_to_workspace: 33 | root: . 34 | paths: . 35 | lint: 36 | <<: *defaults 37 | steps: 38 | - attach_workspace: 39 | at: ~/project 40 | - run: | 41 | yarn lint 42 | typescript: 43 | <<: *defaults 44 | steps: 45 | - attach_workspace: 46 | at: ~/project 47 | - run: yarn typescript 48 | unit-tests: 49 | <<: *defaults 50 | steps: 51 | - attach_workspace: 52 | at: ~/project 53 | - run: yarn test --coverage 54 | - store_artifacts: 55 | path: coverage 56 | destination: coverage 57 | build-package: 58 | <<: *defaults 59 | steps: 60 | - attach_workspace: 61 | at: ~/project 62 | - run: yarn prepare 63 | 64 | 65 | workflows: 66 | version: 2 67 | build-and-test: 68 | jobs: 69 | - install-dependencies 70 | - lint: 71 | requires: 72 | - install-dependencies 73 | - typescript: 74 | requires: 75 | - install-dependencies 76 | - unit-tests: 77 | requires: 78 | - install-dependencies 79 | - build-package: 80 | requires: 81 | - install-dependencies 82 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig helps developers define and maintain consistent 2 | # coding styles between different editors and IDEs 3 | # editorconfig.org 4 | 5 | root = true 6 | 7 | [*] 8 | 9 | indent_style = space 10 | indent_size = 2 11 | 12 | end_of_line = lf 13 | charset = utf-8 14 | trim_trailing_whitespace = true 15 | insert_final_newline = true 16 | -------------------------------------------------------------------------------- /.eslintrc: -------------------------------------------------------------------------------- 1 | // generated by @nandorojo/lint-expo 2 | { 3 | "extends": ["nando"], 4 | "rules": { 5 | "react/react-in-jsx-scope": "off" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | *.pbxproj -text 2 | # specific for windows script files 3 | *.bat text eol=crlf -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # OSX 2 | # 3 | .DS_Store 4 | 5 | # XDE 6 | .expo/ 7 | 8 | # VSCode 9 | .vscode/ 10 | jsconfig.json 11 | 12 | # Xcode 13 | # 14 | build/ 15 | *.pbxuser 16 | !default.pbxuser 17 | *.mode1v3 18 | !default.mode1v3 19 | *.mode2v3 20 | !default.mode2v3 21 | *.perspectivev3 22 | !default.perspectivev3 23 | xcuserdata 24 | *.xccheckout 25 | *.moved-aside 26 | DerivedData 27 | *.hmap 28 | *.ipa 29 | *.xcuserstate 30 | project.xcworkspace 31 | 32 | # Android/IJ 33 | # 34 | .idea 35 | .gradle 36 | local.properties 37 | android.iml 38 | 39 | # Cocoapods 40 | # 41 | example/ios/Pods 42 | 43 | # node.js 44 | # 45 | node_modules/ 46 | npm-debug.log 47 | yarn-debug.log 48 | yarn-error.log 49 | 50 | # BUCK 51 | buck-out/ 52 | \.buckd/ 53 | android/app/libs 54 | android/keystores/debug.keystore 55 | 56 | # Expo 57 | .expo/* 58 | 59 | # generated by bob 60 | lib/ 61 | 62 | **/*/.next 63 | 64 | lerna-debug.log 65 | -------------------------------------------------------------------------------- /.prettierrc.js: -------------------------------------------------------------------------------- 1 | // generated by @nandorojo/lint-expo 2 | module.exports = require('eslint-config-nando/prettier') 3 | -------------------------------------------------------------------------------- /.yarn/install-state.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nandorojo/dripsy/a23535ff8bae87f2c36cb047436f82391023321e/.yarn/install-state.gz -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | Please keep in mind that I copy-pasted this contributing guide as a starting point... 4 | 5 | We want this community to be friendly and respectful to each other. Please follow it in all your interactions with the project. 6 | 7 | ## Development workflow 8 | 9 | To get started with the project, run `yarn` in the root directory to install the required dependencies for each package: 10 | 11 | While developing, you can run the [example app](/examples/example) to test your changes. 12 | 13 | To start the packager: 14 | 15 | ```sh 16 | yarn 17 | expo start --ios 18 | ``` 19 | 20 | Make sure your code passes TypeScript and ESLint. Run the following to verify: 21 | 22 | ```sh 23 | yarn prepare 24 | yarn lint 25 | ``` 26 | 27 | To fix formatting errors, run the following: 28 | 29 | ```sh 30 | yarn lint --fix 31 | ``` 32 | 33 | ### Commit message convention 34 | 35 | We follow the [conventional commits specification](https://www.conventionalcommits.org/en) for our commit messages: 36 | 37 | - `fix`: bug fixes, e.g. fix crash due to deprecated method. 38 | - `feat`: new features, e.g. add new method to the module. 39 | - `refactor`: code refactor, e.g. migrate from class components to hooks. 40 | - `docs`: changes into documentation, e.g. add usage example for the module.. 41 | - `test`: adding or updating tests, eg add integration tests using detox. 42 | - `chore`: tooling changes, e.g. change CI config. 43 | 44 | Our pre-commit hooks verify that your commit message matches this format when committing. 45 | 46 | ### Linting and tests 47 | 48 | [ESLint](https://eslint.org/), [Prettier](https://prettier.io/), [TypeScript](https://www.typescriptlang.org/) 49 | 50 | We use [TypeScript](https://www.typescriptlang.org/) for type checking, [ESLint](https://eslint.org/) with [Prettier](https://prettier.io/) for linting and formatting the code, and [Jest](https://jestjs.io/) for testing. 51 | 52 | Our pre-commit hooks verify that the linter and tests pass when committing. 53 | 54 | ### Scripts 55 | 56 | The `package.json` file contains various scripts for common tasks: 57 | 58 | ### Sending a pull request 59 | 60 | > **Working on your first pull request?** You can learn how from this _free_ series: [How to Contribute to an Open Source Project on GitHub](https://egghead.io/series/how-to-contribute-to-an-open-source-project-on-github). 61 | 62 | When you're sending a pull request: 63 | 64 | - Prefer small pull requests focused on one change. 65 | - Verify that linters and tests are passing. 66 | - Review the documentation to make sure it looks good. 67 | - Follow the pull request template when opening a pull request. 68 | - For pull requests that change the API or implementation, discuss with maintainers first by opening an issue. 69 | 70 | ## Code of Conduct 71 | 72 | ### Our Pledge 73 | 74 | We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation. 75 | 76 | We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community. 77 | 78 | ### Our Standards 79 | 80 | Examples of behavior that contributes to a positive environment for our community include: 81 | 82 | - Demonstrating empathy and kindness toward other people 83 | - Being respectful of differing opinions, viewpoints, and experiences 84 | - Giving and gracefully accepting constructive feedback 85 | - Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience 86 | - Focusing on what is best not just for us as individuals, but for the overall community 87 | 88 | Examples of unacceptable behavior include: 89 | 90 | - The use of sexualized language or imagery, and sexual attention or 91 | advances of any kind 92 | - Trolling, insulting or derogatory comments, and personal or political attacks 93 | - Public or private harassment 94 | - Publishing others' private information, such as a physical or email 95 | address, without their explicit permission 96 | - Other conduct which could reasonably be considered inappropriate in a 97 | professional setting 98 | 99 | ### Enforcement Responsibilities 100 | 101 | Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful. 102 | 103 | Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate. 104 | 105 | ### Scope 106 | 107 | This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. 108 | 109 | ### Enforcement 110 | 111 | Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at [INSERT CONTACT METHOD]. All complaints will be reviewed and investigated promptly and fairly. 112 | 113 | All community leaders are obligated to respect the privacy and security of the reporter of any incident. 114 | 115 | ### Enforcement Guidelines 116 | 117 | Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct: 118 | 119 | #### 1. Correction 120 | 121 | **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community. 122 | 123 | **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested. 124 | 125 | #### 2. Warning 126 | 127 | **Community Impact**: A violation through a single incident or series of actions. 128 | 129 | **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban. 130 | 131 | #### 3. Temporary Ban 132 | 133 | **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior. 134 | 135 | **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban. 136 | 137 | #### 4. Permanent Ban 138 | 139 | **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals. 140 | 141 | **Consequence**: A permanent ban from any sort of public interaction within the community. 142 | 143 | ### Attribution 144 | 145 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0, 146 | available at . 147 | 148 | Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity). 149 | 150 | [homepage]: https://www.contributor-covenant.org 151 | 152 | For answers to common questions about this code of conduct, see the FAQ at 153 | . Translations are available at . 154 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 Fernando Rojo 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![og](https://user-images.githubusercontent.com/13172299/138797238-d45b7f8c-16e9-4fed-bed1-8766b7e3a7ca.png) 2 | 3 | Unstyled, responsive UI primitives for React Native + Web. 4 | 5 | ```jsx 6 | 7 | ``` 8 | 9 | ## Documentation & Installation 10 | 11 | - [Documentation](https://dripsy.xyz) 12 | - [Installation](https://dripsy.xyz/get-started/installation) 13 | 14 | ## Highlights 15 | 16 | https://user-images.githubusercontent.com/13172299/136265481-4c93d5bb-15e7-4e5f-9464-64748ebf1214.mp4 17 | 18 | - Custom fonts, edited globally 19 | - Full TypeScript support 20 | - Responsive styles 21 | - Universal (Android, iOS, Web, & more) 22 | - Works with Expo 23 | - Works with Vanilla React Native 24 | - Works with Next.js 25 | - Full theme support 26 | - Custom theme variants 27 | - Insanely simple API (themed, responsive designs in one line!) 28 | - Works with Animated/Reanimated/Moti 29 | - Dark mode / custom color modes 30 | - Memoized styles, even when written inline 31 | - Atomic CSS classes, with `StyleSheet.create` under the hood 32 | - Use with `@expo/vector-icons` ([example](https://github.com/nandorojo/dripsy/issues/112)) 33 | - Linear Gradient 34 | - Performant: `sx` prop is memoized under the hood (even if you write it in render) 35 | 36 | ## Next.js Conf 37 | 38 | Fernando Rojo at Next.js Conf 42 | 43 | I spoke at at [Next.js Conf 2021](https://fernandorojo.co/conf) on October 26 about React Native + Next.js. [Watch the video](https://www.youtube.com/watch?v=0lnbdRweJtA) to see how we do it. 44 | 45 | ## License 46 | 47 | MIT 48 | -------------------------------------------------------------------------------- /babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = function (api) { 2 | api.cache(true) 3 | 4 | // only used for jest, right? 5 | return { 6 | presets: [ 7 | ['@babel/preset-env', { targets: { node: 'current' } }], 8 | '@babel/preset-typescript', 9 | ], 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /commitlint.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | extends: ['@commitlint/config-conventional'], 3 | } 4 | -------------------------------------------------------------------------------- /docs/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .next 3 | .DS_Store 4 | yarn-error.log 5 | dist 6 | examples 7 | packages -------------------------------------------------------------------------------- /docs/.prettierignore: -------------------------------------------------------------------------------- 1 | .next 2 | node_modules 3 | -------------------------------------------------------------------------------- /docs/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Shu Ding 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /docs/next.config.js: -------------------------------------------------------------------------------- 1 | const withNextra = require('nextra')({ 2 | theme: 'nextra-theme-docs', 3 | themeConfig: './theme.config.js', 4 | unstable_staticImage: true, 5 | }) 6 | module.exports = withNextra() 7 | -------------------------------------------------------------------------------- /docs/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "nextra", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "dev": "next", 8 | "start": "next start", 9 | "build": "next build" 10 | }, 11 | "author": "Shu Ding", 12 | "license": "MIT", 13 | "dependencies": { 14 | "@splitbee/web": "^0.3.0", 15 | "next": "^11.0.1", 16 | "nextra": "^1.1.0", 17 | "nextra-theme-docs": "^1.2.2", 18 | "prism-react-renderer": "^1.2.1", 19 | "prismjs": "^1.25.0", 20 | "react": "^17.0.1", 21 | "react-dom": "^17.0.1" 22 | }, 23 | "devDependencies": { 24 | "@types/react": "^18.0.20", 25 | "prettier": "^2.0.5", 26 | "typescript": "5.0.2" 27 | }, 28 | "prettier": { 29 | "semi": false, 30 | "singleQuote": true 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /docs/pages/_app.js: -------------------------------------------------------------------------------- 1 | import 'nextra-theme-docs/style.css' 2 | 3 | import Prism from 'prism-react-renderer/prism' 4 | ;(typeof global !== 'undefined' ? global : window).Prism = Prism 5 | require('prismjs/components/prism-bash.min') 6 | require('prismjs/components/prism-diff.min') 7 | import splitbee from '@splitbee/web' 8 | 9 | splitbee.init({ 10 | token: '77UUK3L5TK3F', 11 | }) 12 | 13 | export default function Nextra({ Component, pageProps }) { 14 | return 15 | } 16 | -------------------------------------------------------------------------------- /docs/pages/apis/gradient.mdx: -------------------------------------------------------------------------------- 1 | # `` 2 | 3 | Drisy provides a convenient linear gradient component. As of v4, it comes bundled in the `dripsy` package. 4 | 5 | ## Props 6 | 7 | ### `colors` 8 | 9 | You can use colors from your `theme.colors` directly in the `colors` array. 10 | 11 | ```tsx 12 | import { Gradient } from 'dripsy/gradient' 13 | 14 | export function DripsyGradient() { 15 | return 16 | } 17 | ``` 18 | 19 | ### `gradient` 20 | 21 | Alternatively, you can define gradient presets in your `theme.linearGradients`: 22 | 23 |
24 | 25 | Screen Shot 2021-09-27 at 6 47 19 PM 30 | 31 | And then reference them via the `gradient` prop: 32 | 33 |
34 | 35 | Screen Shot 2021-09-27 at 6 47 11 PM 40 | 41 | ### `stretch` 42 | 43 | Often, your gradient is stretching its background as an absolute fill. To enable this, use the `stretch` boolean. 44 | 45 | ```tsx 46 | import { Gradient } from 'dripsy/gradient' 47 | 48 | export function DripsyGradient() { 49 | return 50 | } 51 | ``` 52 | 53 | ## Installation 54 | 55 | You'll need to install `expo-linear-gradient` as a peer dependency: 56 | 57 | ```sh 58 | expo install expo-linear-gradient 59 | ``` 60 | 61 | See [`expo-linear-gradient`](https://docs.expo.dev/versions/latest/sdk/linear-gradient/)'s docs for the remaining prop options. 62 | -------------------------------------------------------------------------------- /docs/pages/apis/makeTheme.mdx: -------------------------------------------------------------------------------- 1 | # `makeTheme` 2 | 3 | ```jsx 4 | import { makeTheme } from 'dripsy' 5 | ``` 6 | 7 | This function lets you provide intellisense for your theme. It exists solely for providing TypeScript support, and does no magic under the hood. 8 | 9 | ## Usage 10 | 11 | ```jsx 12 | import { makeTheme } from 'dripsy' 13 | 14 | const theme = makeTheme({ 15 | colors: { primary: 'blue' }, 16 | }) 17 | 18 | type MyTheme = typeof theme 19 | 20 | declare module 'dripsy' { 21 | // eslint-disable-next-line @typescript-eslint/no-empty-interface 22 | interface DripsyCustomTheme extends MyTheme {} 23 | } 24 | ``` 25 | 26 | Now, your theme will have full intellisense. 27 | 28 | For example, if you import the `Theme` type from Dripsy, it will match your theme. 29 | 30 | ```jsx 31 | import type { Theme } from 'dripsy' 32 | 33 | type ButtonProps = { 34 | color: keyof Theme // this will use your actual theme! 35 | } 36 | ``` 37 | -------------------------------------------------------------------------------- /docs/pages/apis/meta.json: -------------------------------------------------------------------------------- 1 | { 2 | "styled": "styled()", 3 | "useDripsyTheme": "useDripsyTheme()", 4 | "makeTheme": "makeTheme()", 5 | "useSx": "useSx()", 6 | "gradient": "" 7 | } 8 | -------------------------------------------------------------------------------- /docs/pages/apis/styled.mdx: -------------------------------------------------------------------------------- 1 | # `styled()` 2 | 3 | Turn any React Native component into a Dripsy component. 4 | 5 | ## Import 6 | 7 | ```jsx 8 | import { styled } from 'dripsy' 9 | ``` 10 | 11 | ## Style 12 | 13 | ```jsx 14 | import { View } from 'react-native' 15 | 16 | const StyledView = styled(View)({ 17 | flex: 1, 18 | bg: '$primary', 19 | }) 20 | ``` 21 | 22 | ## Composition 23 | 24 | You can also recursively use `styled` on Dripsy components: 25 | 26 | ```jsx 27 | import { View } from 'react-native' 28 | 29 | const StyledView = styled(View)({ 30 | flex: 1, 31 | bg: '$primary', 32 | }) 33 | 34 | const ExtraStyledView = styled(StyledView)({ 35 | bg: '$secondary', 36 | }) 37 | ``` 38 | 39 | ## Advanced Usage 40 | 41 | ```jsx 42 | import { styled } from 'dripsy' 43 | import { View } from 'react-native' 44 | 45 | const StyledView = styled(View)({ 46 | flex: 1, 47 | bg: '$primary', 48 | }) 49 | 50 | // This uses the theme.layout.container styles! 51 | const StyledView2 = styled(View, { 52 | // this lets you use theme.layout.container styles 53 | themeKey: 'layout', 54 | defaultVariant: 'container', 55 | })({ 56 | flex: 1, 57 | bg: '$primary', 58 | }) 59 | ``` 60 | 61 | ## Factory Function 62 | 63 | You can also pass props like `styled-components` 64 | 65 | ```tsx 66 | const DripsyView = styled(View)((props) => ({ 67 | color: props.success ? 'success' : '$primary', 68 | })) 69 | ``` 70 | 71 | And then use it in your component: 72 | 73 | ```tsx 74 | return 75 | ``` 76 | 77 | Override the original styles with `sx`, if you'd like: 78 | 79 | ```tsx 80 | return 81 | ``` 82 | 83 | ## TypeScript 84 | 85 | You can also add TypeScript types with autocompletion: 86 | 87 | ```tsx 88 | const DripsyView = styled(View)((props: { success: boolean }) => ({ 89 | color: props.success ? 'success' : '$primary', 90 | })) 91 | ``` 92 | -------------------------------------------------------------------------------- /docs/pages/apis/useDripsyTheme.mdx: -------------------------------------------------------------------------------- 1 | # `useDripsyTheme()` 2 | 3 | Access your theme, anwhere in your app. 4 | 5 | ```ts 6 | import { useDripsyTheme } from 'dripsy' 7 | 8 | const { theme } = useDripsyTheme() 9 | ``` 10 | 11 | --- 12 | 13 |