├── .auto-changelog ├── .editorconfig ├── .eslintignore ├── .eslintrc.js ├── .gitattributes ├── .github └── FUNDING.yml ├── .gitignore ├── .prettierignore ├── .prettierrc.json ├── .release-it.json ├── CHANGELOG.md ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── babel.config.js ├── commitlint.config.js ├── example ├── .gitignore ├── App.tsx ├── app.json ├── assets │ ├── adaptive-icon.png │ ├── favicon.png │ ├── icon.png │ └── splash.png ├── babel.config.js ├── metro.config.js ├── package.json ├── src │ ├── DemoScreen.tsx │ └── ShowcaseScreen.tsx ├── tsconfig.json ├── webpack.config.js └── yarn.lock ├── lint-staged.config.js ├── mogorhom-dark.png ├── mogorhom-light.png ├── package.json ├── preview.png ├── scripts └── auto-changelog.js ├── src ├── components │ ├── showcaseApp │ │ ├── ShowcaseApp.tsx │ │ ├── index.ts │ │ ├── styles.ts │ │ └── types.d.ts │ ├── showcaseButton │ │ ├── ShowcaseButton.tsx │ │ ├── index.ts │ │ ├── styles.ts │ │ └── types.d.ts │ ├── showcaseFooter │ │ ├── ShowcaseFooter.tsx │ │ ├── index.ts │ │ ├── styles.ts │ │ └── types.d.ts │ ├── showcaseHeader │ │ ├── ShowcaseHeader.tsx │ │ ├── index.ts │ │ ├── styles.ts │ │ └── types.d.ts │ ├── showcaseLabel │ │ ├── ShowcaseLabel.tsx │ │ ├── index.ts │ │ ├── styles.ts │ │ └── types.d.ts │ ├── showcaseTile │ │ ├── Tile.tsx │ │ ├── index.ts │ │ ├── styles.ts │ │ └── types.d.ts │ ├── showcaseTileGroup │ │ ├── AccordionIndicator.tsx │ │ ├── TileGroup.tsx │ │ ├── index.ts │ │ ├── styles.ts │ │ └── types.d.ts │ └── showcaseTileList │ │ ├── ShowcaseTileList.tsx │ │ ├── index.ts │ │ ├── styles.ts │ │ └── types.d.ts ├── contexts │ ├── index.ts │ └── tileDimensionsContext.ts ├── hooks │ ├── index.ts │ ├── useShowcaseTheme.ts │ └── useTileDimensions.ts ├── index.ts ├── providers │ ├── TileDimensionsProvider.tsx │ └── index.ts ├── theme │ ├── dark.ts │ ├── index.ts │ └── light.ts └── types.d.ts ├── templates ├── changelog-template.hbs └── release-template.hbs ├── tsconfig.json └── yarn.lock /.auto-changelog: -------------------------------------------------------------------------------- 1 | { 2 | "handlebarsSetup": "./scripts/auto-changelog.js", 3 | "ignoreCommitPattern": "^chore: release v", 4 | "tagPattern": "^v([0-9])+\\.\\d+\\.\\d+$", 5 | "unreleased": false, 6 | "commitLimit": false 7 | } -------------------------------------------------------------------------------- /.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 | -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | 3 | # generated by bob 4 | lib/ 5 | -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | extends: ['@react-native', 'prettier'], 4 | rules: { 5 | 'no-console': ['error', { allow: ['warn', 'error'] }], 6 | 'prettier/prettier': 'error', 7 | }, 8 | }; 9 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | *.pbxproj -text 2 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: gorhom 4 | -------------------------------------------------------------------------------- /.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 | # generated by bob 57 | lib/ 58 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | .github 2 | -------------------------------------------------------------------------------- /.prettierrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "printWidth": 80, 3 | "arrowParens": "avoid", 4 | "singleQuote": true, 5 | "tabWidth": 2, 6 | "trailingComma": "es5", 7 | "useTabs": false 8 | } 9 | -------------------------------------------------------------------------------- /.release-it.json: -------------------------------------------------------------------------------- 1 | { 2 | "git": { 3 | "push": true, 4 | "tagName": "v${version}", 5 | "commitMessage": "chore: release v${version}", 6 | "changelog": "auto-changelog --stdout --unreleased --template ./templates/changelog-template.hbs" 7 | }, 8 | "github": { 9 | "release": true, 10 | "releaseNotes": "auto-changelog --stdout --unreleased --template ./templates/release-template.hbs" 11 | }, 12 | "npm": { 13 | "publish": false 14 | }, 15 | "plugins": { 16 | "@release-it/conventional-changelog": { 17 | "preset": "angular" 18 | } 19 | }, 20 | "hooks": { 21 | "after:bump": "auto-changelog -p --template ./templates/changelog-template.hbs" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | ## [v4.0.1](https://github.com/gorhom/showcase-template/compare/v4.0.0...v4.0.1) 4 | 5 | #### Fixes 6 | 7 | - fix: touchables on Android with Fabric arch ([83fbc1a](https://github.com/gorhom/showcase-template/commit/83fbc1ac46cc6042331ae81045bba450bbea43da)). 8 | 9 | ## [v4.0.0](https://github.com/gorhom/showcase-template/compare/v3.0.2...v4.0.0) - 2025-05-18 10 | 11 | #### Features 12 | 13 | - feat: updated animation and added support for featured tile ([5d1d0ab](https://github.com/gorhom/showcase-template/commit/5d1d0ab5be5126e820bf017d24972e9a5db0d132)). 14 | 15 | #### Improvements 16 | 17 | - chore: updated dependencies ([216d343](https://github.com/gorhom/showcase-template/commit/216d343c8f93ed31087c9b01166780b956fb6ab0)). 18 | 19 | ## [v3.0.2](https://github.com/gorhom/showcase-template/compare/v3.0.0...v3.0.2) - 2023-09-15 20 | 21 | ## [v3.0.0](https://github.com/gorhom/showcase-template/compare/v2.1.2...v3.0.0) - 2023-09-15 22 | 23 | #### Features 24 | 25 | - feat: added collapsible functionality ([e166abc](https://github.com/gorhom/showcase-template/commit/e166abcc94a6b9c5c8bf68eeedb7c67b3c89c7e5)). 26 | 27 | #### Improvements 28 | 29 | - chore: updated linter and package.json ([4e7e467](https://github.com/gorhom/showcase-template/commit/4e7e46789b691e247fcdc6c7ba08ec58d5c493f5)). 30 | 31 | #### Documentations 32 | 33 | - docs: updated readme file ([80821fc](https://github.com/gorhom/showcase-template/commit/80821fcb5b7be9dd8c1166b6eab7842e53b4445a)). 34 | 35 | ## [v2.1.2](https://github.com/gorhom/showcase-template/compare/v2.1.1...v2.1.2) - 2023-09-15 36 | 37 | #### Fixes 38 | 39 | - fix: bob builder config ([6fbcc18](https://github.com/gorhom/showcase-template/commit/6fbcc18de358f29690cd210eaf6eedc6eaf2ea3a)). 40 | 41 | ## [v2.1.1](https://github.com/gorhom/showcase-template/compare/v2.1.0...v2.1.1) - 2023-09-15 42 | 43 | #### Improvements 44 | 45 | - chore: updated dependencies ([a7f0a4e](https://github.com/gorhom/showcase-template/commit/a7f0a4e120f2f4cb3404c0deadb3f1c2572ffd3d)). 46 | 47 | #### Documentations 48 | 49 | - docs: updated readme file ([3cefbcc](https://github.com/gorhom/showcase-template/commit/3cefbcca27349665aa47bd5bd38cbd56aa6c548a)). 50 | 51 | ## [v2.1.0](https://github.com/gorhom/showcase-template/compare/v2.0.4...v2.1.0) - 2021-11-27 52 | 53 | #### Features 54 | 55 | - feat: added layout responsiveness support ([0a227ba](https://github.com/gorhom/showcase-template/commit/0a227ba2867d364abcf3a78ef989b0c4a3bed712)). 56 | 57 | #### Improvements 58 | 59 | - chore: updated the example to use Expo ([671c52b](https://github.com/gorhom/showcase-template/commit/671c52bcabb612c006c3f29249a2b2db6f21310d)). 60 | - refactor: renamed components ([2c05045](https://github.com/gorhom/showcase-template/commit/2c050455b3d6df348866547f017dd96b7febf273)). 61 | 62 | ## [v2.0.4](https://github.com/gorhom/showcase-template/compare/v2.0.3...v2.0.4) - 2021-03-25 63 | 64 | #### Improvements 65 | 66 | - chore: added initialScreen prop ([67cf122](https://github.com/gorhom/showcase-template/commit/67cf12224adefd46b2cbaf43033a18c25f7c3d6a)). 67 | 68 | ## [v2.0.3](https://github.com/gorhom/showcase-template/compare/v2.0.2...v2.0.3) - 2021-03-21 69 | 70 | #### Improvements 71 | 72 | - chore: updated label props ([2a0e3a3](https://github.com/gorhom/showcase-template/commit/2a0e3a3603ad03cbeaea54ed20e72f1a71ccb5c9)). 73 | 74 | ## [v2.0.2](https://github.com/gorhom/showcase-template/compare/v2.0.1...v2.0.2) - 2021-03-21 75 | 76 | #### Improvements 77 | 78 | - chore: export ShowcaseScreenType type ([3722714](https://github.com/gorhom/showcase-template/commit/3722714c623786eaf700c51926e4fa449c21adff)). 79 | - chore: updated label props ([db98dbc](https://github.com/gorhom/showcase-template/commit/db98dbc032fbe09a92d4e99a5bae122ff5d35d8c)). 80 | 81 | ## [v2.0.1](https://github.com/gorhom/showcase-template/compare/v2.0.0...v2.0.1) - 2021-03-21 82 | 83 | #### Improvements 84 | 85 | - chore: copy .d.ts to lib ([29b424e](https://github.com/gorhom/showcase-template/commit/29b424e8ea0b9289b6ad836fb4c452d93064f87a)). 86 | 87 | ## [v2.0.0](https://github.com/gorhom/showcase-template/compare/v1.0.2...v2.0.0) - 2021-03-21 88 | 89 | #### Features 90 | 91 | - feat: updated react-native, refactor library ([1db7006](https://github.com/gorhom/showcase-template/commit/1db70060b13fe788bdc9d32a91bef8f62f85ee40)). 92 | 93 | #### Improvements 94 | 95 | - chore: updated dev tools ([9805774](https://github.com/gorhom/showcase-template/commit/980577409bc7e0c7d8d2a850b60a468aadf86922)). 96 | - chore: updated release-it templates ([7c2f5b6](https://github.com/gorhom/showcase-template/commit/7c2f5b6acbc04c19097e7cab479feb1d95c8330e)). 97 | - chore: updated release-it templates ([481d70a](https://github.com/gorhom/showcase-template/commit/481d70af1bb90f6fab045a6ca04cc3bcf263e9c3)). 98 | 99 | ## [v1.0.2](https://github.com/gorhom/showcase-template/compare/v1.0.1...v1.0.2) - 2020-09-28 100 | 101 | #### Improvements 102 | 103 | - chore: updated header & footer padding ([81e196e](https://github.com/gorhom/showcase-template/commit/81e196eac6b18090a618199b48f6399c4fb31b5e)). 104 | 105 | ## [v1.0.1](https://github.com/gorhom/showcase-template/compare/v1.0.0...v1.0.1) - 2020-09-28 106 | 107 | #### Improvements 108 | 109 | - chore: updated header & footer padding ([42703a9](https://github.com/gorhom/showcase-template/commit/42703a96e3414a1c2816826cabbe8b403d0311b6)). 110 | - chore: updated titles styling ([0341621](https://github.com/gorhom/showcase-template/commit/034162135e0a93b4b7cffba1c700c875b75dc7cb)). 111 | 112 | ## [v1.0.0](https://github.com/gorhom/showcase-template/compare/v0.3.1...v1.0.0) - 2020-09-20 113 | 114 | #### Improvements 115 | 116 | - chore: updated styling ([419aa70](https://github.com/gorhom/showcase-template/commit/419aa700e57b3f73c52763bca3b3d5588687d82d)). 117 | 118 | ## [v0.3.1](https://github.com/gorhom/showcase-template/compare/v0.3.0...v0.3.1) - 2020-04-26 119 | 120 | #### Improvements 121 | 122 | - chore: updated group header style ([6124e01](https://github.com/gorhom/showcase-template/commit/6124e01f3a0fdce942d7645f5ea2bb7d3f9ed135)). 123 | 124 | #### Fixes 125 | 126 | - fix: fixed flatlist container size ([e74de82](https://github.com/gorhom/showcase-template/commit/e74de8298cbe416f2d4ffbdaebdb34c4aea0c35f)). 127 | 128 | ## [v0.3.0](https://github.com/gorhom/showcase-template/compare/v0.2.2...v0.3.0) - 2020-04-25 129 | 130 | #### Features 131 | 132 | - feat: added group view support ([`#1`](https://github.com/gorhom/showcase-template/pull/1)). 133 | 134 | ## [v0.2.2](https://github.com/gorhom/showcase-template/compare/v0.2.1...v0.2.2) - 2020-04-04 135 | 136 | #### Improvements 137 | 138 | - chore: updated typescript path ([bb48812](https://github.com/gorhom/showcase-template/commit/bb488123bf9f266a4e88885c2ada32cb4cbfd8bd)). 139 | 140 | ## [v0.2.1](https://github.com/gorhom/showcase-template/compare/v0.2.0...v0.2.1) - 2020-04-03 141 | 142 | #### Improvements 143 | 144 | - chore: exclude example filder types from distribution ([b35621a](https://github.com/gorhom/showcase-template/commit/b35621ad6b93fc774ccb5bb089478defb09a8ed2)). 145 | - chore: updated `theme` prop to become optional ([d352ee5](https://github.com/gorhom/showcase-template/commit/d352ee558effcf68803162594d1e4feb97ab4d4f)). 146 | 147 | #### Fixes 148 | 149 | - fix: fixed styling for tile labels ([0a66c48](https://github.com/gorhom/showcase-template/commit/0a66c48631ee1d465b50460af3bc3bdbce25d1cd)). 150 | 151 | #### Documentations 152 | 153 | - docs: updated description ([e27f9a7](https://github.com/gorhom/showcase-template/commit/e27f9a755913d967b8ff13fd475063c7bc687302)). 154 | 155 | ## v0.2.0 - 2020-04-03 156 | 157 | #### Features 158 | 159 | - feat: initial features ([9a01276](https://github.com/gorhom/showcase-template/commit/9a01276c293f548d4cc3fb201b122a5da419548b)). 160 | 161 | #### Improvements 162 | 163 | - chore: prepare for release ([12bdc36](https://github.com/gorhom/showcase-template/commit/12bdc36d2b99dabef6110d9e5ea55bc9be99a5cb)). 164 | - chore: add changelog file ([3a32962](https://github.com/gorhom/showcase-template/commit/3a3296234d15de0e659ef48a9472ef9306d7f49c)). 165 | 166 | #### Documentations 167 | 168 | - docs: update readme description ([bf964a5](https://github.com/gorhom/showcase-template/commit/bf964a564110eeddc40254883cec5d81373fc04b)). 169 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | We want this community to be friendly and respectful to each other. Please follow it in all your interactions with the project. 4 | 5 | ## Development workflow 6 | 7 | To get started with the project, run `yarn bootstrap` in the root directory to install the required dependencies for each package: 8 | 9 | ```sh 10 | yarn bootstrap 11 | ``` 12 | 13 | While developing, you can run the [example app](/example/) to test your changes. 14 | 15 | To start the packager: 16 | 17 | ```sh 18 | yarn example start 19 | ``` 20 | 21 | To run the example app on Android: 22 | 23 | ```sh 24 | yarn example android 25 | ``` 26 | 27 | To run the example app on iOS: 28 | 29 | ```sh 30 | yarn example android 31 | ``` 32 | 33 | Make sure your code passes TypeScript and ESLint. Run the following to verify: 34 | 35 | ```sh 36 | yarn typescript 37 | yarn lint 38 | ``` 39 | 40 | To fix formatting errors, run the following: 41 | 42 | ```sh 43 | yarn lint --fix 44 | ``` 45 | 46 | ### Commit message convention 47 | 48 | We follow the [conventional commits specification](https://www.conventionalcommits.org/en) for our commit messages: 49 | 50 | - `fix`: bug fixes, e.g. fix crash due to deprecated method. 51 | - `feat`: new features, e.g. add new method to the module. 52 | - `refactor`: code refactor, e.g. migrate from class components to hooks. 53 | - `docs`: changes into documentation, e.g. add usage example for the module.. 54 | - `chore`: tooling changes, e.g. change CI config. 55 | 56 | Our pre-commit hooks verify that your commit message matches this format when committing. 57 | 58 | ### Linting 59 | 60 | [ESLint](https://eslint.org/), [Prettier](https://prettier.io/), [TypeScript](https://www.typescriptlang.org/) 61 | 62 | We use [TypeScript](https://www.typescriptlang.org/) for type checking and [ESLint](https://eslint.org/) with [Prettier](https://prettier.io/) for linting and formatting the code. 63 | 64 | Our pre-commit hooks verify that the linter and tests pass when committing. 65 | 66 | ### Scripts 67 | 68 | The `package.json` file contains various scripts for common tasks: 69 | 70 | - `yarn bootstrap`: setup project by installing all dependencies and pods. 71 | - `yarn typescript`: type-check files with TypeScript. 72 | - `yarn lint`: lint files with ESLint. 73 | - `yarn example start`: start the Metro server for the example app. 74 | - `yarn example android`: run the example app on Android. 75 | - `yarn example ios`: run the example app on iOS. 76 | 77 | ### Sending a pull request 78 | 79 | > **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). 80 | 81 | When you're sending a pull request: 82 | 83 | - Prefer small pull requests focused on one change. 84 | - Verify that linters and tests are passing. 85 | - Review the documentation to make sure it looks good. 86 | - Follow the pull request template when opening a pull request. 87 | - For pull requests that change the API or implementation, discuss with maintainers first by opening an issue. 88 | 89 | ## Code of Conduct 90 | 91 | ### Our Pledge 92 | 93 | 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. 94 | 95 | We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community. 96 | 97 | ### Our Standards 98 | 99 | Examples of behavior that contributes to a positive environment for our community include: 100 | 101 | - Demonstrating empathy and kindness toward other people 102 | - Being respectful of differing opinions, viewpoints, and experiences 103 | - Giving and gracefully accepting constructive feedback 104 | - Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience 105 | - Focusing on what is best not just for us as individuals, but for the overall community 106 | 107 | Examples of unacceptable behavior include: 108 | 109 | - The use of sexualized language or imagery, and sexual attention or 110 | advances of any kind 111 | - Trolling, insulting or derogatory comments, and personal or political attacks 112 | - Public or private harassment 113 | - Publishing others' private information, such as a physical or email 114 | address, without their explicit permission 115 | - Other conduct which could reasonably be considered inappropriate in a 116 | professional setting 117 | 118 | ### Enforcement Responsibilities 119 | 120 | 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. 121 | 122 | 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. 123 | 124 | ### Scope 125 | 126 | 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. 127 | 128 | ### Enforcement 129 | 130 | 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. 131 | 132 | All community leaders are obligated to respect the privacy and security of the reporter of any incident. 133 | 134 | ### Enforcement Guidelines 135 | 136 | Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct: 137 | 138 | #### 1. Correction 139 | 140 | **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community. 141 | 142 | **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. 143 | 144 | #### 2. Warning 145 | 146 | **Community Impact**: A violation through a single incident or series of actions. 147 | 148 | **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. 149 | 150 | #### 3. Temporary Ban 151 | 152 | **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior. 153 | 154 | **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. 155 | 156 | #### 4. Permanent Ban 157 | 158 | **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. 159 | 160 | **Consequence**: A permanent ban from any sort of public interaction within the community. 161 | 162 | ### Attribution 163 | 164 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0, 165 | available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. 166 | 167 | Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity). 168 | 169 | [homepage]: https://www.contributor-covenant.org 170 | 171 | For answers to common questions about this code of conduct, see the FAQ at 172 | https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations. 173 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Mo Gorhom 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 |
2 |

