├── .changeset ├── README.md └── config.json ├── .editorconfig ├── .eslintrc.js ├── .flowconfig ├── .github ├── FUNDING.yml ├── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md └── workflows │ └── release.yml ├── .gitignore ├── .travis.yml ├── .vscode └── settings.json ├── CHANGELOG.md ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── babel.config.js ├── example ├── .gitignore ├── App.jsx ├── app.json ├── assets │ ├── adaptive-icon.png │ ├── favicon.png │ ├── icon.png │ └── splash.png ├── babel.config.js ├── eas.json ├── package.json └── yarn.lock ├── jest.config.js ├── package.json ├── src ├── components │ ├── CopilotModal.tsx │ ├── CopilotStep.tsx │ ├── SvgMask.tsx │ ├── ViewMask.tsx │ ├── default-ui │ │ ├── Button.tsx │ │ ├── StepNumber.tsx │ │ └── Tooltip.tsx │ ├── style.ts │ └── tests │ │ └── CopilotStep.test.tsx ├── contexts │ └── CopilotProvider.tsx ├── hocs │ ├── copilot.tsx │ ├── tests │ │ └── walkthroughable.test.tsx │ └── walkthroughable.tsx ├── hooks │ ├── useStateWithAwait.ts │ └── useStepsMap.ts ├── index.ts └── types.ts ├── tsconfig.json ├── tsconfig.spec.json ├── tsup.config.ts └── yarn.lock /.changeset/README.md: -------------------------------------------------------------------------------- 1 | # Changesets 2 | 3 | Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works 4 | with multi-package repos, or single-package repos to help you version and publish your code. You can 5 | find the full documentation for it [in our repository](https://github.com/changesets/changesets) 6 | 7 | We have a quick list of common questions to get you started engaging with this project in 8 | [our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md) 9 | -------------------------------------------------------------------------------- /.changeset/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://unpkg.com/@changesets/config@2.3.0/schema.json", 3 | "changelog": "@changesets/cli/changelog", 4 | "commit": false, 5 | "fixed": [], 6 | "linked": [], 7 | "access": "restricted", 8 | "baseBranch": "master", 9 | "updateInternalDependencies": "patch", 10 | "ignore": [] 11 | } 12 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig helps define and maintain consistent 2 | # coding styles between different editors and IDEs. 3 | # http://editorconfig.org/ 4 | 5 | root = true 6 | 7 | [*] 8 | charset = utf-8 9 | indent_size = 2 10 | end_of_line = lf 11 | indent_style = space 12 | insert_final_newline = true 13 | trim_trailing_whitespace = true 14 | 15 | [*.md] 16 | trim_trailing_whitespace = false 17 | -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | /** @type {require("eslint").Linter.Config} */ 2 | module.exports = { 3 | env: { 4 | browser: true, 5 | es2021: true, 6 | }, 7 | extends: [ 8 | "plugin:react/recommended", 9 | "plugin:react-hooks/recommended", 10 | "standard-with-typescript", 11 | "prettier", 12 | ], 13 | overrides: [], 14 | parserOptions: { 15 | ecmaVersion: "latest", 16 | sourceType: "module", 17 | project: ["./tsconfig.json"], 18 | }, 19 | plugins: ["react"], 20 | rules: { 21 | "@typescript-eslint/explicit-function-return-type": "off", 22 | "@typescript-eslint/strict-boolean-expressions": "off", 23 | "@typescript-eslint/no-unsafe-argument": "off", 24 | }, 25 | }; 26 | -------------------------------------------------------------------------------- /.flowconfig: -------------------------------------------------------------------------------- 1 | [include] 2 | ./src 3 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: mohebifar 2 | patreon: # Replace with a single Patreon username 3 | open_collective: # Replace with a single Open Collective username 4 | ko_fi: # Replace with a single Ko-fi username 5 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 6 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 7 | liberapay: # Replace with a single Liberapay username 8 | issuehunt: # Replace with a single IssueHunt username 9 | otechie: # Replace with a single Otechie username 10 | custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] 11 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | labels: 5 | --- 6 | 7 | **Current Behavior** 8 | A clear and concise description of the behavior. 9 | 10 | **Input Code** 11 | 12 | - REPL or Repo link if applicable: 13 | 14 | ```js 15 | var your => (code) => here; 16 | ``` 17 | 18 | **Expected behavior/code** 19 | A clear and concise description of what you expected to happen (or code). 20 | 21 | **Environment** 22 | 23 | - Device: [e.g. iPhone 8 Simulator] 24 | - OS: [e.g. iOS12] 25 | - `react-native-copilot`: [e.g. v2.4.1] 26 | - `react-native`: [e.g. v0.57] 27 | - `react-native-svg`: [e.g. v7.1.0] 28 | 29 | **Possible Solution** 30 | 31 | 32 | 33 | **Additional context/Screenshots** 34 | Add any other context about the problem here. If applicable, add screenshots to help explain. 35 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | labels: 5 | --- 6 | 7 | **Is your feature request related to a problem? Please describe.** 8 | A clear and concise description of what the problem is. Ex. I have an issue when [...] 9 | 10 | **Describe the solution you'd like** 11 | A clear and concise description of what you want to happen. Add any considered drawbacks. 12 | 13 | **Describe alternatives you've considered** 14 | A clear and concise description of any alternative solutions or features you've considered. 15 | 16 | **Teachability, Documentation, Adoption, Migration Strategy** 17 | If you can, explain how users will be able to use this and possibly write out a version the docs. 18 | Maybe a screenshot or design? 19 | -------------------------------------------------------------------------------- /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | name: Release 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | 8 | concurrency: ${{ github.workflow }}-${{ github.ref }} 9 | 10 | jobs: 11 | release: 12 | name: Release 13 | runs-on: ubuntu-latest 14 | steps: 15 | - name: Checkout Repo 16 | uses: actions/checkout@v3 17 | 18 | - name: Setup Node.js 18.x 19 | uses: actions/setup-node@v3 20 | with: 21 | node-version: 18.x 22 | 23 | - name: Install Dependencies 24 | run: yarn 25 | 26 | - name: Lint 27 | run: yarn lint 28 | 29 | - name: Test 30 | run: yarn test 31 | 32 | - name: Build 33 | run: yarn build 34 | 35 | - name: Create Release Pull Request or Publish to npm 36 | id: changesets 37 | uses: changesets/action@v1 38 | with: 39 | # This expects you to have a script called release which does a build for your packages and calls changeset publish 40 | publish: yarn release 41 | env: 42 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 43 | NPM_TOKEN: ${{ secrets.NPM_TOKEN }} 44 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | npm-debug.* 2 | .DS_Store 3 | node_modules 4 | dist -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - "10" 4 | script: 5 | - yarn test 6 | - yarn lint 7 | deploy: 8 | provider: npm 9 | email: "$NPM_AUTHOR" 10 | api_key: "$NPM_TOKEN" 11 | on: 12 | branch: master 13 | env: 14 | global: 15 | - secure: lvFQZnQE/BYH/8OiVDM6QoE44Q67xbJEK6MDXwK0QIWKigjvwfSQRUx3cyMDiX6xUo92Qvmc0PHLzIE+Y6Ozp3fNkuxR1rAam0oiJmr3jgui4dhzFid5x9S+gZrT7KS+8h3PPNrKMSJ1ju5E7CbwdaPu+dEN+fUvfbfUa0VNlgO0Vwk9iWs229aypxo3vwgMMMgi8sS39p6Fr6C2CNMCFCOpVSshxAVnSfNIip+sQpuEdFszgjBrvGMjeslEG2PsagSzhx+liBQFbCrOKuhf0CFtH4utLDfIlr0XrP+boIL2WHwn8EwSbzPEFIbnYaPk5yyaFiI2F0RHTFL01xrsrLwiJD02za9Topb6REmHHT5wrleYExgIup3gWFJofQ7lGA2YwPuCk+68F0YHWDeuC4Is/N0wMgtex9LMQCd66H3CZJk77Pp72csrzI9fURj5QZOOacL+C175E1Il6fJ9OsCu6rhQM9vw/tFYp3YsA7mJaw/RMfEsJrjaA4hZgF8yQvAs4eO8CN/ROGHSbDS5q9K5RjvxkBt3pkJWR555pcpRUmfXpLYkZdNf8XQJF5WEZyAUwLebIZ8uWR0BdYg83EHKZyUyNVyez2wxZQHXYi1eIkiAs9nzQhyzTce60UiZqg4BnpbPtZZkep58fKCSxwM714LmoPWSCckfUlVYS/A= 16 | - secure: aJkIQZhB2ZlI43R3jLM3C5nIMAJ7CytkuOlKJ0L3U5IsCoPxr9+Dxl0VCMivkrtGTjD/eoYJtPjkHWRQ56H0pF/zKWlv5LtUtZFZ4q3oGE33FlIQ7gA20hahn+4AbB3yyk0zlPUF1jrL+RmRGwc/ckeSdE28R/xKfAl7qRrCk41U6amvVjBYzXk37npGLJI31EUz7/IbQ5MB4S2hfrWnkjwr0QfNWm1D9c2YOTWXeYIlO92z3LZWRjv2qSkSudsanEStINL2JNVdwy38pFVPKH0MroISUIZqCQmrLhXidmWOGntlDgAeQMjxjl9T11WFY/Qz2yqYoVgbl+EIoloNRLR3/LNRsOQBEcIRNV/hjwHb8NelsmPhuH6nJ0qN/ErADXnmDEtmVCjQoOsc5A5tuhd7HY0t28qdJXcf3gNoWc7HUdVvPOdTaQAZ755hg3aFn2nSgMOU8Ph0aWjiJWxdE9IaS4fG+UiSThHaKWoFKI+OVJRUMD1csRgIXo5bhAm6WcTSYyR+j36LZ0n9RhYcV1xVERYa9UL/RrbQT0vp9sWHKA5Ahsrzx/MQq13CuWkEh8duc26Td02soVPcnjB07dmehAfttEs9mzdHUEP3VkDZa6mrHOkXZVg/bbD2QuwK0PFymd12frXZVvi6V2C3PCGP57xnqPsYRfCAduKGuUE= 17 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "javascript.validate.enable": false 3 | } 4 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | <<<<<<< Updated upstream 2 | 3 | ## 3.3.3 4 | 5 | ### Patch Changes 6 | 7 | - 7961855: Fix arrow style on Android 8 | 9 | # Change Log 10 | 11 | ## 3.3.2 12 | 13 | ### Patch Changes 14 | 15 | - d14d956: Expose totalStepsNumber via useCopilot 16 | 17 | ## 3.3.1 18 | 19 | ### Patch Changes 20 | 21 | - 05b3a47: Fix a type error in walkthroughable 22 | 23 | ## 3.3.0 24 | 25 | ### Minor Changes 26 | 27 | - 3e5d3cc: Fix the issue with missing module file specified in package json 28 | 29 | ## 3.2.1 30 | 31 | ### Patch Changes 32 | 33 | - 3a6dd5a: Fix malformed field crash and add more config (arrowSize and margin) 34 | 35 | ## 3.2.0 36 | 37 | ### Minor Changes 38 | 39 | - 0d8362a: Remove Tooltip and StepNumber passed props in favor of useCopilot context 40 | Un-register the step after name change and re-register with the new name 41 | Add tests for CopilotStep 42 | 43 | ## 3.1.0 44 | 45 | ### Minor Changes 46 | 47 | - 312fba4: Expose more functions through the public API 48 | 49 | Expose `stop`, `goToNext`, `goToNth`, and `goToPrev` through the `useCopilot` hook 50 | Export `DefaultUI` from the module's entry to access the default Tooltip and StepNumber components 51 | 52 | ## 3.0.1 53 | 54 | ### Patch Changes 55 | 56 | - 3a0f6e0: Migrate to TS and add CopilotProvider 57 | 58 | ## 3.0.0 59 | 60 | ### Major Changes 61 | 62 | - # f2b45c7: Migrate to TS and deprecate HOC 63 | 64 | # Changelog 65 | 66 | > > > > > > > Stashed changes 67 | 68 | All notable changes to this project will be documented in this file. 69 | 70 | ## [3.3.0] - 2024-03-06 71 | 72 | ### ⚙️ Miscellaneous Tasks 73 | 74 | - Upgrade dependencies and fix the issue with missing module file specified in package json (#311) 75 | 76 | ## [3.2.1] - 2023-04-13 77 | 78 | ### 🐛 Bug Fixes 79 | 80 | - _(android)_ Fix malformed field crash, add more config (#279) 81 | 82 | ## [3.0.0] - 2023-03-22 83 | 84 | ### 🚀 Features 85 | 86 | - _(CopilotStep)_ Add active flag to steps 87 | - _(tooltip)_ Add getNth function (#267) 88 | 89 | ### 🐛 Bug Fixes 90 | 91 | - Fixing the arrow position 92 | - _(CopilotStep)_ Fix measure error where **TEST** is undefined 93 | - _(SvgMask)_ Defer rendering Svg until layout is measured 94 | - _(example)_ Fix the watcher for updating the example dep 95 | - _(copilot)_ Start(fromStep) issue fixed 96 | - _(CopilotModal)_ Consider status bar height 97 | - _(CopilotModal)_ Do status bar offset only on android 98 | - _(contributing)_ Fix broken links 99 | - _(copilot)_ Hoist static props 100 | - _(types)_ Adjust type from handleNthStep -> handleNth (#268) 101 | 102 | ### 🚜 Refactor 103 | 104 | - The Button to the compoenents directory 105 | - _(CopilotModal)_ Use Modal instead of ternary expression to control visibiity 106 | 107 | ### 📚 Documentation 108 | 109 | - _(Readme)_ Improve docs 110 | - Charles suggestions 111 | - _(Readme)_ Add badges 112 | - Update semaphore project name 113 | - Remove old name inspiration 114 | - _(README)_ Renaming the npm package 115 | - _(README)_ Copilotable to walkthroughable 116 | - _(README)_ Add tutorial triggering description 117 | - _(README)_ Updates for v2.0.0 118 | - _(README)_ Add react-native-svg to the installation section 119 | - Fix shields to point to correct pkg & center 120 | - _(events)_ Described event emitters in readme 121 | - _(events)_ Remove event handlers on unmount in example 122 | - _(README)_ Add OKG 123 | - _(README)_ Update OKGrow link 124 | 125 | ### 🎨 Styling 126 | 127 | - Fix lint errors 128 | - Lint 129 | 130 | ### 🧪 Testing 131 | 132 | - Add unit tests 133 | - _(walkthroughable)_ Added tests for the walkthroughable 134 | - _(copilot)_ Added tests for the copilot HOC 135 | - _(copilot)_ Add test for tooltip component 136 | - _(copilot)_ Update the tests based on the Modal change 137 | - _(Copilot)_ Test for the step active flags 138 | 139 | ### ⚙️ Miscellaneous Tasks 140 | 141 | - Add .editorconfig 142 | - Change the package author 143 | - Eslint 144 | - Rename the package 145 | - Add package lock 146 | - Bump version (1.0.1) 147 | - _(example)_ Upgrade expo for the example and better src linking 148 | - Cleaning up the directory structure 149 | - _(Example)_ Update name of the package in the example 150 | - _(yarn)_ Upgrade packages and remove package-lock.json 151 | - _(package)_ Bump version to 2.1.0 152 | - _(README)_ Update badges 153 | - _(package)_ Bump version 2.2.0 154 | - _(package)_ Bump version to 2.2.3 155 | - _(package)_ Bump the version to 2.2.5 156 | - _(package)_ Bump version 2.2.6 157 | - _(package)_ Bump version to 2.3.0 158 | - Add hoist-non-react-statics dependency 159 | - Add `hoist-non-react-statics` dependency 160 | - Bump version to 2.4.0 161 | - Bump version to 2.4.1 162 | - Lint 163 | - _(package)_ Bump version 164 | - _(package)_ Update version 165 | - Add travis 166 | - Upgrade packages 167 | - More pkg upgrades 168 | - Fix a lint issue 169 | - Upgrade expo to v34 170 | - _(travis)_ Run deploy on master 171 | - _(package)_ Bump version to 2.4.8 172 | 173 | ### Example 174 | 175 | - _(App)_ Trigger tutorial on componentDidMount 176 | - _(App)_ Added an example for the event emitter 177 | - Added the active flag to the example 178 | 179 | 180 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | Issues and Pull Requests are always welcome. 2 | 3 | Please read OK Grow's global [contribution guidelines](https://github.com/okgrow/guides/blob/master/docs/OpenSource-Contributing.md). 4 | 5 | If you are interested in becoming a maintainer, get in touch with us by sending an email or opening an issue. You should already have code merged into the project. Active contributors are encouraged to get in touch. 6 | 7 | Please note that all interactions in @okgrow's repos should follow our [Code of Conduct](https://github.com/okgrow/guides/blob/master/docs/OpenSource-CodeOfConduct.md). 8 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 OK GROW! 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 |
18 | Step-by-step walkthrough for your react native app! 19 |
20 | 21 |
22 |
23 |
26 | 27 | Demo 28 | 29 |
30 | 31 | ## Installation 32 | 33 | ``` 34 | yarn add react-native-copilot 35 | 36 | # or with npm: 37 | 38 | npm install --save react-native-copilot 39 | ``` 40 | 41 | **Optional**: If you want to have the smooth SVG animation, you should install and link [`react-native-svg`](https://github.com/software-mansion/react-native-svg). 42 | 43 | ## Usage 44 | 45 | Wrap the portion of your app that you want to use copilot with inside `(options: CopilotOptions) { 22 | return (WrappedComponent: ComponentType) => { 23 | const OuterComponent: FunctionComponent
= (props) => {
24 | const InnerComponentWithCopilotContext =
25 | ComponentWithCopilotContext(WrappedComponent);
26 |
27 | return (
28 | (
10 | WrappedComponent: React.ComponentType ,
11 | ) {
12 | const Component: FunctionComponent = (props: P) => {
13 | const { copilot, ...rest } = props as { copilot: CopilotType } & P;
14 | return