Showcase Template

3 | 4 | [![npm](https://badgen.net/npm/v/@gorhom/showcase-template)](https://www.npmjs.com/package/@gorhom/showcase-template) [![npm](https://badgen.net/npm/license/@gorhom/showcase-template)](https://www.npmjs.com/package/@gorhom/showcase-template) [![npm](https://badgen.net/npm/types/@gorhom/showcase-template)](https://www.npmjs.com/package/@gorhom/showcase-template) [![runs with expo](https://img.shields.io/badge/Runs%20with%20Expo-4630EB.svg?style=flat-square&logo=EXPO&labelColor=f3f3f3&logoColor=000)](https://expo.io/) 5 | 6 | 7 | 8 | A React Native template that helps developers to showcase their amazing libraries examples. 9 | 10 |
11 | 12 | --- 13 | 14 | ## Installation 15 | 16 | ```sh 17 | yarn add @gorhom/showcase-template 18 | # or 19 | npm install @gorhom/showcase-template 20 | ``` 21 | 22 | ## Usage 23 | 24 | ```jsx 25 | import React from 'react'; 26 | import { Alert } from 'react-native'; 27 | import Showcase from '@gorhom/showcase-template'; 28 | 29 | const DemoScreen = () => ( 30 | 31 | Demo Screen 32 | 33 | ); 34 | 35 | const data = [ 36 | { 37 | title: 'Group 1', 38 | data: [ 39 | { 40 | name: 'Default', 41 | slug: 'default', 42 | getScreen: () => DemoScreen, 43 | }, 44 | { 45 | name: 'Example A', 46 | slug: 'example-a', 47 | getScreen: () => DemoScreen, 48 | }, 49 | { 50 | name: 'Example B', 51 | slug: 'example-b', 52 | getScreen: () => DemoScreen, 53 | }, 54 | ], 55 | }, 56 | { 57 | title: 'Group 2', 58 | data: [ 59 | { 60 | name: 'Example C', 61 | slug: 'example-c', 62 | getScreen: () => DemoScreen, 63 | }, 64 | { 65 | name: 'Example D', 66 | slug: 'example-d', 67 | getScreen: () => DemoScreen, 68 | }, 69 | ], 70 | }, 71 | ]; 72 | 73 | export default function App() { 74 | return ( 75 | 85 | ); 86 | } 87 | ``` 88 | ## Sponsor & Support 89 | 90 | To keep this library maintained and up-to-date please consider [sponsoring it on GitHub](https://github.com/sponsors/gorhom). Or if you are looking for a private support or help in customizing the experience, then reach out to me on Twitter [@gorhom](https://twitter.com/gorhom). 91 | 92 | ## License 93 | 94 | [MIT](./LICENSE) 95 | 96 | --- 97 | 98 |

99 | 100 | Mo Gorhom 101 | 102 | 103 | Mo Gorhom 104 | 105 |

106 | -------------------------------------------------------------------------------- /babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: ['module:metro-react-native-babel-preset'], 3 | }; 4 | -------------------------------------------------------------------------------- /commitlint.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | extends: ['@commitlint/config-conventional'], 3 | }; 4 | -------------------------------------------------------------------------------- /example/.gitignore: -------------------------------------------------------------------------------- 1 | # Learn more https://docs.github.com/en/get-started/getting-started-with-git/ignoring-files 2 | 3 | # dependencies 4 | node_modules/ 5 | 6 | # Expo 7 | .expo/ 8 | dist/ 9 | web-build/ 10 | 11 | # Native 12 | *.orig.* 13 | *.jks 14 | *.p8 15 | *.p12 16 | *.key 17 | *.mobileprovision 18 | 19 | # Metro 20 | .metro-health-check* 21 | 22 | # debug 23 | npm-debug.* 24 | yarn-debug.* 25 | yarn-error.* 26 | 27 | # macOS 28 | .DS_Store 29 | *.pem 30 | 31 | # local env files 32 | .env*.local 33 | 34 | # typescript 35 | *.tsbuildinfo 36 | -------------------------------------------------------------------------------- /example/App.tsx: -------------------------------------------------------------------------------- 1 | import { ShowcaseScreen } from './src/ShowcaseScreen'; 2 | 3 | export default ShowcaseScreen; 4 | -------------------------------------------------------------------------------- /example/app.json: -------------------------------------------------------------------------------- 1 | { 2 | "expo": { 3 | "name": "Showcase Template", 4 | "slug": "showcase-template", 5 | "version": "1.0.0", 6 | "orientation": "portrait", 7 | "icon": "./assets/icon.png", 8 | "userInterfaceStyle": "automatic", 9 | "splash": { 10 | "image": "./assets/splash.png", 11 | "resizeMode": "contain", 12 | "backgroundColor": "#000000" 13 | }, 14 | "assetBundlePatterns": [ 15 | "**/*" 16 | ], 17 | "ios": { 18 | "supportsTablet": true, 19 | "backgroundColor": "#000000" 20 | }, 21 | "android": { 22 | "adaptiveIcon": { 23 | "foregroundImage": "./assets/adaptive-icon.png", 24 | "backgroundColor": "#000000" 25 | }, 26 | "backgroundColor": "#000000" 27 | }, 28 | "web": { 29 | "favicon": "./assets/favicon.png" 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /example/assets/adaptive-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gorhom/showcase-template/e9b60c49ce389600cf466f6a7a0a05aa7840ed20/example/assets/adaptive-icon.png -------------------------------------------------------------------------------- /example/assets/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gorhom/showcase-template/e9b60c49ce389600cf466f6a7a0a05aa7840ed20/example/assets/favicon.png -------------------------------------------------------------------------------- /example/assets/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gorhom/showcase-template/e9b60c49ce389600cf466f6a7a0a05aa7840ed20/example/assets/icon.png -------------------------------------------------------------------------------- /example/assets/splash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gorhom/showcase-template/e9b60c49ce389600cf466f6a7a0a05aa7840ed20/example/assets/splash.png -------------------------------------------------------------------------------- /example/babel.config.js: -------------------------------------------------------------------------------- 1 | const path = require('path'); 2 | const pak = require('../package.json'); 3 | 4 | module.exports = function (api) { 5 | api.cache(true); 6 | return { 7 | presets: ['babel-preset-expo'], 8 | plugins: [ 9 | [ 10 | 'module-resolver', 11 | { 12 | extensions: ['.tsx', '.ts', '.js', '.json'], 13 | alias: { 14 | [pak.name]: path.join(__dirname, '..', pak.source), 15 | }, 16 | }, 17 | ], 18 | '@babel/plugin-proposal-export-namespace-from', 19 | 'react-native-reanimated/plugin', 20 | ], 21 | }; 22 | }; 23 | -------------------------------------------------------------------------------- /example/metro.config.js: -------------------------------------------------------------------------------- 1 | // Learn more https://docs.expo.io/guides/customizing-metro 2 | const { getDefaultConfig } = require('expo/metro-config'); 3 | const path = require('path'); 4 | 5 | // Find the project and workspace directories 6 | const projectRoot = __dirname; 7 | // This can be replaced with `find-yarn-workspace-root` 8 | const workspaceRoot = path.resolve(projectRoot, '..'); 9 | 10 | /** @type {import('expo/metro-config').MetroConfig} */ 11 | const config = getDefaultConfig(__dirname); 12 | 13 | // 1. Watch all files within the monorepo 14 | config.watchFolders = [workspaceRoot]; 15 | // 2. Let Metro know where to resolve packages and in what order 16 | config.resolver.nodeModulesPaths = [path.resolve(projectRoot, 'node_modules')]; 17 | // 3. Force Metro to resolve (sub)dependencies only from the `nodeModulesPaths` 18 | config.resolver.disableHierarchicalLookup = true; 19 | 20 | module.exports = config; 21 | -------------------------------------------------------------------------------- /example/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "showcase-template", 3 | "version": "1.0.0", 4 | "main": "node_modules/expo/AppEntry.js", 5 | "scripts": { 6 | "start": "expo start", 7 | "android": "expo start --android", 8 | "ios": "expo start --ios", 9 | "web": "expo start --web" 10 | }, 11 | "dependencies": { 12 | "@expo/webpack-config": "~19.0.1", 13 | "@react-navigation/native": "^7.1.9", 14 | "@react-navigation/native-stack": "^7.3.13", 15 | "@react-navigation/stack": "^7.3.2", 16 | "expo": "~53.0.9", 17 | "expo-status-bar": "~2.2.3", 18 | "react": "19.0.0", 19 | "react-dom": "19.0.0", 20 | "react-native": "0.79.2", 21 | "react-native-gesture-handler": "~2.24.0", 22 | "react-native-reanimated": "~3.17.4", 23 | "react-native-safe-area-context": "5.4.0", 24 | "react-native-screens": "~4.10.0", 25 | "react-native-web": "^0.20.0" 26 | }, 27 | "devDependencies": { 28 | "@babel/core": "^7.25.2", 29 | "@babel/plugin-proposal-export-namespace-from": "^7.18.9", 30 | "@types/react": "~19.0.10", 31 | "@types/react-native": "^0.73.0", 32 | "babel-plugin-module-resolver": "^5.0.0", 33 | "typescript": "^5.3.3" 34 | }, 35 | "private": true 36 | } 37 | -------------------------------------------------------------------------------- /example/src/DemoScreen.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { StyleSheet, View } from 'react-native'; 3 | import { 4 | ShowcaseExampleScreenProps, 5 | ShowcaseLabel, 6 | } from '@gorhom/showcase-template'; 7 | 8 | export const DemoScreen = (props: ShowcaseExampleScreenProps) => { 9 | return ( 10 | 11 | 12 | {props.route.params.name} 13 | 14 | 15 | ); 16 | }; 17 | 18 | const styles = StyleSheet.create({ 19 | container: { 20 | flex: 1, 21 | justifyContent: 'center', 22 | alignItems: 'center', 23 | }, 24 | text: { 25 | fontSize: 24, 26 | }, 27 | }); 28 | -------------------------------------------------------------------------------- /example/src/ShowcaseScreen.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { 3 | ShowcaseApp, 4 | ShowcaseExampleScreenSectionType, 5 | ShowcaseExampleScreenType, 6 | } from '@gorhom/showcase-template'; 7 | import { DemoScreen } from './DemoScreen'; 8 | 9 | const data: Array = [ 10 | { 11 | name: 'Featured', 12 | slug: 'featured', 13 | title: 'Featured', 14 | getScreen: () => DemoScreen, 15 | }, 16 | { 17 | title: 'Group 1', 18 | collapsible: false, 19 | data: [ 20 | { 21 | name: 'Default', 22 | slug: 'default', 23 | title: 'Group 1 : Default', 24 | getScreen: () => DemoScreen, 25 | }, 26 | { 27 | name: 'Example A', 28 | slug: 'example-a', 29 | getScreen: () => DemoScreen, 30 | }, 31 | { 32 | name: 'Example B', 33 | slug: 'example-b', 34 | getScreen: () => DemoScreen, 35 | }, 36 | ], 37 | }, 38 | { 39 | title: 'Group 2', 40 | data: [ 41 | { 42 | name: 'Example C', 43 | slug: 'example-c', 44 | getScreen: () => DemoScreen, 45 | }, 46 | { 47 | name: 'Example D', 48 | slug: 'example-d', 49 | getScreen: () => DemoScreen, 50 | }, 51 | ], 52 | }, 53 | { 54 | title: 'Group 3', 55 | collapsed: true, 56 | data: [ 57 | { 58 | name: 'Example E', 59 | slug: 'example-e', 60 | getScreen: () => DemoScreen, 61 | }, 62 | { 63 | name: 'Example F', 64 | slug: 'example-f', 65 | getScreen: () => DemoScreen, 66 | }, 67 | { 68 | name: 'Example G', 69 | slug: 'example-g', 70 | getScreen: () => DemoScreen, 71 | }, 72 | { 73 | name: 'Example H Example H', 74 | slug: 'example-h', 75 | getScreen: () => DemoScreen, 76 | }, 77 | { 78 | name: 'Example I', 79 | slug: 'example-i', 80 | getScreen: () => DemoScreen, 81 | }, 82 | ], 83 | }, 84 | ]; 85 | 86 | export const ShowcaseScreen = () => { 87 | return ( 88 | 98 | ); 99 | }; 100 | -------------------------------------------------------------------------------- /example/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "expo/tsconfig.base", 3 | "compilerOptions": { 4 | "strict": true, 5 | "paths": { 6 | "@gorhom/showcase-template": ["../src/index"] 7 | }, 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /example/webpack.config.js: -------------------------------------------------------------------------------- 1 | const createExpoWebpackConfigAsync = require('@expo/webpack-config'); 2 | const path = require('path'); 3 | const { resolver } = require('./metro.config'); 4 | 5 | const root = path.resolve(__dirname, '..'); 6 | const node_modules = path.join(__dirname, 'node_modules'); 7 | 8 | module.exports = async function (env, argv) { 9 | const config = await createExpoWebpackConfigAsync(env, argv); 10 | 11 | config.module.rules.push({ 12 | test: /\.(js|jsx|ts|tsx)$/, 13 | include: path.resolve(root, 'src'), 14 | use: 'babel-loader', 15 | }); 16 | 17 | // We need to make sure that only one version is loaded for peerDependencies 18 | // So we alias them to the versions in example's node_modules 19 | Object.assign(config.resolve.alias, { 20 | react: path.join(node_modules, 'react'), 21 | 'react-native': path.join(node_modules, 'react-native'), 22 | 'react-native-web': path.join(node_modules, 'react-native-web'), 23 | }); 24 | 25 | return config; 26 | }; 27 | -------------------------------------------------------------------------------- /lint-staged.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | '**/*.js': ['eslint'], 3 | '**/*.{ts,tsx}': [() => 'tsc --skipLibCheck --noEmit', 'eslint --fix'], 4 | }; 5 | -------------------------------------------------------------------------------- /mogorhom-dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gorhom/showcase-template/e9b60c49ce389600cf466f6a7a0a05aa7840ed20/mogorhom-dark.png -------------------------------------------------------------------------------- /mogorhom-light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gorhom/showcase-template/e9b60c49ce389600cf466f6a7a0a05aa7840ed20/mogorhom-light.png -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@gorhom/showcase-template", 3 | "version": "4.0.1", 4 | "description": "A React Native template that helps developers to showcase their amazing libraries examples.", 5 | "main": "lib/commonjs/index", 6 | "module": "lib/module/index", 7 | "types": "lib/typescript/index.d.ts", 8 | "react-native": "src/index.ts", 9 | "source": "src/index.ts", 10 | "files": [ 11 | "src", 12 | "lib" 13 | ], 14 | "keywords": [ 15 | "showcase", 16 | "showcase-template", 17 | "react-native", 18 | "ios", 19 | "android" 20 | ], 21 | "repository": "https://github.com/gorhom/showcase-template", 22 | "author": "Mo Gorhom (https://gorhom.dev)", 23 | "license": "MIT", 24 | "bugs": { 25 | "url": "https://github.com/gorhom/showcase-template/issues" 26 | }, 27 | "homepage": "https://github.com/gorhom/showcase-template#readme", 28 | "scripts": { 29 | "typescript": "tsc --skipLibCheck --noEmit", 30 | "lint": "eslint --ext .js,.ts,.tsx . --fix", 31 | "build": "bob build && yarn copy-dts && yarn delete-dts", 32 | "copy-dts": "copyfiles -u 1 \"src/**/*.d.ts\" lib/typescript", 33 | "delete-dts": "find ./lib/commonjs -name '*.d.js*' -delete && find ./lib/module -name '*.d.js*' -delete", 34 | "release": "rm -rf lib && yarn build && release-it", 35 | "example": "yarn --cwd example", 36 | "bootstrap": "yarn install && yarn example" 37 | }, 38 | "devDependencies": { 39 | "@commitlint/cli": "^17.7.1", 40 | "@commitlint/config-conventional": "^17.7.0", 41 | "@react-native-community/eslint-config": "^3.2.0", 42 | "@react-navigation/native": "^7.1.9", 43 | "@react-navigation/native-stack": "^7.3.13", 44 | "@react-navigation/stack": "^7.3.2", 45 | "@release-it/conventional-changelog": "^7.0.1", 46 | "@types/react": "~18.2.14", 47 | "@types/react-native": "~0.72.2", 48 | "auto-changelog": "^2.4.0", 49 | "copyfiles": "^2.4.1", 50 | "eslint": "^8.49.0", 51 | "eslint-config-prettier": "^9.0.0", 52 | "eslint-plugin-prettier": "^5.0.0", 53 | "husky": "^4.2.3", 54 | "prettier": "^3.0.3", 55 | "react": "18.2.0", 56 | "react-native": "0.72.4", 57 | "react-native-gesture-handler": "~2.25.0", 58 | "react-native-reanimated": "~3.17.0", 59 | "react-native-builder-bob": "^0.21.3", 60 | "react-native-safe-area-context": "5.4.0", 61 | "release-it": "^16.1.5", 62 | "typescript": "^5.1.3" 63 | }, 64 | "peerDependencies": { 65 | "@react-navigation/native": "~7.1.9", 66 | "@react-navigation/stack": "~7.3.2", 67 | "react": "*", 68 | "react-native": "*", 69 | "react-native-gesture-handler": "~2.25.0", 70 | "react-native-reanimated": "~3.17.5", 71 | "react-native-safe-area-context": "~5.4.0" 72 | }, 73 | "react-native-builder-bob": { 74 | "source": "src", 75 | "output": "lib", 76 | "targets": [ 77 | "commonjs", 78 | "module", 79 | "typescript" 80 | ] 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /preview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gorhom/showcase-template/e9b60c49ce389600cf466f6a7a0a05aa7840ed20/preview.png -------------------------------------------------------------------------------- /scripts/auto-changelog.js: -------------------------------------------------------------------------------- 1 | module.exports = function (Handlebars) { 2 | Handlebars.registerHelper('custom', function (context, extra, options) { 3 | if ((!context || context.length === 0) && (!extra || extra.length === 0)) { 4 | return ''; 5 | } 6 | 7 | const list = [...context, ...extra] 8 | .filter(item => { 9 | const commit = item.commit || item; 10 | if (options.hash.exclude) { 11 | const pattern = new RegExp(options.hash.exclude, 'm'); 12 | if (pattern.test(commit.message)) { 13 | return false; 14 | } 15 | } 16 | if (options.hash.message) { 17 | const pattern = new RegExp(options.hash.message, 'm'); 18 | return pattern.test(commit.message); 19 | } 20 | if (options.hash.subject) { 21 | const pattern = new RegExp(options.hash.subject); 22 | return pattern.test(commit.subject); 23 | } 24 | return true; 25 | }) 26 | .map(item => options.fn(item)) 27 | .join(''); 28 | 29 | if (!list) { 30 | return ''; 31 | } 32 | 33 | return options.hash.heading 34 | ? `${options.hash.heading}\n\n${list}` 35 | : `${list}`; 36 | }); 37 | }; 38 | -------------------------------------------------------------------------------- /src/components/showcaseApp/ShowcaseApp.tsx: -------------------------------------------------------------------------------- 1 | import React, { FC, ReactNode, useEffect, useMemo } from 'react'; 2 | import { useColorScheme, View, StatusBar } from 'react-native'; 3 | import { NavigationContainer } from '@react-navigation/native'; 4 | import { createNativeStackNavigator } from '@react-navigation/native-stack'; 5 | import { ShowcaseTileList } from '../showcaseTileList'; 6 | import { TileDimensionsProvider } from '../../providers'; 7 | import { darkTheme, lightTheme } from '../../theme'; 8 | import type { ShowcaseAppProps } from './types'; 9 | import type { ShowcaseExampleScreenType } from '../../types'; 10 | import { styles } from './styles'; 11 | 12 | const Stack = createNativeStackNavigator(); 13 | 14 | const ShowcaseAppComponent: FC = ({ 15 | initialScreen = 'showcase', 16 | data, 17 | ...rest 18 | }) => { 19 | //#region hooks 20 | const colorScheme = useColorScheme(); 21 | //#endregion 22 | 23 | //#region variables 24 | const theme = useMemo( 25 | () => (colorScheme === 'dark' ? darkTheme : lightTheme), 26 | [colorScheme] 27 | ); 28 | const screens = useMemo( 29 | () => 30 | data.reduce((result, item) => { 31 | if ('name' in item) { 32 | result.push(item as ShowcaseExampleScreenType); 33 | return result 34 | } 35 | 36 | result.push(...item.data); 37 | return result; 38 | }, []), 39 | [data] 40 | ); 41 | //#endregion 42 | 43 | //#region effects 44 | useEffect(() => { 45 | StatusBar.setBarStyle( 46 | colorScheme === 'dark' ? 'light-content' : 'dark-content', 47 | true 48 | ); 49 | }, [colorScheme]); 50 | //#endregion 51 | return ( 52 | 53 | 54 | 58 | {() => } 59 | 60 | 61 | {screens.map(item => ( 62 | 77 | ))} 78 | 79 | 80 | ); 81 | }; 82 | 83 | export const ShowcaseApp: FC = ({ 84 | children, 85 | ...props 86 | }) => ( 87 | 88 | 89 | 90 | 91 | {children} 92 | 93 | ); 94 | -------------------------------------------------------------------------------- /src/components/showcaseApp/index.ts: -------------------------------------------------------------------------------- 1 | export { ShowcaseApp } from './ShowcaseApp'; 2 | -------------------------------------------------------------------------------- /src/components/showcaseApp/styles.ts: -------------------------------------------------------------------------------- 1 | import { StyleSheet } from 'react-native'; 2 | 3 | export const styles = StyleSheet.create({ 4 | container: { 5 | flex: 1, 6 | }, 7 | }); 8 | -------------------------------------------------------------------------------- /src/components/showcaseApp/types.d.ts: -------------------------------------------------------------------------------- 1 | import type { ShowcaseTileListProps } from '../showcaseTileList'; 2 | import type { ShowcaseExampleScreenSectionType, ShowcaseExampleType } from '../../types'; 3 | 4 | export interface ShowcaseAppProps extends Omit { 5 | initialScreen?: string; 6 | data: Array; 7 | } 8 | -------------------------------------------------------------------------------- /src/components/showcaseButton/ShowcaseButton.tsx: -------------------------------------------------------------------------------- 1 | import React, { type FC, useMemo } from 'react'; 2 | import { View } from 'react-native'; 3 | import { TouchableOpacity } from 'react-native-gesture-handler'; 4 | import { useStyles } from './styles'; 5 | import type { ShowcaseButtonProps } from './types'; 6 | 7 | export const ShowcaseButton: FC = ({ 8 | containerStyle: _providedContainerStyle, 9 | contentContainerStyle: _providedContentContainerStyle, 10 | children, 11 | onPress, 12 | }) => { 13 | //#region styles 14 | const styles = useStyles(); 15 | const containerStyle = useMemo( 16 | () => [styles.container, _providedContainerStyle], 17 | [styles.container, _providedContainerStyle] 18 | ); 19 | const contentContainerStyle = useMemo( 20 | () => [styles.contentContainer, _providedContentContainerStyle], 21 | [styles.contentContainer, _providedContentContainerStyle] 22 | ); 23 | //#endregion 24 | return ( 25 | 26 | {children} 27 | 28 | ); 29 | }; 30 | -------------------------------------------------------------------------------- /src/components/showcaseButton/index.ts: -------------------------------------------------------------------------------- 1 | export { ShowcaseButton } from './ShowcaseButton'; 2 | -------------------------------------------------------------------------------- /src/components/showcaseButton/styles.ts: -------------------------------------------------------------------------------- 1 | import { useMemo } from 'react'; 2 | import { StyleSheet } from 'react-native'; 3 | import { useShowcaseTheme } from '../../hooks'; 4 | 5 | export const useStyles = () => { 6 | const { colors } = useShowcaseTheme(); 7 | return useMemo( 8 | () => 9 | StyleSheet.create({ 10 | container: { 11 | backgroundColor: colors.secondaryCard, 12 | justifyContent: 'flex-end', 13 | borderRadius: 12, 14 | marginVertical: 6, 15 | }, 16 | contentContainer: { 17 | padding: 12, 18 | }, 19 | }), 20 | [colors.secondaryCard] 21 | ); 22 | }; 23 | -------------------------------------------------------------------------------- /src/components/showcaseButton/types.d.ts: -------------------------------------------------------------------------------- 1 | import type { ReactNode } from 'react'; 2 | import type { ViewStyle } from 'react-native'; 3 | 4 | export interface ShowcaseButtonProps { 5 | children?: ReactNode; 6 | containerStyle?: ViewStyle; 7 | contentContainerStyle?: ViewStyle; 8 | onPress: () => void; 9 | } 10 | -------------------------------------------------------------------------------- /src/components/showcaseFooter/ShowcaseFooter.tsx: -------------------------------------------------------------------------------- 1 | import React, { type FC } from 'react'; 2 | import { View, Linking } from 'react-native'; 3 | import { TouchableOpacity } from 'react-native-gesture-handler'; 4 | import { ShowcaseLabel } from '../showcaseLabel'; 5 | import { useStyles } from './styles'; 6 | import type { ShowcaseFooterProps } from './types'; 7 | 8 | export const ShowcaseFooter: FC = ({ 9 | username, 10 | url = '', 11 | }) => { 12 | // variables 13 | const styles = useStyles(); 14 | 15 | //#region callbacks 16 | const handleOnPress = () => { 17 | Linking.canOpenURL(url) 18 | .then(canOpen => { 19 | if (canOpen) { 20 | Linking.openURL(url); 21 | } 22 | }) 23 | .catch(() => {}); 24 | }; 25 | //#endregion 26 | 27 | // renders 28 | return ( 29 | 30 | 31 | 32 | created by{' '} 33 | {username} 34 | 35 | 36 | 37 | ); 38 | }; 39 | -------------------------------------------------------------------------------- /src/components/showcaseFooter/index.ts: -------------------------------------------------------------------------------- 1 | export { ShowcaseFooter } from './ShowcaseFooter'; 2 | -------------------------------------------------------------------------------- /src/components/showcaseFooter/styles.ts: -------------------------------------------------------------------------------- 1 | import { useMemo } from 'react'; 2 | import { StyleSheet } from 'react-native'; 3 | import { useShowcaseTheme } from '../../hooks'; 4 | 5 | export const useStyles = () => { 6 | const { colors } = useShowcaseTheme(); 7 | return useMemo( 8 | () => 9 | StyleSheet.create({ 10 | container: { 11 | paddingTop: 24, 12 | }, 13 | footer: { 14 | fontSize: 14, 15 | }, 16 | username: { 17 | color: colors.primary, 18 | }, 19 | }), 20 | [colors.primary] 21 | ); 22 | }; 23 | -------------------------------------------------------------------------------- /src/components/showcaseFooter/types.d.ts: -------------------------------------------------------------------------------- 1 | export interface ShowcaseFooterProps { 2 | username: string; 3 | url: string; 4 | } 5 | -------------------------------------------------------------------------------- /src/components/showcaseHeader/ShowcaseHeader.tsx: -------------------------------------------------------------------------------- 1 | import React, { FC } from 'react'; 2 | import { View } from 'react-native'; 3 | import { useSafeAreaInsets } from 'react-native-safe-area-context'; 4 | import { ShowcaseLabel } from '../showcaseLabel'; 5 | import { useStyles } from './styles'; 6 | import type { ShowcaseHeaderProps } from './types'; 7 | 8 | export const ShowcaseHeader: FC = ({ 9 | version = '0.0.0', 10 | name, 11 | description, 12 | }) => { 13 | const { top: safeTopInset } = useSafeAreaInsets(); 14 | 15 | // variables 16 | const styles = useStyles(safeTopInset); 17 | 18 | // renders 19 | return ( 20 | 21 | {`v${version}`} 22 | {name} 23 | {description} 24 | 25 | ); 26 | }; 27 | -------------------------------------------------------------------------------- /src/components/showcaseHeader/index.ts: -------------------------------------------------------------------------------- 1 | export { ShowcaseHeader } from './ShowcaseHeader'; 2 | -------------------------------------------------------------------------------- /src/components/showcaseHeader/styles.ts: -------------------------------------------------------------------------------- 1 | import { useMemo } from 'react'; 2 | import { StyleSheet } from 'react-native'; 3 | import { useShowcaseTheme } from '../../hooks'; 4 | 5 | export const useStyles = (safeTopInset: number = 0) => { 6 | const { colors } = useShowcaseTheme(); 7 | return useMemo( 8 | () => 9 | StyleSheet.create({ 10 | container: { 11 | backgroundColor: colors.background, 12 | paddingBottom: 24, 13 | paddingTop: Math.max(safeTopInset, 24), 14 | }, 15 | version: { 16 | alignSelf: 'flex-start', 17 | backgroundColor: colors.secondaryCard, 18 | borderRadius: 12, 19 | paddingHorizontal: 6, 20 | paddingVertical: 3, 21 | fontSize: 12, 22 | overflow: 'hidden', 23 | }, 24 | name: { 25 | fontSize: 34, 26 | fontWeight: '600', 27 | marginBottom: 12, 28 | }, 29 | description: { 30 | color: colors.secondaryText, 31 | fontSize: 16, 32 | }, 33 | }), 34 | [ 35 | colors.background, 36 | colors.secondaryCard, 37 | colors.secondaryText, 38 | safeTopInset, 39 | ] 40 | ); 41 | }; 42 | -------------------------------------------------------------------------------- /src/components/showcaseHeader/types.d.ts: -------------------------------------------------------------------------------- 1 | export interface ShowcaseHeaderProps { 2 | version: string; 3 | name: string; 4 | description: string; 5 | } 6 | -------------------------------------------------------------------------------- /src/components/showcaseLabel/ShowcaseLabel.tsx: -------------------------------------------------------------------------------- 1 | import React, { FC, useMemo } from 'react'; 2 | import { Text } from 'react-native'; 3 | import { useStyles } from './styles'; 4 | import type { ShowcaseLabelProps } from './types'; 5 | 6 | export const ShowcaseLabel: FC = ({ children, style }) => { 7 | //#region styles 8 | const styles = useStyles(); 9 | const textStyle = useMemo(() => [styles.text, style], [styles.text, style]); 10 | //#endregion 11 | return {children}; 12 | }; 13 | -------------------------------------------------------------------------------- /src/components/showcaseLabel/index.ts: -------------------------------------------------------------------------------- 1 | export { ShowcaseLabel } from './ShowcaseLabel'; 2 | -------------------------------------------------------------------------------- /src/components/showcaseLabel/styles.ts: -------------------------------------------------------------------------------- 1 | import { useMemo } from 'react'; 2 | import { StyleSheet } from 'react-native'; 3 | import { useShowcaseTheme } from '../../hooks'; 4 | 5 | export const useStyles = () => { 6 | const { colors } = useShowcaseTheme(); 7 | return useMemo( 8 | () => 9 | StyleSheet.create({ 10 | text: { 11 | color: colors.text, 12 | }, 13 | }), 14 | [colors.text] 15 | ); 16 | }; 17 | -------------------------------------------------------------------------------- /src/components/showcaseLabel/types.d.ts: -------------------------------------------------------------------------------- 1 | import type { ReactNode } from 'react'; 2 | import type { TextStyle } from 'react-native'; 3 | 4 | export interface ShowcaseLabelProps { 5 | children: string | ReactNode; 6 | style?: TextStyle; 7 | } 8 | -------------------------------------------------------------------------------- /src/components/showcaseTile/Tile.tsx: -------------------------------------------------------------------------------- 1 | import React, { FC, useCallback } from 'react'; 2 | import { ShowcaseButton } from '../showcaseButton'; 3 | import { ShowcaseLabel } from '../showcaseLabel'; 4 | import { useStyles } from './styles'; 5 | import type { ShowcaseTileProps } from './types'; 6 | 7 | export const ShowcaseTile: FC = ({ 8 | name, 9 | slug, 10 | isLarge, 11 | onPress, 12 | }) => { 13 | //#region styles 14 | const styles = useStyles(isLarge); 15 | //#endregion 16 | 17 | //#region callbacks 18 | const handleOnPress = useCallback(() => onPress(slug), [slug, onPress]); 19 | //#endregion 20 | 21 | // renders 22 | return ( 23 | 24 | {name} 25 | 26 | ); 27 | }; 28 | -------------------------------------------------------------------------------- /src/components/showcaseTile/index.ts: -------------------------------------------------------------------------------- 1 | export { ShowcaseTile } from './Tile'; 2 | -------------------------------------------------------------------------------- /src/components/showcaseTile/styles.ts: -------------------------------------------------------------------------------- 1 | import { useMemo } from 'react'; 2 | import { StyleSheet } from 'react-native'; 3 | import { useTileDimensions } from '../../hooks'; 4 | 5 | export const useStyles = (isLarge: boolean) => { 6 | const { regular, large } = useTileDimensions(); 7 | 8 | return useMemo( 9 | () => 10 | StyleSheet.create({ 11 | touchable: { 12 | minHeight: 76, 13 | width: isLarge ? large : regular, 14 | }, 15 | label: { 16 | fontSize: 20, 17 | fontWeight: '400', 18 | lineHeight: 26, 19 | }, 20 | }), 21 | [isLarge, large, regular] 22 | ); 23 | }; 24 | -------------------------------------------------------------------------------- /src/components/showcaseTile/types.d.ts: -------------------------------------------------------------------------------- 1 | import { ShowcaseExampleType } from '../../types'; 2 | 3 | export interface ShowcaseTileProps extends ShowcaseExampleType { 4 | index: number; 5 | isLarge: boolean; 6 | onPress: (slug: string) => void; 7 | } 8 | -------------------------------------------------------------------------------- /src/components/showcaseTileGroup/AccordionIndicator.tsx: -------------------------------------------------------------------------------- 1 | import React, { memo } from 'react'; 2 | import { View } from 'react-native'; 3 | import Animated, { 4 | SharedValue, 5 | interpolate, 6 | useAnimatedStyle, 7 | } from 'react-native-reanimated'; 8 | import { useAccordionIndicatorStyles } from './styles'; 9 | 10 | interface ShowcaseAccordionIndicatorProps { 11 | visibility: SharedValue; 12 | } 13 | 14 | function toRad(value: number) { 15 | 'worklet'; 16 | return (value * Math.PI) / 180; 17 | } 18 | 19 | function ShowcaseAccordionIndicatorComponent({ 20 | visibility, 21 | }: ShowcaseAccordionIndicatorProps) { 22 | //#region styles 23 | const styles = useAccordionIndicatorStyles(); 24 | const verticalLine = useAnimatedStyle(() => { 25 | const rotation = interpolate( 26 | visibility.value, 27 | [0, 1], 28 | [toRad(0), toRad(90)] 29 | ); 30 | return { 31 | ...styles.line, 32 | transform: [{ rotate: `${rotation}rad` }], 33 | }; 34 | }, [styles.line, visibility]); 35 | const horizontalLine = useAnimatedStyle(() => { 36 | const rotation = interpolate( 37 | visibility.value, 38 | [0, 1], 39 | [toRad(90), toRad(270)] 40 | ); 41 | return { 42 | ...styles.line, 43 | opacity: interpolate(visibility.value, [0, 1], [1, 0]), 44 | transform: [{ rotate: `${rotation}rad` }], 45 | }; 46 | }, [styles.line, visibility]); 47 | //#endregion 48 | 49 | return ( 50 | 51 | 52 | 53 | 54 | ); 55 | } 56 | 57 | export const ShowcaseAccordionIndicator = memo( 58 | ShowcaseAccordionIndicatorComponent 59 | ); 60 | -------------------------------------------------------------------------------- /src/components/showcaseTileGroup/TileGroup.tsx: -------------------------------------------------------------------------------- 1 | import React, { FC, useCallback, useMemo } from 'react'; 2 | import { LayoutChangeEvent, Pressable, View } from 'react-native'; 3 | import Animated, { 4 | Easing, 5 | interpolate, 6 | useAnimatedStyle, 7 | useSharedValue, 8 | withTiming, 9 | } from 'react-native-reanimated'; 10 | import { ShowcaseTile } from '../showcaseTile'; 11 | import { ShowcaseLabel } from '../showcaseLabel'; 12 | import { useStyles } from './styles'; 13 | import type { ShowcaseTileGroupProps } from './types'; 14 | import { ShowcaseAccordionIndicator } from './AccordionIndicator'; 15 | 16 | export const ShowcaseTileGroup: FC = ({ 17 | title, 18 | data, 19 | collapsed: _collapsed = false, 20 | collapsible: _collapsible = true, 21 | onPress, 22 | }) => { 23 | //#region state 24 | const initialHeight = useSharedValue(-1); 25 | const visibility = useSharedValue(!_collapsed); 26 | const visibilityIndex = useSharedValue(!_collapsed ? 1 : 0); 27 | //#endregion 28 | 29 | //#region callbacks 30 | const handleHeaderPress = useCallback(() => { 31 | let nextVisibility = !visibility.value; 32 | visibility.value = nextVisibility; 33 | visibilityIndex.value = withTiming(nextVisibility ? 1 : 0, { 34 | duration: 450, 35 | easing: Easing.out(Easing.exp), 36 | }); 37 | }, [visibility, visibilityIndex]); 38 | const handleContainerLayout = useCallback( 39 | ({ 40 | nativeEvent: { 41 | layout: { height }, 42 | }, 43 | }: LayoutChangeEvent) => { 44 | initialHeight.value = height; 45 | }, 46 | [initialHeight] 47 | ); 48 | //#endregion 49 | 50 | //#region variables 51 | const collapsible = useMemo( 52 | () => _collapsed || _collapsible, 53 | [_collapsed, _collapsible] 54 | ); 55 | //#endregion 56 | 57 | //#region styles 58 | const styles = useStyles(); 59 | const containerStyle = useAnimatedStyle(() => { 60 | let height: number | undefined = undefined; 61 | if (initialHeight.value !== -1) { 62 | height = interpolate( 63 | visibilityIndex.value, 64 | [0, 1], 65 | [0, initialHeight.value] 66 | ); 67 | } 68 | return { 69 | ...styles.container, 70 | height, 71 | }; 72 | }, [visibilityIndex, initialHeight]); 73 | //#endregion 74 | 75 | // renders 76 | const renderTitle = 77 | title !== '' ? ( 78 | {title} 79 | ) : null; 80 | return ( 81 | <> 82 | {collapsible ? ( 83 | 84 | {renderTitle} 85 | {collapsible ? ( 86 | 87 | ) : null} 88 | 89 | ) : ( 90 | renderTitle 91 | )} 92 | 93 | 94 | 95 | {data.map((item, index) => ( 96 | 103 | ))} 104 | 105 | 106 | 107 | ); 108 | }; 109 | -------------------------------------------------------------------------------- /src/components/showcaseTileGroup/index.ts: -------------------------------------------------------------------------------- 1 | export { ShowcaseTileGroup as TileGroup } from './TileGroup'; 2 | -------------------------------------------------------------------------------- /src/components/showcaseTileGroup/styles.ts: -------------------------------------------------------------------------------- 1 | import { useMemo } from 'react'; 2 | import { StyleSheet } from 'react-native'; 3 | import { useShowcaseTheme } from '../../hooks'; 4 | 5 | export const useStyles = () => { 6 | const { colors } = useShowcaseTheme(); 7 | return useMemo( 8 | () => 9 | StyleSheet.create({ 10 | container: { 11 | overflow: 'hidden', 12 | }, 13 | contentContainer: { 14 | position: 'absolute', 15 | left: 0, 16 | right: 0, 17 | flexDirection: 'row', 18 | flexWrap: 'wrap', 19 | justifyContent: 'space-between', 20 | }, 21 | header: { 22 | flexDirection: 'row', 23 | justifyContent: 'space-between', 24 | alignItems: 'center', 25 | }, 26 | title: { 27 | flex: 1, 28 | fontWeight: '800', 29 | textTransform: 'uppercase', 30 | paddingTop: 12, 31 | paddingBottom: 6, 32 | color: colors.secondaryText, 33 | }, 34 | }), 35 | [colors.secondaryText] 36 | ); 37 | }; 38 | 39 | export const useAccordionIndicatorStyles = () => { 40 | const { colors } = useShowcaseTheme(); 41 | return useMemo( 42 | () => 43 | StyleSheet.create({ 44 | container: { 45 | width: 12, 46 | height: 12, 47 | }, 48 | line: { 49 | position: 'absolute', 50 | top: 3, 51 | left: 3.5, 52 | backgroundColor: colors.secondaryText, 53 | width: 3, 54 | height: 12, 55 | borderRadius: 3, 56 | }, 57 | }), 58 | [colors.secondaryText] 59 | ); 60 | }; 61 | -------------------------------------------------------------------------------- /src/components/showcaseTileGroup/types.d.ts: -------------------------------------------------------------------------------- 1 | import type { ShowcaseExampleSectionType } from '../../types'; 2 | 3 | export interface ShowcaseTileGroupProps extends ShowcaseExampleSectionType { 4 | onPress: (slug: string) => void; 5 | } 6 | -------------------------------------------------------------------------------- /src/components/showcaseTileList/ShowcaseTileList.tsx: -------------------------------------------------------------------------------- 1 | import React, { FC, useCallback, useMemo } from 'react'; 2 | import { FlatList, View } from 'react-native'; 3 | import { useNavigation } from '@react-navigation/native'; 4 | import { useSafeAreaInsets } from 'react-native-safe-area-context'; 5 | import { ShowcaseHeader } from '../showcaseHeader'; 6 | import { ShowcaseFooter } from '../showcaseFooter'; 7 | import { TileGroup } from '../showcaseTileGroup'; 8 | import { useStyles } from './styles'; 9 | import type { 10 | ShowcaseExampleSectionType, 11 | ShowcaseExampleType, 12 | } from '../../types'; 13 | import type { ShowcaseTileListProps } from './types'; 14 | import { ShowcaseTile } from '../showcaseTile/Tile'; 15 | 16 | export const ShowcaseTileList: FC = ({ 17 | name, 18 | description, 19 | version, 20 | author, 21 | data: _data, 22 | }) => { 23 | //#region hooks 24 | const { navigate } = useNavigation(); 25 | const safeInsets = useSafeAreaInsets(); 26 | //#endregion 27 | 28 | //#region variables 29 | const data: Array = useMemo(() => { 30 | // @ts-ignore 31 | if (_data.length > 0 && _data[0].title === undefined) { 32 | return [ 33 | { 34 | title: '', 35 | data: _data as Array, 36 | }, 37 | ]; 38 | } else { 39 | return _data as Array; 40 | } 41 | }, [_data]); 42 | //#endregion 43 | 44 | //#region styles 45 | const styles = useStyles(safeInsets.bottom); 46 | //#endregion 47 | 48 | //#region callbacks 49 | const handleOnPress = useCallback((slug: string) => { 50 | requestAnimationFrame(() => { 51 | navigate(slug as never); 52 | }); 53 | // eslint-disable-next-line react-hooks/exhaustive-deps 54 | }, []); 55 | //#endregion 56 | 57 | //#region renders 58 | const renderHeader = () => { 59 | return ( 60 | 61 | ); 62 | }; 63 | const renderFooter = () => { 64 | return ; 65 | }; 66 | const renderItem = ({ 67 | item, 68 | index, 69 | }: { 70 | item: ShowcaseExampleSectionType | ShowcaseExampleType; 71 | index: number; 72 | }) => { 73 | 74 | if ('name' in item) { 75 | return ( 76 | 83 | ) 84 | } 85 | 86 | return ( 87 | 92 | ); 93 | }; 94 | const renderSeparator = () => { 95 | return ; 96 | }; 97 | 98 | return ( 99 | item.title} 105 | renderItem={renderItem} 106 | ListHeaderComponent={renderHeader} 107 | ListFooterComponent={renderFooter} 108 | ItemSeparatorComponent={renderSeparator} 109 | /> 110 | ); 111 | //#endregion 112 | }; 113 | -------------------------------------------------------------------------------- /src/components/showcaseTileList/index.ts: -------------------------------------------------------------------------------- 1 | export { ShowcaseTileList } from './ShowcaseTileList'; 2 | export type { ShowcaseTileListProps } from './types'; 3 | -------------------------------------------------------------------------------- /src/components/showcaseTileList/styles.ts: -------------------------------------------------------------------------------- 1 | import { useMemo } from 'react'; 2 | import { StyleSheet } from 'react-native'; 3 | import { useTheme } from '@react-navigation/native'; 4 | 5 | export const useStyles = (safeBottomInset: number = 0) => { 6 | const { colors } = useTheme(); 7 | return useMemo( 8 | () => 9 | StyleSheet.create({ 10 | container: { 11 | flex: 1, 12 | }, 13 | contentContainer: { 14 | paddingHorizontal: 24, 15 | paddingBottom: Math.max(safeBottomInset, 24), 16 | }, 17 | separator: { 18 | width: 12, 19 | height: 12, 20 | }, 21 | }), 22 | [colors.background, safeBottomInset] 23 | ); 24 | }; 25 | -------------------------------------------------------------------------------- /src/components/showcaseTileList/types.d.ts: -------------------------------------------------------------------------------- 1 | import type { 2 | ShowcaseExampleType, 3 | ShowcaseExampleSectionType, 4 | } from '../../types'; 5 | 6 | export interface ShowcaseTileListProps { 7 | name: string; 8 | description: string; 9 | version: string; 10 | data: Array; 11 | author: { 12 | username: string; 13 | url: string; 14 | }; 15 | } 16 | -------------------------------------------------------------------------------- /src/contexts/index.ts: -------------------------------------------------------------------------------- 1 | export { TileDimensionsContext } from './tileDimensionsContext'; 2 | -------------------------------------------------------------------------------- /src/contexts/tileDimensionsContext.ts: -------------------------------------------------------------------------------- 1 | import { createContext } from 'react'; 2 | 3 | export interface TileDimensionsType { 4 | regular: number; 5 | large: number; 6 | } 7 | 8 | export const TileDimensionsContext = createContext( 9 | null 10 | ); 11 | -------------------------------------------------------------------------------- /src/hooks/index.ts: -------------------------------------------------------------------------------- 1 | export { useTileDimensions } from './useTileDimensions'; 2 | export { useShowcaseTheme } from './useShowcaseTheme'; 3 | -------------------------------------------------------------------------------- /src/hooks/useShowcaseTheme.ts: -------------------------------------------------------------------------------- 1 | import { useTheme as useRNTheme } from '@react-navigation/native'; 2 | import type { lightTheme } from '../theme'; 3 | 4 | export const useShowcaseTheme: () => typeof lightTheme = useRNTheme as any; 5 | -------------------------------------------------------------------------------- /src/hooks/useTileDimensions.ts: -------------------------------------------------------------------------------- 1 | import { useContext } from 'react'; 2 | import { TileDimensionsContext } from '../contexts'; 3 | 4 | export const useTileDimensions = () => { 5 | const context = useContext(TileDimensionsContext); 6 | 7 | if (context === null) { 8 | throw "'useTileDimensions' cannot be used out of the !"; 9 | } 10 | 11 | return context; 12 | }; 13 | -------------------------------------------------------------------------------- /src/index.ts: -------------------------------------------------------------------------------- 1 | export { ShowcaseApp } from './components/showcaseApp'; 2 | export { ShowcaseButton } from './components/showcaseButton'; 3 | export { ShowcaseLabel } from './components/showcaseLabel'; 4 | 5 | export { useShowcaseTheme } from './hooks'; 6 | 7 | export type { 8 | ShowcaseExampleScreenSectionType, 9 | ShowcaseExampleScreenType, 10 | ShowcaseExampleScreenProps, 11 | } from './types'; 12 | -------------------------------------------------------------------------------- /src/providers/TileDimensionsProvider.tsx: -------------------------------------------------------------------------------- 1 | import React, { ReactNode, useMemo } from 'react'; 2 | import { useWindowDimensions } from 'react-native'; 3 | import { TileDimensionsContext } from '../contexts'; 4 | 5 | interface TileDimensionsProviderProps { 6 | children: ReactNode; 7 | } 8 | 9 | export const TileDimensionsProvider = ({ 10 | children, 11 | }: TileDimensionsProviderProps) => { 12 | //#region hooks 13 | const { width } = useWindowDimensions(); 14 | //#endregion 15 | 16 | //#region variables 17 | const parentContainerWidth = useMemo(() => width - 24 * 2, [width]); 18 | const itemWidth = useMemo( 19 | () => parentContainerWidth / 2 - 6, 20 | [parentContainerWidth] 21 | ); 22 | const contextValue = useMemo( 23 | () => ({ 24 | regular: itemWidth, 25 | large: parentContainerWidth, 26 | }), 27 | [itemWidth, parentContainerWidth] 28 | ); 29 | //#endregion 30 | 31 | return ( 32 | 33 | {children} 34 | 35 | ); 36 | }; 37 | -------------------------------------------------------------------------------- /src/providers/index.ts: -------------------------------------------------------------------------------- 1 | export { TileDimensionsProvider } from './TileDimensionsProvider'; 2 | -------------------------------------------------------------------------------- /src/theme/dark.ts: -------------------------------------------------------------------------------- 1 | import { DarkTheme } from '@react-navigation/native'; 2 | 3 | export const darkTheme = { 4 | ...DarkTheme, 5 | colors: { 6 | ...DarkTheme.colors, 7 | secondaryCard: '#222', 8 | secondaryText: '#8F8F8F', 9 | }, 10 | }; 11 | -------------------------------------------------------------------------------- /src/theme/index.ts: -------------------------------------------------------------------------------- 1 | export { darkTheme } from './dark'; 2 | export { lightTheme } from './light'; 3 | -------------------------------------------------------------------------------- /src/theme/light.ts: -------------------------------------------------------------------------------- 1 | import { DefaultTheme } from '@react-navigation/native'; 2 | 3 | export const lightTheme = { 4 | ...DefaultTheme, 5 | colors: { 6 | ...DefaultTheme.colors, 7 | secondaryCard: '#CCC', 8 | secondaryText: '#7A7A7A', 9 | }, 10 | }; 11 | -------------------------------------------------------------------------------- /src/types.d.ts: -------------------------------------------------------------------------------- 1 | import type { NativeStackNavigationProp } from '@react-navigation/native-stack'; 2 | 3 | export interface ShowcaseExampleType { 4 | name: string; 5 | title?: string; 6 | slug: string; 7 | } 8 | 9 | export interface ShowcaseExampleSectionType { 10 | title: string; 11 | data: ShowcaseExampleType[]; 12 | collapsible?: boolean; 13 | collapsed?: boolean; 14 | } 15 | 16 | export interface ShowcaseExampleScreenType extends ShowcaseExampleType { 17 | getScreen: () => React.ComponentType; 18 | screenOptions?: StackNavigationOptions; 19 | } 20 | 21 | export interface ShowcaseExampleScreenSectionType 22 | extends ShowcaseExampleSectionType { 23 | data: ShowcaseExampleScreenType[]; 24 | } 25 | 26 | export type ShowcaseExampleScreenProps = { 27 | navigation: NativeStackNavigationProp<{}, '', ''>; 28 | route: { 29 | key: string; 30 | name: string; 31 | params: ShowcaseExampleType; 32 | }; 33 | }; 34 | -------------------------------------------------------------------------------- /templates/changelog-template.hbs: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | {{#each releases}} 4 | {{#if href}} 5 | ## [{{title}}]({{href}}){{#if tag}} - {{isoDate}}{{/if}} 6 | {{else}} 7 | ## {{title}}{{#if tag}} - {{isoDate}}{{/if}} 8 | {{/if}} 9 | 10 | {{#if summary}} 11 | {{summary}} 12 | {{/if}} 13 | 14 | {{#custom merges commits heading="#### Features" subject="feat: "}} 15 | - {{message}} ({{#if id}}[`#{{id}}`]{{else}}[{{shorthash}}]{{/if}}({{href}})). 16 | {{/custom}} 17 | 18 | {{#custom merges commits heading="#### Improvements" subject="(chore|refactor|style): "}} 19 | - {{message}} ({{#if id}}[`#{{id}}`]{{else}}[{{shorthash}}]{{/if}}({{href}})). 20 | {{/custom}} 21 | 22 | {{#custom merges commits heading="#### Fixes" subject="fix: "}} 23 | - {{message}} ({{#if id}}[`#{{id}}`]{{else}}[{{shorthash}}]{{/if}}({{href}})). 24 | {{/custom}} 25 | 26 | {{#custom merges commits heading="#### Documentations" subject="docs: "}} 27 | - {{message}} ({{#if id}}[`#{{id}}`]{{else}}[{{shorthash}}]{{/if}}({{href}})). 28 | {{/custom}} 29 | 30 | {{/each}} -------------------------------------------------------------------------------- /templates/release-template.hbs: -------------------------------------------------------------------------------- 1 | {{#each releases}} 2 | {{#if @first}} 3 | {{#custom merges commits heading="#### Features" subject="feat: "}} 4 | - {{message}} ({{#if id}}[`#{{id}}`]{{else}}[{{shorthash}}]{{/if}}({{href}})). 5 | {{/custom}} 6 | 7 | {{#custom merges commits heading="#### Improvements" subject="(chore|refactor|style): "}} 8 | - {{message}} ({{#if id}}[`#{{id}}`]{{else}}[{{shorthash}}]{{/if}}({{href}})). 9 | {{/custom}} 10 | 11 | {{#custom merges commits heading="#### Fixes" subject="fix: "}} 12 | - {{message}} ({{#if id}}[`#{{id}}`]{{else}}[{{shorthash}}]{{/if}}({{href}})). 13 | {{/custom}} 14 | 15 | {{#custom merges commits heading="#### Documentations" subject="docs: "}} 16 | - {{message}} ({{#if id}}[`#{{id}}`]{{else}}[{{shorthash}}]{{/if}}({{href}})). 17 | {{/custom}} 18 | {{/if}} 19 | {{/each}} -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "baseUrl": ".", 4 | "paths": { 5 | "@gorhom/showcase-template": ["./src/index"] 6 | }, 7 | "allowUnreachableCode": false, 8 | "allowUnusedLabels": false, 9 | "esModuleInterop": true, 10 | "forceConsistentCasingInFileNames": true, 11 | "jsx": "react", 12 | "lib": ["esnext"], 13 | "module": "esnext", 14 | "moduleResolution": "node", 15 | "noFallthroughCasesInSwitch": true, 16 | "noImplicitReturns": true, 17 | "noImplicitUseStrict": false, 18 | "noStrictGenericChecks": false, 19 | "noUnusedLocals": true, 20 | "noUnusedParameters": true, 21 | "resolveJsonModule": true, 22 | "skipLibCheck": true, 23 | "strict": true, 24 | "target": "esnext" 25 | }, 26 | "include": ["src"] 27 | } 28 | --------------------------------------------------------------------------------