├── .circleci └── config.yml ├── .gitignore ├── LICENSE ├── README.md ├── RELEASE_NOTES.md ├── index.js ├── package-lock.json ├── package.json └── template ├── .circleci └── config.yml ├── .dockerignore ├── .editorconfig ├── .eslintignore ├── .eslintrc ├── .gitattributes ├── .github └── issue_template.md ├── .prettierrc ├── LICENSE ├── README.md ├── RELEASE_NOTES.md ├── android ├── build.gradle ├── src │ └── main │ │ ├── AndroidManifest.xml │ │ └── kotlin │ │ └── {{packageCase githubUsername}} │ │ └── {{packageCase packageName}} │ │ ├── component-template │ │ ├── {{lazyPascalCaseComponentName}}.kt │ │ └── {{lazyPascalCaseComponentName}}Manager.kt │ │ ├── jetpack-compose-component-template │ │ ├── {{lazyPascalCaseComponentName}}.kt │ │ ├── {{lazyPascalCaseComponentName}}Manager.kt │ │ └── {{lazyPascalCaseComponentName}}Proxy.kt │ │ ├── litho-component-template │ │ ├── {{lazyPascalCaseComponentName}}Manager.kt │ │ ├── {{lazyPascalCaseComponentName}}Proxy.kt │ │ └── {{lazyPascalCaseComponentName}}Spec.kt │ │ ├── module-template │ │ └── {{lazyPascalCaseModuleName}}.kt │ │ └── {{pascalCase packageName}}Package.kt └── {{gitignore}} ├── example ├── .gitattributes ├── .watchmanconfig ├── Dockerfile ├── README.md ├── android │ ├── app │ │ ├── build.gradle │ │ ├── debug.keystore │ │ ├── proguard-rules.pro │ │ └── src │ │ │ ├── debug │ │ │ ├── AndroidManifest.xml │ │ │ └── java │ │ │ │ └── com │ │ │ │ └── {{packageCase appName}} │ │ │ │ └── ReactNativeFlipper.java │ │ │ └── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── assets │ │ │ └── .gitkeep │ │ │ ├── java │ │ │ └── com │ │ │ │ └── {{packageCase appName}} │ │ │ │ ├── MainActivity.java │ │ │ │ └── MainApplication.java │ │ │ └── res │ │ │ ├── mipmap-hdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-mdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ └── values │ │ │ ├── strings.xml │ │ │ └── styles.xml │ ├── build.gradle │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── gradlew │ ├── gradlew.bat │ ├── settings.gradle │ └── {{gitignore}} ├── app.json ├── babel.config.js ├── index.js ├── ios │ ├── Podfile │ ├── empty.swift │ ├── {{appName}}-Bridging-Header.h │ ├── {{appName}}.xcodeproj │ │ ├── project.pbxproj │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ └── {{appName}}.xcscheme │ ├── {{appName}}.xcworkspace │ │ └── contents.xcworkspacedata │ ├── {{appName}} │ │ ├── AppDelegate.h │ │ ├── AppDelegate.m │ │ ├── Base.lproj │ │ │ └── LaunchScreen.xib │ │ ├── Images.xcassets │ │ │ ├── AppIcon.appiconset │ │ │ │ └── Contents.json │ │ │ └── Contents.json │ │ ├── Info.plist │ │ └── main.m │ ├── {{appName}}Tests │ │ ├── Info.plist │ │ ├── {{appName}}Tests-Bridging-Header.h │ │ ├── {{appName}}Tests.m │ │ └── {{appName}}Tests.swift │ └── {{gitignore}} ├── metro.config.js ├── src │ ├── App.tsx │ └── tsconfig.json ├── {{gitignore}} └── {{package}}.json ├── ios ├── .swiftlint.yml ├── UIImage+Color.h ├── UIImage+Color.m ├── UIImage+Color.swift ├── component-kit-component-template │ ├── {{objcPrefix}}{{lazyPascalCaseComponentName}}.h │ ├── {{objcPrefix}}{{lazyPascalCaseComponentName}}.mm │ ├── {{objcPrefix}}{{lazyPascalCaseComponentName}}Manager.h │ ├── {{objcPrefix}}{{lazyPascalCaseComponentName}}Manager.m │ ├── {{objcPrefix}}{{lazyPascalCaseComponentName}}Proxy.h │ └── {{objcPrefix}}{{lazyPascalCaseComponentName}}Proxy.mm ├── component-template │ ├── {{lazyPascalCaseComponentName}}.swift │ ├── {{lazyPascalCaseComponentName}}Manager.swift │ └── {{objcPrefix}}{{lazyPascalCaseComponentName}}Manager.m ├── module-template │ ├── {{lazyPascalCaseModuleName}}.swift │ ├── {{objcPrefix}}{{lazyPascalCaseModuleName}}.h │ └── {{objcPrefix}}{{lazyPascalCaseModuleName}}.m ├── swift-ui-component-template │ ├── {{lazyPascalCaseComponentName}}.swift │ ├── {{lazyPascalCaseComponentName}}Manager.swift │ ├── {{lazyPascalCaseComponentName}}Proxy.swift │ └── {{objcPrefix}}{{lazyPascalCaseComponentName}}Manager.m ├── {{gitignore}} ├── {{objcPrefix}}Defines.h ├── {{objcPrefix}}{{pascalCase packageName}}.xcodeproj │ └── project.pbxproj └── {{objcPrefix}}{{pascalCase packageName}}Umbrella.h ├── src ├── component-template │ ├── component.tsx │ ├── index.ts │ └── native-component.ts ├── index.ts ├── module-template │ ├── index.ts │ ├── module.ts │ └── native-module.ts └── tsconfig.json ├── {{gitignore}} ├── {{packageName}}.podspec └── {{package}}.json /.circleci/config.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | jobs: 3 | lint: 4 | docker: 5 | - image: circleci/node:12.16.1 6 | working_directory: ~/repo 7 | 8 | steps: 9 | - checkout 10 | 11 | - run: npm i 12 | - run: npm run ci:lint 13 | 14 | test-ts: 15 | docker: 16 | - image: circleci/node:12.16.1 17 | working_directory: ~/repo 18 | 19 | steps: 20 | - checkout 21 | 22 | - run: npm i 23 | - run: npm run test:scaffold:default 24 | - run: npm run test:ts 25 | - run: npm run test:cleanup 26 | 27 | test-kotlin-default: 28 | docker: 29 | - image: circleci/android:api-28-node 30 | environment: 31 | JVM_OPTS: -Xmx3200m 32 | working_directory: ~/repo 33 | 34 | steps: 35 | - checkout 36 | 37 | - run: npm i 38 | - run: npm run test:scaffold:default 39 | - run: npm run test:kotlin 40 | - run: npm run test:cleanup 41 | 42 | test-kotlin-jetpack-compose: 43 | docker: 44 | - image: circleci/android:api-29-node 45 | environment: 46 | JVM_OPTS: -Xmx3200m 47 | working_directory: ~/repo 48 | 49 | steps: 50 | - checkout 51 | 52 | - run: npm i 53 | - run: npm run test:scaffold:jetpack-compose 54 | - run: npm run test:kotlin 55 | - run: npm run test:cleanup 56 | 57 | test-kotlin-litho: 58 | docker: 59 | - image: circleci/android:api-28-node 60 | environment: 61 | JVM_OPTS: -Xmx3200m 62 | working_directory: ~/repo 63 | 64 | steps: 65 | - checkout 66 | 67 | - run: npm i 68 | - run: npm run test:scaffold:litho 69 | - run: npm run test:kotlin 70 | - run: npm run test:cleanup 71 | 72 | test-swift-default: 73 | macos: 74 | xcode: "11.5.0" 75 | working_directory: /Users/distiller/project 76 | 77 | steps: 78 | - checkout 79 | 80 | - run: npm i 81 | - run: npm run test:scaffold:default 82 | - run: npm run test:swift 83 | - run: npm run test:cleanup 84 | 85 | test-swift-swift-ui: 86 | macos: 87 | xcode: "11.5.0" 88 | working_directory: /Users/distiller/project 89 | 90 | steps: 91 | - checkout 92 | 93 | - run: npm i 94 | - run: npm run test:scaffold:swift-ui 95 | - run: npm run test:swift 96 | - run: npm run test:cleanup 97 | 98 | test-objc-component-kit: 99 | macos: 100 | xcode: "11.5.0" 101 | working_directory: /Users/distiller/project 102 | 103 | steps: 104 | - checkout 105 | 106 | - run: npm i 107 | - run: npm run test:scaffold:component-kit 108 | - run: npm run test:objc 109 | - run: npm run test:cleanup 110 | 111 | publish: 112 | docker: 113 | - image: circleci/node:12.16.1 114 | 115 | steps: 116 | - checkout 117 | 118 | - run: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc 119 | - run: npm publish 120 | 121 | 122 | workflows: 123 | version: 2 124 | package: 125 | jobs: 126 | - lint: 127 | filters: 128 | tags: 129 | only: /.*/ 130 | 131 | - test-ts: 132 | filters: 133 | tags: 134 | only: /.*/ 135 | 136 | - test-kotlin-default: 137 | filters: 138 | tags: 139 | only: /.*/ 140 | 141 | - test-swift-default: 142 | filters: 143 | tags: 144 | only: /.*/ 145 | 146 | - test-kotlin-jetpack-compose: 147 | filters: 148 | tags: 149 | only: /.*/ 150 | 151 | - test-swift-swift-ui: 152 | filters: 153 | tags: 154 | only: /.*/ 155 | 156 | - test-kotlin-litho: 157 | filters: 158 | tags: 159 | only: /.*/ 160 | 161 | - test-objc-component-kit: 162 | filters: 163 | tags: 164 | only: /.*/ 165 | 166 | - publish: 167 | requires: 168 | - lint 169 | - test-ts 170 | - test-kotlin-default 171 | - test-swift-default 172 | - test-kotlin-jetpack-compose 173 | - test-swift-swift-ui 174 | - test-kotlin-litho 175 | - test-objc-component-kit 176 | filters: 177 | tags: 178 | only: /^v.*/ 179 | branches: 180 | ignore: /.*/ 181 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | lerna-debug.log* 8 | 9 | # Diagnostic reports (https://nodejs.org/api/report.html) 10 | report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json 11 | 12 | # Runtime data 13 | pids 14 | *.pid 15 | *.seed 16 | *.pid.lock 17 | 18 | # Directory for instrumented libs generated by jscoverage/JSCover 19 | lib-cov 20 | 21 | # Coverage directory used by tools like istanbul 22 | coverage 23 | *.lcov 24 | 25 | # nyc test coverage 26 | .nyc_output 27 | 28 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) 29 | .grunt 30 | 31 | # Bower dependency directory (https://bower.io/) 32 | bower_components 33 | 34 | # node-waf configuration 35 | .lock-wscript 36 | 37 | # Compiled binary addons (https://nodejs.org/api/addons.html) 38 | build/Release 39 | 40 | # Dependency directories 41 | node_modules/ 42 | jspm_packages/ 43 | 44 | # TypeScript v1 declaration files 45 | typings/ 46 | 47 | # TypeScript cache 48 | *.tsbuildinfo 49 | 50 | # Optional npm cache directory 51 | .npm 52 | 53 | # Optional eslint cache 54 | .eslintcache 55 | 56 | # Optional REPL history 57 | .node_repl_history 58 | 59 | # Output of 'npm pack' 60 | *.tgz 61 | 62 | # Yarn Integrity file 63 | .yarn-integrity 64 | 65 | # dotenv environment variables file 66 | .env 67 | .env.test 68 | 69 | # parcel-bundler cache (https://parceljs.org/) 70 | .cache 71 | 72 | # next.js build output 73 | .next 74 | 75 | # nuxt.js build output 76 | .nuxt 77 | 78 | # vuepress build output 79 | .vuepress/dist 80 | 81 | # Serverless directories 82 | .serverless/ 83 | 84 | # FuseBox cache 85 | .fusebox/ 86 | 87 | # DynamoDB Local files 88 | .dynamodb/ 89 | 90 | react-native-* 91 | 92 | .ionide 93 | .vscode 94 | mock-package 95 | example_old 96 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019-2020 iyegoroff 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 | # make-react-native-package 2 | [![npm version](https://badge.fury.io/js/make-react-native-package.svg)](https://badge.fury.io/js/make-react-native-package) 3 | [![CircleCI](https://circleci.com/gh/iyegoroff/make-react-native-package.svg?style=svg)](https://circleci.com/gh/iyegoroff/make-react-native-package) 4 | [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](https://github.com/standard/standard) 5 | [![Dependency Status](https://david-dm.org/iyegoroff/make-react-native-package.svg)](https://david-dm.org/iyegoroff/make-react-native-package) 6 | [![devDependencies Status](https://david-dm.org/iyegoroff/make-react-native-package/dev-status.svg)](https://david-dm.org/iyegoroff/make-react-native-package?type=dev) 7 | [![npm](https://img.shields.io/npm/l/express.svg)](https://www.npmjs.com/package/make-react-native-package) 8 | 9 | CLI tool for bootstrapping react-native packages with Kotlin & Swift & Typescript 10 | 11 | ## About 12 | 13 | - CLI tool: 14 | - single command to scaffold a monorepo with package itself and ready-to-run example app 15 | - can create any amount of dummy native components and modules inside same package 16 | - has multiple component templates 17 | - versioning doesn't follow 'semver', major and minor numbers match the ones from specific version of react‑native whose project template is used by MRNP 18 | - Bootstrapped package: 19 | - supports `iOS` & `Android` & react-native ">= 0.60.0" 20 | - contains (absolutely optional) basic CI setup: CircleCI -> lint & build -> npm 21 | - has setup instructions for package end-users in generated `README.md` files 22 | - includes a `Dockerfile` for creating a release example `.apk` in 'neutral' environment 23 | 24 | ## Getting started 25 | 26 | ``` 27 | $ npx make-react-native-package -p react-native-cool-component --githubUsername cool-github-user 28 | ``` 29 | 30 | ## Usage guide 31 | 32 | ``` 33 | $ npx make-react-native-package --help 34 | ``` 35 | 36 |
 37 | Usage
 38 | 
 39 |   $ make-react-native-package <--packageName name> <--githubUsername user> ...
 40 | 
 41 | Required options
 42 | 
 43 |   -p, --packageName string      The name of project folder, github repo and npm package
 44 |   -g, --githubUsername string   Your github username
 45 | 
 46 | Options
 47 | 
 48 |   -h, --help                   Print this usage guide
 49 |   -a, --appName string         Example app name
 50 |   -o, --objcPrefix string      Objective-C file prefix
 51 |   -c, --components string[]    List of space-separated native component names
 52 |   -m, --modules string[]       List of space-separated native module names
 53 |   -d, --description string     Package description
 54 |   -n, --npmUsername string     Your npm username
 55 |   -e, --email string           Your npm email
 56 |   -w, --withoutConfirmation    Skip confirmation prompt
 57 |   -s, --skipInstall            Skip dependency installation
 58 |   -t, --templates string[]     List of space-separated component templates:
 59 |                                ios:default - default Swift template
 60 |                                android:default - default Kotlin template
 61 |                                ios:swift-ui - SwiftUI component template
 62 |                                android:jetpack-compose - Jetpack Compose component template
 63 |                                ios:component-kit - ComponentKit Objective-C++ component template
 64 |                                android:litho - Litho Kotlin component template
 65 | 
 66 | Example
 67 | 
 68 |   $ make-react-native-package --packageName react-native-cool-component
 69 |     --githubUsername octocat --appName CoolExample --objcPrefix RNCC
 70 |     --description "Cool description" --npmUsername wombat --email me@mail.org
 71 |     --templates ios:swift-ui android:jetpack-compose
 72 | 
73 | 74 | ## Workflow 75 | 76 | ### Installation 77 | 78 | Usually no additional steps required after bootstrapping a package. However, if you have skipped dependency installation with --skipInstall option you can setup everything later by running `npm run init:package` from package root folder. 79 | 80 | ### Development 81 | 82 | Generated folder contains the package itself in the root and the sample app inside `./example` folder. 83 | Example app imports package dependency locally as a `file:..` symlink, so all changes inside the root folder will be available for a running app and editors/IDEs immediately. 84 | 85 | To watch on Typescript sources changes you have to run `npm run watch` commands from both root and `./example` folders. Most of 'development' commands are located in `./example/package.json` scripts section, and `watch` script from `./package.json` probably is the only common 'development' command in the root folder. 86 | 87 | To open a project in `Xcode` go to `./example/ios` folder and open `.xcworkspace` file, package `Swift` sources should be found inside `Pods > Development Pods > {{packageName}}` group in project navigator. 88 | 89 | To open a project from `Android Studio` 'welcome to' window press `Import project` and open `./example/android` folder, after `gradle` sync task completes package `Kotlin` sources should be found inside `{{packageName}} > java` group in project tool window. 90 | 91 | To build native code and run sample app on device/simulator just use standard react-native 'run' commands or 'run' buttons from `Xcode`/`Android Studio`. 92 | 93 | ### Publishing 94 | 95 | There are two options: publishing from local machine or publishing from CircleCI. 96 | 97 | To publish from a local machine just run `npm version && npm publish` from package root folder. It will run linters and build Typescript sources in `preversion` hook and push changes and git tags to a remote repo in `postversion` hook. Then if everything succeed, the package will be published to npm. 98 | 99 | If you have an account on CircleCI you can use it for publishing a package when git tags are being pushed to a remote repo. Note that before enabling your package in CircleCI dashboard you should either ask their support for [macOS plan](https://circleci.com/pricing/#faq-section-linux) (it is free for open-source projects) or remove `test-ios` job related code from `.circleci/config.yml` file. Also you have to set `NPM_TOKEN` environment variable in CircleCI dashboard project settings - this token can be created directly on [npmjs.com](https://npmjs.com) or imported from your other CircleCI project. When everything is ready run `npm version -m "%s [skip ci]"` to initiate just `publish` job on CircleCI without triggering surplus `test-ios` & `test-android` jobs because of master branch changes. It won't only lint sources and build Typescript, but also will check that native code compiles (this can take some time). After both `test-ios` and `test-android` jobs succeed the `publish` job will be triggered. 100 | 101 | ## Created with MRNP 102 | 103 | - [iyegoroff/react-native-multi-segmented-control](https://github.com/iyegoroff/react-native-multi-segmented-control) 104 | 105 | Packages that were bootstrapped with MRNP most likely will contain `Bootstrapped with make-react-native-package` string marker in their `README.md` files, so they could be easily found with Github search. 106 | 107 | ## Credits 108 | 109 | - `SwiftUI` component template is based on [this approach](https://github.com/Kureev/ReactNativeWithSwiftUITutorial) by @Kureev 110 | -------------------------------------------------------------------------------- /RELEASE_NOTES.md: -------------------------------------------------------------------------------- 1 | [release notes](https://github.com/iyegoroff/make-react-native-package/releases) 2 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | const path = require('path') 4 | const { spawn } = require('child_process') 5 | const { promisify } = require('util') 6 | const commandLineArgs = require('command-line-args') 7 | const commandLineUsage = require('command-line-usage') 8 | const { pascalCase, paramCase, camelCase, snakeCase } = require('change-case') 9 | const { lowerCase } = require('lower-case') 10 | const copy = require('recursive-copy') 11 | const through = require('through2') 12 | const Confirm = require('prompt-confirm') 13 | const Handlebars = require('handlebars') 14 | const rimraf = require('rimraf') 15 | const chalk = require('chalk') 16 | const randomColor = require('randomcolor') 17 | 18 | const { version: mrnpVersion } = require('./package.json') 19 | const { dependencies } = require('./template/example/{{package}}.json') 20 | const rnVersion = dependencies['react-native'] 21 | 22 | const availableTemplates = [ 23 | ['ios:default', 'default Swift template'], 24 | ['android:default', 'default Kotlin template'], 25 | ['ios:swift-ui', 'SwiftUI component template'], 26 | ['android:jetpack-compose', 'Jetpack Compose component template'], 27 | ['ios:component-kit', 'ComponentKit Objective-C++ component template'], 28 | ['android:litho', 'Litho Kotlin component template'] 29 | ] 30 | 31 | const del = promisify(rimraf) 32 | 33 | const packageCase = (input) => lowerCase(camelCase(input)) 34 | 35 | Handlebars.registerHelper({ 36 | pascalCase, 37 | paramCase, 38 | packageCase, 39 | randomColor, 40 | snakeCase 41 | }) 42 | 43 | const sections = [ 44 | { 45 | header: 'Usage', 46 | content: 47 | '$ make-react-native-package <{bold --packageName} {underline name}> ' + 48 | '<{bold --githubUsername} {underline user}> ...' 49 | }, 50 | { 51 | header: 'Required options', 52 | optionList: [ 53 | { 54 | name: 'packageName', 55 | alias: 'p', 56 | description: 'The name of project folder, github repo and npm package' 57 | }, 58 | { 59 | name: 'githubUsername', 60 | alias: 'g', 61 | description: 'Your github username' 62 | } 63 | ] 64 | }, 65 | { 66 | header: 'Options', 67 | optionList: [ 68 | { 69 | name: 'help', 70 | alias: 'h', 71 | type: Boolean, 72 | description: 'Print this usage guide' 73 | }, 74 | { 75 | name: 'appName', 76 | alias: 'a', 77 | description: 'Example app name' 78 | }, 79 | { 80 | name: 'objcPrefix', 81 | alias: 'o', 82 | description: 'Objective-C file prefix' 83 | }, 84 | { 85 | name: 'components', 86 | alias: 'c', 87 | multiple: true, 88 | description: 'List of space-separated native component names' 89 | }, 90 | { 91 | name: 'modules', 92 | alias: 'm', 93 | multiple: true, 94 | description: 'List of space-separated native module names' 95 | }, 96 | { 97 | name: 'description', 98 | alias: 'd', 99 | description: 'Package description' 100 | }, 101 | { 102 | name: 'npmUsername', 103 | alias: 'n', 104 | description: 'Your npm username' 105 | }, 106 | { 107 | name: 'email', 108 | alias: 'e', 109 | description: 'Your npm email' 110 | }, 111 | { 112 | name: 'withoutConfirmation', 113 | alias: 'w', 114 | type: Boolean, 115 | description: 'Skip confirmation prompt' 116 | }, 117 | { 118 | name: 'skipInstall', 119 | alias: 's', 120 | type: Boolean, 121 | description: 'Skip dependency installation' 122 | }, 123 | { 124 | name: 'templates', 125 | alias: 't', 126 | multiple: true, 127 | description: 'List of space-separated component templates:\n' + 128 | availableTemplates.map(([name, desc]) => `{bold ${name}} - ${desc}`).join('\n') 129 | } 130 | ] 131 | }, 132 | { 133 | header: 'Example', 134 | content: [ 135 | '$ make-react-native-package ' + 136 | '{bold --packageName} {underline react-native-cool-component}', 137 | '{hidden }{bold --githubUsername} {underline octocat} ' + 138 | '{bold --appName} {underline CoolExample} ' + 139 | '{bold --objcPrefix} {underline RNCC}', 140 | '{hidden }{bold --description} {underline "Cool description"} ' + 141 | '{bold --npmUsername} {underline wombat} ' + 142 | '{bold --email} {underline me@mail.org}', 143 | '{hidden }{bold --templates} {underline ios:swift-ui android:jetpack-compose}' 144 | ] 145 | } 146 | ] 147 | 148 | const usage = commandLineUsage(sections) 149 | 150 | const optionDefinitions = sections.flatMap((s) => s.optionList || []) 151 | 152 | const { 153 | packageName, 154 | githubUsername, 155 | appName, 156 | objcPrefix, 157 | components, 158 | modules, 159 | description, 160 | npmUsername, 161 | email, 162 | withoutConfirmation, 163 | skipInstall, 164 | templates = [], 165 | help 166 | } = commandLineArgs(optionDefinitions) 167 | 168 | if (help) { 169 | console.log(usage) 170 | process.exit() 171 | } 172 | 173 | if (packageName === undefined) { 174 | console.log(chalk.bold.red('\nERROR: Skipped required `packageName` option!\n')) 175 | process.exit(1) 176 | } 177 | 178 | if (githubUsername === undefined) { 179 | console.log(chalk.bold.red('\nERROR: Skipped required `githubUsername` option!\n')) 180 | process.exit(1) 181 | } 182 | 183 | if (!templates.every(t => availableTemplates.map(([name]) => name).includes(t))) { 184 | console.log(chalk.bold.red('\nERROR: Specified unknown component template!\n')) 185 | process.exit(1) 186 | } 187 | 188 | for (const platform of ['ios', 'android']) { 189 | if (templates.reduce((acc, val) => val.startsWith(platform) ? acc + 1 : acc, 0) > 1) { 190 | console.log(chalk.bold.red(`\nERROR: Only one ${platform} template can be used!\n`)) 191 | process.exit(1) 192 | } 193 | } 194 | 195 | const packageMap = { 196 | packageName, 197 | githubUsername, 198 | appName: pascalCase(appName || `${packageName}Example`), 199 | objcPrefix: objcPrefix 200 | ? objcPrefix.toUpperCase() 201 | : pascalCase(packageName).replace(/[^A-Z]/g, ''), 202 | description: description || 'Yet another react-native package', 203 | email: email ? ` <${email}>` : '', 204 | npmUsername: npmUsername || githubUsername, 205 | modules: [...new Set(modules || [])], 206 | components: [ 207 | ...new Set( 208 | components || 209 | (modules ? [] : [pascalCase(packageName).replace('ReactNative', '')]) 210 | ) 211 | ], 212 | templates: [ 213 | ...templates, 214 | ...templates.some(t => t.startsWith('ios')) ? [] : ['ios:default'], 215 | ...templates.some(t => t.startsWith('android')) ? [] : ['android:default'] 216 | ] 217 | } 218 | 219 | const usesSwiftUI = templates.includes('ios:swift-ui') 220 | const usesJetpackCompose = templates.includes('android:jetpack-compose') 221 | const usesComponentKit = templates.includes('ios:component-kit') 222 | const usesLitho = templates.includes('android:litho') 223 | 224 | const componentMaps = packageMap.components.map((componentName) => ({ 225 | componentName 226 | })) 227 | 228 | const moduleMaps = packageMap.modules.map((moduleName) => ({ moduleName })) 229 | 230 | const miscMap = { 231 | package: 'package', 232 | gitignore: '.gitignore', 233 | mrnpVersion, 234 | rnVersion, 235 | kotlinVersion: '1.3.72', 236 | composeVersion: '0.1.0-dev13', 237 | lithoVersion: '0.36.0', 238 | composeKotlinCompilerVersion: '1.3.70-dev-withExperimentalGoogleExtensions-20200424', 239 | usesSwiftUI, 240 | usesJetpackCompose, 241 | usesComponentKit, 242 | usesLitho, 243 | compileSdkVersion: usesJetpackCompose ? '29' : '28', 244 | targetSdkVersion: usesJetpackCompose ? '29' : '28', 245 | buildToolsVersion: usesJetpackCompose ? '29.0.2' : '28.0.3', 246 | minSdkVersion: usesJetpackCompose ? '21' : '16', 247 | buildToolsPluginVersion: usesJetpackCompose ? '4.2.0-alpha02' : '3.5.2', 248 | gradleWrapperVersion: usesJetpackCompose ? '6.5-rc-1' : '6.0.1', 249 | iosVersion: usesSwiftUI ? '13.0' : '9.0', 250 | currentYear: `${new Date().getFullYear()}`, 251 | lazyPascalCaseComponentName: '{{pascalCase componentName}}', 252 | lazyParamCaseComponentName: '{{paramCase componentName}}', 253 | lazyPackageCaseComponentName: '{{packageCase componentName}}', 254 | lazyPascalCaseModuleName: '{{pascalCase moduleName}}', 255 | lazyParamCaseModuleName: '{{paramCase moduleName}}', 256 | lazyPackageCaseModuleName: '{{packageCase moduleName}}' 257 | } 258 | 259 | const transform = (map) => (data) => Handlebars.compile(data)(map) 260 | 261 | const copyOptions = (map) => ({ 262 | overwrite: true, 263 | dot: true, 264 | rename: transform(map), 265 | 266 | transform: function (src) { 267 | const skipTransform = ['.png', '.jar', '.keystore'].includes( 268 | path.extname(src) 269 | ) 270 | 271 | return ( 272 | !skipTransform && 273 | through(function (chunk, enc, done) { 274 | try { 275 | done(null, transform(map)(chunk.toString())) 276 | } catch (e) { 277 | console.log(e, src) 278 | } 279 | }) 280 | ) 281 | } 282 | }) 283 | 284 | const packagePath = `${process.cwd()}/${packageMap.packageName}` 285 | const androidSourcesPath = 286 | `${packagePath}/android/src/main/kotlin/` + 287 | `${packageCase(packageMap.githubUsername)}/${packageCase( 288 | packageMap.packageName 289 | )}` 290 | const iosSourcesPath = `${packagePath}/ios` 291 | const typescriptSourcesPath = `${packagePath}/src` 292 | 293 | console.log(`\nUsing project template from react-native ${rnVersion}`) 294 | console.log('\nConfiguration:\n') 295 | console.log(packageMap) 296 | console.log() 297 | 298 | const copyTemplates = async (src, map, name) => { 299 | const options = copyOptions(map) 300 | 301 | await copy( 302 | `${androidSourcesPath}/${src.android || src}`, 303 | `${androidSourcesPath}/${packageCase(name)}`, 304 | options 305 | ) 306 | 307 | await copy( 308 | `${iosSourcesPath}/${src.ios || src}`, 309 | `${iosSourcesPath}/${pascalCase(name)}`, 310 | options 311 | ) 312 | 313 | await copy( 314 | `${typescriptSourcesPath}/${src.js || src}`, 315 | `${typescriptSourcesPath}/${pascalCase(name)}`, 316 | options 317 | ) 318 | } 319 | 320 | const done = () => { 321 | console.log( 322 | chalk.green.bold(`\nSuccessfully bootstrapped ${packageName} package!\n`) 323 | ) 324 | } 325 | 326 | const removeContextDependentFiles = async () => { 327 | if (!usesSwiftUI) { 328 | await del(`${packagePath}/ios/${packageMap.objcPrefix}Defines.h`) 329 | } 330 | if (usesComponentKit) { 331 | await del(`${packagePath}/ios/*Umbrella.h`) 332 | await del(`${packagePath}/ios/.swiftlint.yml`) 333 | await del(`${packagePath}/**/*.swift`) 334 | await del(`${packagePath}/**/*-Bridging-Header.h`) 335 | } else { 336 | await del(`${packagePath}/ios/UIImage+Color.?`) 337 | await del(`${packagePath}/example/ios/${packageMap.appName}Tests/*Tests.m`) 338 | await del(`${packagePath}/ios/*/*.h`) 339 | } 340 | } 341 | 342 | const makePackage = async () => { 343 | await copy( 344 | `${__dirname}/template`, 345 | packagePath, 346 | copyOptions({ ...packageMap, ...miscMap }) 347 | ) 348 | 349 | await Promise.all( 350 | componentMaps.map(async (map) => 351 | copyTemplates( 352 | { 353 | ios: usesSwiftUI 354 | ? 'swift-ui-component-template' 355 | : usesComponentKit 356 | ? 'component-kit-component-template' 357 | : 'component-template', 358 | android: usesJetpackCompose 359 | ? 'jetpack-compose-component-template' 360 | : usesLitho 361 | ? 'litho-component-template' 362 | : 'component-template', 363 | js: 'component-template' 364 | }, 365 | map, 366 | map.componentName 367 | ) 368 | ) 369 | ) 370 | 371 | await Promise.all( 372 | moduleMaps.map(async (map) => 373 | copyTemplates('module-template', map, map.moduleName) 374 | ) 375 | ) 376 | 377 | await del(`${packagePath}/**/*-template`) 378 | 379 | await removeContextDependentFiles() 380 | 381 | if (!skipInstall) { 382 | await new Promise((resolve) => { 383 | spawn('npm', ['run', 'init:package'], { 384 | stdio: 'inherit', 385 | cwd: packageName 386 | }).on('close', (code) => { 387 | if (code === 0) { 388 | done() 389 | } 390 | 391 | resolve(code) 392 | }) 393 | }) 394 | } else { 395 | done() 396 | 397 | console.log( 398 | 'You can run `npm run init:package` from your package root folder to install dependencies ' + 399 | 'later.\n' 400 | ) 401 | } 402 | } 403 | 404 | if (withoutConfirmation) { 405 | makePackage() 406 | } else { 407 | const prompt = new Confirm('Is this OK?') 408 | prompt.ask(async (answer) => { 409 | if (answer) { 410 | await makePackage() 411 | } 412 | }) 413 | } 414 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "make-react-native-package", 3 | "version": "0.62.18", 4 | "description": "CLI tool for bootstrapping react-native packages with Kotlin & Swift & Typescript", 5 | "main": "index.js", 6 | "bin": "index.js", 7 | "scripts": { 8 | "lint": "npm run ci:lint -- --fix", 9 | "ci:lint": "standard './index.js'", 10 | "preversion": "npm run lint && git add -u && git commit -am lint || :", 11 | "postversion": "git push && git push --tags", 12 | "test:scaffold:default": "./index.js -p mock-package -g mock-user -w -c FakeComponent component-doodle -m falseModule dummy_module", 13 | "test:scaffold:swift-ui": "./index.js -p mock-package -g mock-user -w -t ios:swift-ui", 14 | "test:scaffold:jetpack-compose": "./index.js -p mock-package -g mock-user -w -t android:jetpack-compose", 15 | "test:scaffold:component-kit": "./index.js -p mock-package -g mock-user -w -c comp -m mod -t ios:component-kit", 16 | "test:scaffold:litho": "./index.js -p mock-package -g mock-user -w -t android:litho", 17 | "test:cleanup": "rm -rf mock-package", 18 | "test:ts": "cd mock-package && npm run ci:build && npm run ci:lint:ts", 19 | "test:kotlin": "cd mock-package && npm run ci:lint:kotlin && npm run ci:compile:android", 20 | "test:swift": "cd mock-package && npm run ci:lint:swift && npm run ci:compile:ios", 21 | "test:objc": "cd mock-package && npm run ci:compile:ios" 22 | }, 23 | "keywords": [ 24 | "react-native", 25 | "scaffold", 26 | "swift", 27 | "kotlin", 28 | "swift-ui", 29 | "jetpack-compose", 30 | "component-kit", 31 | "litho" 32 | ], 33 | "author": "iyegoroff ", 34 | "license": "MIT", 35 | "bugs": { 36 | "url": "https://github.com/iyegoroff/make-react-native-package/issues" 37 | }, 38 | "homepage": "https://github.com/iyegoroff/make-react-native-package#readme", 39 | "repository": { 40 | "type": "git", 41 | "url": "git+https://github.com/iyegoroff/make-react-native-package.git" 42 | }, 43 | "dependencies": { 44 | "chalk": "^4.0.0", 45 | "change-case": "^4.1.1", 46 | "command-line-args": "^5.1.1", 47 | "command-line-usage": "^6.1.0", 48 | "handlebars": "^4.7.6", 49 | "lower-case": "^2.0.1", 50 | "prompt-confirm": "^2.0.4", 51 | "randomcolor": "^0.5.4", 52 | "recursive-copy": "^2.0.10", 53 | "rimraf": "^3.0.2", 54 | "through2": "^3.0.1" 55 | }, 56 | "devDependencies": { 57 | "standard": "^14.3.3" 58 | }, 59 | "standard": { 60 | "ignore": [ 61 | "template/*" 62 | ] 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /template/.circleci/config.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | jobs: 3 | test-android: 4 | docker: 5 | - image: circleci/android:api-{{compileSdkVersion}}-node 6 | environment: 7 | JVM_OPTS: -Xmx3200m 8 | working_directory: ~/repo 9 | 10 | steps: 11 | - checkout 12 | 13 | - run: npm run ci:build 14 | - run: npm run ci:lint:ts 15 | - run: npm run ci:lint:kotlin 16 | - run: npm run ci:compile:android 17 | 18 | - persist_to_workspace: 19 | root: . 20 | paths: 21 | - dist/* 22 | 23 | test-ios: 24 | macos: 25 | xcode: "11.5.0" 26 | working_directory: /Users/distiller/project 27 | 28 | steps: 29 | - checkout 30 | 31 | - run: sudo gem install cocoapods 32 | - run: npm run ci:build 33 | - run: cd example && npm run install:pods 34 | {{#unless usesComponentKit}} 35 | - run: npm run ci:lint:swift 36 | {{/unless}} 37 | - run: npm run ci:compile:ios 38 | 39 | publish: 40 | docker: 41 | - image: circleci/node:12.16.1 42 | 43 | steps: 44 | - checkout 45 | 46 | - attach_workspace: 47 | at: . 48 | - run: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc 49 | - run: npm publish 50 | 51 | workflows: 52 | version: 2 53 | test: 54 | jobs: 55 | - test-android: 56 | filters: 57 | tags: 58 | only: /.*/ 59 | 60 | - test-ios: 61 | filters: 62 | tags: 63 | only: /.*/ 64 | 65 | - publish: 66 | requires: 67 | - test-android 68 | - test-ios 69 | filters: 70 | tags: 71 | only: /^v.*/ 72 | branches: 73 | ignore: /.*/ 74 | -------------------------------------------------------------------------------- /template/.dockerignore: -------------------------------------------------------------------------------- 1 | **/node_modules 2 | .github 3 | .git 4 | img 5 | LICENSE 6 | README.md 7 | RELEASE_NOTES.md 8 | *.podspec 9 | **/*.md 10 | *.tgz 11 | **/.gitignore 12 | 13 | **/bin 14 | **/obj 15 | **/packages 16 | **/paket-files 17 | fable-typed/paket.* 18 | fable-typed/*.fsproj 19 | fable-typed/publish.js 20 | fable-typed/.paket 21 | 22 | **/android/build 23 | **/android/app/build 24 | **/android/app/src/main/assets/*.bundle 25 | **/android/local.properties 26 | **/.gradle 27 | **/.idea 28 | **/*.iml 29 | **/*.apk 30 | 31 | **/ios 32 | 33 | **/out 34 | 35 | **/infer-out 36 | **/compile_commands.json 37 | **/xcodebuild.log 38 | 39 | .circleci 40 | .github 41 | .ionide 42 | .vscode 43 | 44 | blueprint-templates 45 | docs 46 | -------------------------------------------------------------------------------- /template/.editorconfig: -------------------------------------------------------------------------------- 1 | [*] 2 | indent_size = 2 3 | indent_style = space 4 | insert_final_newline = true 5 | max_line_length = 100 6 | disabled_rules = import-ordering, no-wildcard-imports 7 | -------------------------------------------------------------------------------- /template/.eslintignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | dist 3 | build 4 | coverage 5 | -------------------------------------------------------------------------------- /template/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "root": true, 3 | "parser": "@typescript-eslint/parser", 4 | "parserOptions": { 5 | "project": [ 6 | "./src/tsconfig.json", 7 | "./example/src/tsconfig.json" 8 | ] 9 | }, 10 | "plugins": [ 11 | "@typescript-eslint", 12 | "prettier", 13 | "no-null" 14 | ], 15 | "extends": [ 16 | "@react-native-community", 17 | "standard-with-typescript", 18 | "plugin:react/recommended", 19 | "plugin:react-hooks/recommended", 20 | "prettier", 21 | "prettier/@typescript-eslint", 22 | "prettier/standard", 23 | "prettier/react" 24 | ], 25 | "rules": { 26 | "no-param-reassign": "error", 27 | "no-shadow": "error", 28 | "prettier/prettier": "warn", 29 | "no-null/no-null": "error", 30 | "@typescript-eslint/ban-types": ["error", { "types": { "null": null } }], 31 | "@typescript-eslint/no-explicit-any": "error", 32 | "@typescript-eslint/no-non-null-assertion": "error", 33 | "@typescript-eslint/ban-ts-comment": "error", 34 | "@typescript-eslint/switch-exhaustiveness-check": "error", 35 | "@typescript-eslint/consistent-type-definitions": ["error", "type"], 36 | "@typescript-eslint/explicit-function-return-type": "off", 37 | "@typescript-eslint/space-before-function-paren": ["warn", "never"] 38 | }, 39 | "settings": { 40 | "react": { 41 | "version": "16.9.0" 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /template/.gitattributes: -------------------------------------------------------------------------------- 1 | *.pbxproj -text -------------------------------------------------------------------------------- /template/.github/issue_template.md: -------------------------------------------------------------------------------- 1 | - Please specify your mobile platform(s) and react-native & {{packageName}} versions. Also check https://github.com/{{githubUsername}}/{{packageName}}#status if your {{packageName}} version corresponds with your rn version and ensure that you followed this installation guide - https://github.com/{{githubUsername}}/{{packageName}}#installation 2 | 3 | - Sometimes cleaning the project could resolve build issues: press `Shift + Cmd + K` in Xcode and run `cd android && ./gradlew clean` in terminal 4 | 5 | - In case you use Expo you have to switch to 'bare workflow' in order to use this module 6 | 7 | - If your app crashed due to {{packageName}}, please attach a crash log or provide a minimal repro 8 | -------------------------------------------------------------------------------- /template/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "semi": false, 3 | "singleQuote": true, 4 | "jsxSingleQuote": true, 5 | "trailingComma": "none", 6 | "printWidth": 100 7 | } 8 | -------------------------------------------------------------------------------- /template/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) {{currentYear}} {{githubUsername}} 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 | -------------------------------------------------------------------------------- /template/README.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | # {{packageName}} 4 | [![npm version](https://badge.fury.io/js/{{packageName}}.svg)](https://badge.fury.io/js/{{packageName}}) 5 | [![CircleCI](https://circleci.com/gh/{{githubUsername}}/{{packageName}}.svg?style=svg)](https://circleci.com/gh/{{githubUsername}}/{{packageName}}) 6 | [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](https://github.com/standard/standard) 7 | [![Dependency Status](https://david-dm.org/{{npmUsername}}/{{packageName}}.svg)](https://david-dm.org/{{npmUsername}}/{{packageName}}) 8 | [![devDependencies Status](https://david-dm.org/{{npmUsername}}/{{packageName}}/dev-status.svg)](https://david-dm.org/{{npmUsername}}/{{packageName}}?type=dev) 9 | [![typings included](https://img.shields.io/badge/typings-included-brightgreen.svg?t=1495378566925)](package.json) 10 | [![npm](https://img.shields.io/npm/l/express.svg)](https://www.npmjs.com/package/{{packageName}}) 11 | 12 | {{{description}}} 13 | 14 | ## Status 15 | 16 | - iOS & Android: 17 | - ??? 18 | - react-native: 19 | - supported versions ">= {{rnVersion}}" 20 | 21 | ## Installation 22 | 23 | 24 | 109 |
25 |
26 | with react-native ">={{rnVersion}}" 27 | 28 | ### 0. Setup Swift and Kotlin 29 | 30 | - Open your iOS project in Xcode and create empty Swift file and bridging header to enable Swift support 31 | {{#if usesSwiftUI}} 32 | - Remove `"\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)\""`, line from `LIBRARY_SEARCH_PATHS` in `project.pbxproj` file. 33 | {{/if}} 34 | {{#if usesJetpackCompose}} 35 | - Modify `android/build.gradle`: 36 | 37 | ```diff 38 | buildscript { 39 | ext { 40 | - buildToolsVersion = "28.0.3" 41 | - minSdkVersion = 16 42 | - compileSdkVersion = 28 43 | - targetSdkVersion = 28 44 | + buildToolsVersion = "{{buildToolsVersion}}" 45 | + minSdkVersion = {{minSdkVersion}} 46 | + compileSdkVersion = {{compileSdkVersion}} 47 | + targetSdkVersion = {{targetSdkVersion}} 48 | + kotlinVersion = "{{kotlinVersion}}" 49 | + composeVersion = "{{composeVersion}}" 50 | + composeKotlinCompilerVersion = "{{composeKotlinCompilerVersion}}" 51 | } 52 | ... 53 | 54 | dependencies { 55 | - classpath("com.android.tools.build:gradle:3.5.2") 56 | + classpath("com.android.tools.build:gradle:{{buildToolsPluginVersion}}") 57 | + classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlinVersion}") 58 | ... 59 | ``` 60 | - Modify `android/gradle/wrapper/gradle-wrapper.properties`: 61 | 62 | ```diff 63 | - distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-all.zip 64 | + distributionUrl=https\://services.gradle.org/distributions/gradle-{{gradleWrapperVersion}}-all.zip 65 | ``` 66 | {{else}} 67 | - Modify `android/build.gradle`: 68 | 69 | ```diff 70 | buildscript { 71 | ext { 72 | ... 73 | + kotlinVersion = "{{kotlinVersion}}" 74 | {{#if usesLitho}} 75 | + lithoVersion = "{{lithoVersion}}" 76 | {{/if}} 77 | } 78 | ... 79 | 80 | dependencies { 81 | + classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlinVersion}") 82 | ... 83 | ``` 84 | {{#if usesLitho}} 85 | - Modify `android/app/build.gradle`: 86 | 87 | ```diff 88 | dependencies { 89 | ... 90 | + configurations.all { 91 | + exclude group: 'com.facebook.yoga', module: 'yoga' 92 | + exclude group: 'com.google.code.findbugs', module: 'jsr305' 93 | + } 94 | } 95 | ``` 96 | {{/if}} 97 | {{/if}} 98 | 99 | ### 1. Install latest version from npm 100 | 101 | `$ npm i {{packageName}} -S` 102 | 103 | ### 2. Install pods 104 | 105 | `$ cd ios && pod install && cd ..` 106 | 107 |
108 |
110 | 111 | ## Demo 112 | 113 | Android | iOS 114 | :---------------------------------------------:|:---------------------------------------------: 115 | ??? | ??? 116 | 117 | ## Example 118 | 119 | ```jsx 120 | import * as React from 'react' 121 | import { View } from 'react-native' 122 | import { 123 | {{#each modules}} 124 | {{pascalCase this}}, 125 | {{/each}} 126 | {{#each components}} 127 | {{pascalCase this}}{{#unless @last}},{{/unless}} 128 | {{/each}} 129 | } from '{{packageName}}' 130 | 131 | ``` 132 | 133 | ## Reference 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 |
proptypedefaultdesc
colorstring'red'-
149 | -------------------------------------------------------------------------------- /template/RELEASE_NOTES.md: -------------------------------------------------------------------------------- 1 | [release notes](https://github.com/{{githubUsername}}/{{packageName}}/releases) 2 | -------------------------------------------------------------------------------- /template/android/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: "com.android.library" 2 | apply plugin: "kotlin-android" 3 | {{#if usesLitho}} 4 | apply plugin: "kotlin-kapt" 5 | {{/if}} 6 | 7 | def _ext = rootProject.ext 8 | 9 | def _reactNativeVersion = _ext.has("reactNative") ? _ext.reactNative : "+" 10 | def _compileSdkVersion = _ext.has("compileSdkVersion") ? _ext.compileSdkVersion : {{compileSdkVersion}} 11 | def _buildToolsVersion = _ext.has("buildToolsVersion") ? _ext.buildToolsVersion : "{{buildToolsVersion}}" 12 | def _minSdkVersion = _ext.has("minSdkVersion") ? _ext.minSdkVersion : {{minSdkVersion}} 13 | def _targetSdkVersion = _ext.has("targetSdkVersion") ? _ext.targetSdkVersion : {{targetSdkVersion}} 14 | {{#if usesJetpackCompose}} 15 | def _composeVersion = _ext.has('composeVersion') ? _ext.composeVersion : "{{composeVersion}}" 16 | def _composeKotlinCompilerVersion = _ext.has('composeKotlinCompilerVersion') ? _ext.composeKotlinCompilerVersion : "{{composeKotlinCompilerVersion}}" 17 | {{else}} 18 | def _kotlinVersion = _ext.has("kotlinVersion") ? _ext.kotlinVersion : "{{kotlinVersion}}" 19 | {{/if}} 20 | {{#if usesLitho}} 21 | def _lithoVersion = _ext.has('lithoVersion') ? _ext.lithoVersion : "{{lithoVersion}}" 22 | {{/if}} 23 | 24 | android { 25 | compileSdkVersion _compileSdkVersion 26 | buildToolsVersion _buildToolsVersion 27 | 28 | compileOptions { 29 | sourceCompatibility JavaVersion.VERSION_1_8 30 | targetCompatibility JavaVersion.VERSION_1_8 31 | } 32 | 33 | sourceSets { 34 | main.java.srcDirs += "src/main/kotlin" 35 | } 36 | 37 | defaultConfig { 38 | minSdkVersion _minSdkVersion 39 | targetSdkVersion _targetSdkVersion 40 | versionCode 1 41 | versionName "1.0" 42 | } 43 | 44 | lintOptions { 45 | abortOnError false 46 | } 47 | {{#if usesJetpackCompose}} 48 | 49 | kotlinOptions { 50 | jvmTarget = "1.8" 51 | } 52 | 53 | buildFeatures { 54 | compose true 55 | } 56 | 57 | composeOptions { 58 | kotlinCompilerVersion "$_composeKotlinCompilerVersion" 59 | kotlinCompilerExtensionVersion "$_composeVersion" 60 | } 61 | {{/if}} 62 | } 63 | 64 | dependencies { 65 | compileOnly "com.facebook.react:react-native:$_reactNativeVersion" 66 | {{#if usesJetpackCompose}} 67 | implementation "androidx.ui:ui-core:$_composeVersion" 68 | implementation "androidx.ui:ui-tooling:$_composeVersion" 69 | implementation "androidx.ui:ui-layout:$_composeVersion" 70 | implementation "androidx.ui:ui-material:$_composeVersion" 71 | implementation "androidx.ui:ui-livedata:$_composeVersion" 72 | {{else}} 73 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$_kotlinVersion" 74 | {{/if}} 75 | {{#if usesLitho}} 76 | implementation "com.facebook.litho:litho-core:$_lithoVersion" 77 | implementation "com.facebook.litho:litho-widget:$_lithoVersion" 78 | 79 | kapt "com.facebook.litho:litho-processor:$_lithoVersion" 80 | {{/if}} 81 | } 82 | -------------------------------------------------------------------------------- /template/android/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /template/android/src/main/kotlin/{{packageCase githubUsername}}/{{packageCase packageName}}/component-template/{{lazyPascalCaseComponentName}}.kt: -------------------------------------------------------------------------------- 1 | package {{packageCase githubUsername}}.{{packageCase packageName}}.{{lazyPackageCaseComponentName}} 2 | 3 | import android.annotation.SuppressLint 4 | import android.content.Context 5 | import android.view.Gravity 6 | import android.widget.Button 7 | import android.widget.FrameLayout 8 | import android.widget.TextView 9 | import com.facebook.react.bridge.Arguments 10 | import com.facebook.react.bridge.ReactContext 11 | import com.facebook.react.uimanager.events.RCTEventEmitter 12 | 13 | @SuppressLint("SetTextI18n") 14 | class {{lazyPascalCaseComponentName}}(context: Context) : FrameLayout(context) { 15 | private val defaultCount = 0 16 | private val label = TextView(context) 17 | private val button = Button(context) 18 | 19 | init { 20 | label.text = "Count: $defaultCount" 21 | label.gravity = Gravity.CENTER 22 | label.layoutParams = LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT) 23 | 24 | button.text = "+" 25 | button.layoutParams = LayoutParams( 26 | LayoutParams.MATCH_PARENT, 27 | LayoutParams.WRAP_CONTENT, 28 | Gravity.BOTTOM 29 | ) 30 | button.setOnClickListener { increment() } 31 | 32 | addView(label) 33 | addView(button) 34 | } 35 | 36 | var count = defaultCount 37 | set(value) { 38 | field = value 39 | label.text = "Count: $value" 40 | } 41 | 42 | fun setColor(color: Int) { 43 | setBackgroundColor(color) 44 | } 45 | 46 | private fun increment() { 47 | val map = Arguments.createMap() 48 | map.putInt("count", count + 1) 49 | 50 | (context as ReactContext).getJSModule(RCTEventEmitter::class.java).receiveEvent( 51 | id, 52 | "onCountChange", 53 | map 54 | ) 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /template/android/src/main/kotlin/{{packageCase githubUsername}}/{{packageCase packageName}}/component-template/{{lazyPascalCaseComponentName}}Manager.kt: -------------------------------------------------------------------------------- 1 | package {{packageCase githubUsername}}.{{packageCase packageName}}.{{lazyPackageCaseComponentName}} 2 | 3 | import android.graphics.Color 4 | import com.facebook.react.common.MapBuilder 5 | import com.facebook.react.module.annotations.ReactModule 6 | import com.facebook.react.uimanager.SimpleViewManager 7 | import com.facebook.react.uimanager.ThemedReactContext 8 | import com.facebook.react.uimanager.annotations.ReactProp 9 | 10 | @ReactModule(name = {{lazyPascalCaseComponentName}}Manager.reactClass) 11 | class {{lazyPascalCaseComponentName}}Manager : SimpleViewManager<{{lazyPascalCaseComponentName}}>() { 12 | 13 | companion object { 14 | const val reactClass = "{{objcPrefix}}{{lazyPascalCaseComponentName}}" 15 | } 16 | 17 | override fun getName(): String { 18 | return reactClass 19 | } 20 | 21 | override fun createViewInstance(reactContext: ThemedReactContext): {{lazyPascalCaseComponentName}} { 22 | return {{lazyPascalCaseComponentName}}(reactContext) 23 | } 24 | 25 | @ReactProp(name = "color", customType = "Color", defaultInt = Color.TRANSPARENT) 26 | fun setColor(view: {{lazyPascalCaseComponentName}}, color: Int) { 27 | view.setColor(color) 28 | } 29 | 30 | @ReactProp(name = "count") 31 | fun setCount(view: {{lazyPascalCaseComponentName}}, count: Int) { 32 | view.count = count 33 | } 34 | 35 | override fun getExportedCustomDirectEventTypeConstants(): Map { 36 | return MapBuilder.of( 37 | "onCountChange", 38 | MapBuilder.of("registrationName", "onCountChange") 39 | ) 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /template/android/src/main/kotlin/{{packageCase githubUsername}}/{{packageCase packageName}}/jetpack-compose-component-template/{{lazyPascalCaseComponentName}}.kt: -------------------------------------------------------------------------------- 1 | package {{packageCase githubUsername}}.{{packageCase packageName}}.{{lazyPackageCaseComponentName}} 2 | 3 | import androidx.compose.Composable 4 | import androidx.lifecycle.MutableLiveData 5 | import androidx.ui.core.Alignment 6 | import androidx.ui.core.Modifier 7 | import androidx.ui.foundation.Text 8 | import androidx.ui.graphics.Color 9 | import androidx.ui.layout.* 10 | import androidx.ui.livedata.observeAsState 11 | import androidx.ui.material.Button 12 | import androidx.ui.material.Surface 13 | import androidx.ui.tooling.preview.Preview 14 | import androidx.ui.unit.Dp 15 | 16 | @Composable 17 | fun {{lazyPascalCaseComponentName}}( 18 | defaultCount: Int, 19 | defaultColor: Color, 20 | count: MutableLiveData, 21 | color: MutableLiveData, 22 | onIncrement: () -> Unit 23 | ) { 24 | val counter = count.observeAsState(initial = defaultCount) 25 | val backgroundColor = color.observeAsState(initial = defaultColor) 26 | 27 | Surface(color = backgroundColor.value) { 28 | Column( 29 | modifier = Modifier.fillMaxSize().padding(all = Dp(5.0f)), 30 | verticalArrangement = Arrangement.SpaceBetween, 31 | horizontalGravity = Alignment.CenterHorizontally 32 | ) { 33 | Text(text = "Count ${counter.value}") 34 | Button( 35 | modifier = Modifier.fillMaxWidth(), 36 | onClick = onIncrement 37 | ) { 38 | Text("+") 39 | } 40 | } 41 | } 42 | } 43 | 44 | @Preview 45 | @Composable 46 | fun {{lazyPascalCaseComponentName}}Preview() { 47 | val defaultCount = 0 48 | val defaultColor = Color.Magenta 49 | val count = MutableLiveData(defaultCount) 50 | val color = MutableLiveData(defaultColor) 51 | val increment = fun () { count.value = (count.value ?: defaultCount) + 1 } 52 | 53 | {{lazyPascalCaseComponentName}}( 54 | defaultCount = defaultCount, 55 | defaultColor = defaultColor, 56 | count = count, 57 | color = color, 58 | onIncrement = increment 59 | ) 60 | } 61 | -------------------------------------------------------------------------------- /template/android/src/main/kotlin/{{packageCase githubUsername}}/{{packageCase packageName}}/jetpack-compose-component-template/{{lazyPascalCaseComponentName}}Manager.kt: -------------------------------------------------------------------------------- 1 | package {{packageCase githubUsername}}.{{packageCase packageName}}.{{lazyPackageCaseComponentName}} 2 | 3 | import androidx.ui.graphics.Color 4 | import com.facebook.react.common.MapBuilder 5 | import com.facebook.react.module.annotations.ReactModule 6 | import com.facebook.react.uimanager.SimpleViewManager 7 | import com.facebook.react.uimanager.ThemedReactContext 8 | import com.facebook.react.uimanager.annotations.ReactProp 9 | 10 | @ReactModule(name = {{lazyPascalCaseComponentName}}Manager.reactClass) 11 | class {{lazyPascalCaseComponentName}}Manager : SimpleViewManager<{{lazyPascalCaseComponentName}}Proxy>() { 12 | 13 | companion object { 14 | const val reactClass = "{{objcPrefix}}{{lazyPascalCaseComponentName}}" 15 | } 16 | 17 | override fun getName(): String { 18 | return reactClass 19 | } 20 | 21 | override fun createViewInstance(reactContext: ThemedReactContext): {{lazyPascalCaseComponentName}}Proxy { 22 | return {{lazyPascalCaseComponentName}}Proxy(reactContext) 23 | } 24 | 25 | @ReactProp(name = "color", customType = "Color") 26 | fun setColor(view: {{lazyPascalCaseComponentName}}Proxy, color: Int) { 27 | view.color.value = Color(color) 28 | } 29 | 30 | @ReactProp(name = "count") 31 | fun setCount(view: {{lazyPascalCaseComponentName}}Proxy, count: Int) { 32 | view.count.value = count 33 | } 34 | 35 | override fun getExportedCustomDirectEventTypeConstants(): Map { 36 | return MapBuilder.of( 37 | "onCountChange", 38 | MapBuilder.of("registrationName", "onCountChange") 39 | ) 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /template/android/src/main/kotlin/{{packageCase githubUsername}}/{{packageCase packageName}}/jetpack-compose-component-template/{{lazyPascalCaseComponentName}}Proxy.kt: -------------------------------------------------------------------------------- 1 | package {{packageCase githubUsername}}.{{packageCase packageName}}.{{lazyPackageCaseComponentName}} 2 | 3 | import android.annotation.SuppressLint 4 | import android.content.Context 5 | import android.widget.FrameLayout 6 | import androidx.compose.* 7 | import androidx.lifecycle.MutableLiveData 8 | import androidx.ui.core.setContent 9 | import androidx.ui.graphics.Color 10 | import com.facebook.react.bridge.Arguments 11 | import com.facebook.react.bridge.ReactContext 12 | import com.facebook.react.uimanager.events.RCTEventEmitter 13 | 14 | @SuppressLint("SetTextI18n") 15 | class {{lazyPascalCaseComponentName}}Proxy(context: Context) : FrameLayout(context) { 16 | private val defaultCount = 0 17 | private val defaultColor = Color.Transparent 18 | 19 | init { 20 | setContent(Recomposer.current()) { 21 | {{lazyPascalCaseComponentName}}( 22 | defaultCount = defaultCount, 23 | defaultColor = defaultColor, 24 | count = count, 25 | color = color, 26 | onIncrement = this::increment 27 | ) 28 | } 29 | } 30 | 31 | val count = MutableLiveData(defaultCount) 32 | val color = MutableLiveData(defaultColor) 33 | 34 | private fun increment() { 35 | val map = Arguments.createMap() 36 | map.putInt("count", (count.value ?: defaultCount) + 1) 37 | 38 | (context as ReactContext).getJSModule(RCTEventEmitter::class.java).receiveEvent( 39 | id, 40 | "onCountChange", 41 | map 42 | ) 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /template/android/src/main/kotlin/{{packageCase githubUsername}}/{{packageCase packageName}}/litho-component-template/{{lazyPascalCaseComponentName}}Manager.kt: -------------------------------------------------------------------------------- 1 | package {{packageCase githubUsername}}.{{packageCase packageName}}.{{lazyPackageCaseComponentName}} 2 | 3 | import com.facebook.react.common.MapBuilder 4 | import com.facebook.react.module.annotations.ReactModule 5 | import com.facebook.react.uimanager.SimpleViewManager 6 | import com.facebook.react.uimanager.ThemedReactContext 7 | import com.facebook.react.uimanager.annotations.ReactProp 8 | 9 | @ReactModule(name = {{lazyPascalCaseComponentName}}Manager.reactClass) 10 | class {{lazyPascalCaseComponentName}}Manager : SimpleViewManager<{{lazyPascalCaseComponentName}}Proxy>() { 11 | 12 | companion object { 13 | const val reactClass = "{{objcPrefix}}{{lazyPascalCaseComponentName}}" 14 | } 15 | 16 | override fun getName(): String { 17 | return reactClass 18 | } 19 | 20 | override fun createViewInstance(reactContext: ThemedReactContext): {{lazyPascalCaseComponentName}}Proxy { 21 | return {{lazyPascalCaseComponentName}}Proxy(reactContext) 22 | } 23 | 24 | @ReactProp(name = "color", customType = "Color") 25 | fun setColor(view: {{lazyPascalCaseComponentName}}Proxy, color: Int) { 26 | view.color = color 27 | } 28 | 29 | @ReactProp(name = "count") 30 | fun setCount(view: {{lazyPascalCaseComponentName}}Proxy, count: Int) { 31 | view.count = count 32 | } 33 | 34 | override fun getExportedCustomDirectEventTypeConstants(): Map { 35 | return MapBuilder.of( 36 | "onCountChange", 37 | MapBuilder.of("registrationName", "onCountChange") 38 | ) 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /template/android/src/main/kotlin/{{packageCase githubUsername}}/{{packageCase packageName}}/litho-component-template/{{lazyPascalCaseComponentName}}Proxy.kt: -------------------------------------------------------------------------------- 1 | package {{packageCase githubUsername}}.{{packageCase packageName}}.{{lazyPackageCaseComponentName}} 2 | 3 | import android.annotation.SuppressLint 4 | import android.content.Context 5 | import android.graphics.Color 6 | import android.widget.FrameLayout 7 | import com.facebook.litho.* 8 | import com.facebook.react.bridge.Arguments 9 | import com.facebook.react.bridge.ReactContext 10 | import com.facebook.react.uimanager.events.RCTEventEmitter 11 | 12 | @SuppressLint("SetTextI18n") 13 | class {{lazyPascalCaseComponentName}}Proxy(context: Context) : FrameLayout(context) { 14 | private val ctx = ComponentContext(context) 15 | private val lithoView = LithoView.create(ctx, render()) 16 | 17 | init { 18 | addView(lithoView) 19 | } 20 | 21 | var count = 0 22 | set(value) { 23 | field = value 24 | lithoView.setComponentAsync(render()) 25 | } 26 | 27 | var color = Color.TRANSPARENT 28 | set(value) { 29 | field = value 30 | lithoView.setComponentAsync(render()) 31 | } 32 | 33 | private fun render() = 34 | {{lazyPascalCaseComponentName}}.create(ctx) 35 | .count(count) 36 | .color(color) 37 | .increment(this::increment) 38 | .build() 39 | 40 | private fun increment() { 41 | val map = Arguments.createMap() 42 | map.putInt("count", count + 1) 43 | 44 | (context as ReactContext).getJSModule(RCTEventEmitter::class.java).receiveEvent( 45 | id, 46 | "onCountChange", 47 | map 48 | ) 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /template/android/src/main/kotlin/{{packageCase githubUsername}}/{{packageCase packageName}}/litho-component-template/{{lazyPascalCaseComponentName}}Spec.kt: -------------------------------------------------------------------------------- 1 | package {{packageCase githubUsername}}.{{packageCase packageName}}.{{lazyPackageCaseComponentName}} 2 | 3 | import android.annotation.SuppressLint 4 | import android.graphics.Color 5 | import android.view.MotionEvent 6 | import android.view.View 7 | import com.facebook.litho.Column 8 | import com.facebook.litho.Component 9 | import com.facebook.litho.ComponentContext 10 | import com.facebook.litho.TouchEvent 11 | import com.facebook.litho.annotations.* 12 | import com.facebook.litho.widget.Text 13 | import com.facebook.litho.widget.TextAlignment 14 | import com.facebook.litho.widget.VerticalGravity 15 | import com.facebook.yoga.YogaAlign 16 | import com.facebook.yoga.YogaEdge 17 | import com.facebook.yoga.YogaJustify 18 | 19 | @LayoutSpec 20 | object {{lazyPascalCaseComponentName}}Spec { 21 | @OnCreateLayout 22 | fun onCreateLayout(ctx: ComponentContext, @Prop count: Int, @Prop color: Int): Component = 23 | Column.create(ctx) 24 | .backgroundColor(color) 25 | .paddingDip(YogaEdge.ALL, 5.0f) 26 | .justifyContent(YogaJustify.SPACE_BETWEEN) 27 | .alignItems(YogaAlign.CENTER) 28 | .child( 29 | Text.create(ctx) 30 | .text("Count $count") 31 | ) 32 | .child( 33 | Text.create(ctx) 34 | .text("+") 35 | .touchHandler({{lazyPascalCaseComponentName}}.onIncrement(ctx)) 36 | .alignment(TextAlignment.CENTER) 37 | .backgroundColor(Color.LTGRAY) 38 | .verticalGravity(VerticalGravity.CENTER) 39 | .widthPercent(100.0f) 40 | .heightPercent(50.0f) 41 | ) 42 | .build() 43 | 44 | @OnEvent(TouchEvent::class) 45 | fun onIncrement( 46 | @SuppressLint("UNUSED_PARAMETER") ctx: ComponentContext, 47 | @FromEvent view: View, 48 | @FromEvent motionEvent: MotionEvent, 49 | @Prop increment: () -> Unit 50 | ): Boolean { 51 | view.alpha = if (motionEvent.action == MotionEvent.ACTION_UP) 1.0f else 0.5f 52 | 53 | if (motionEvent.action == MotionEvent.ACTION_UP) { 54 | increment() 55 | } 56 | 57 | return true 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /template/android/src/main/kotlin/{{packageCase githubUsername}}/{{packageCase packageName}}/module-template/{{lazyPascalCaseModuleName}}.kt: -------------------------------------------------------------------------------- 1 | package {{packageCase githubUsername}}.{{packageCase packageName}}.{{lazyPackageCaseModuleName}} 2 | 3 | import com.facebook.react.bridge.ReactApplicationContext 4 | import com.facebook.react.bridge.ReactContextBaseJavaModule 5 | import com.facebook.react.module.annotations.ReactModule 6 | import android.widget.Toast 7 | import com.facebook.react.bridge.ReactMethod 8 | 9 | @ReactModule(name = {{lazyPascalCaseModuleName}}.reactClass) 10 | class {{lazyPascalCaseModuleName}}(context: ReactApplicationContext) : ReactContextBaseJavaModule(context) { 11 | 12 | companion object { 13 | const val reactClass = "{{objcPrefix}}{{lazyPascalCaseModuleName}}" 14 | } 15 | 16 | override fun getName(): String { 17 | return reactClass 18 | } 19 | 20 | @ReactMethod 21 | fun show(message: String) { 22 | Toast.makeText(reactApplicationContext, message, Toast.LENGTH_LONG).show() 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /template/android/src/main/kotlin/{{packageCase githubUsername}}/{{packageCase packageName}}/{{pascalCase packageName}}Package.kt: -------------------------------------------------------------------------------- 1 | package {{packageCase githubUsername}}.{{packageCase packageName}} 2 | 3 | import com.facebook.react.ReactPackage 4 | import com.facebook.react.bridge.NativeModule 5 | import com.facebook.react.bridge.ReactApplicationContext 6 | import com.facebook.react.uimanager.ViewManager 7 | 8 | {{#each modules}} 9 | import {{packageCase ../githubUsername}}.{{packageCase ../packageName}}.{{packageCase this}}.{{pascalCase this}} 10 | {{/each}} 11 | {{#each components}} 12 | import {{packageCase ../githubUsername}}.{{packageCase ../packageName}}.{{packageCase this}}.{{pascalCase this}}Manager 13 | {{/each}} 14 | 15 | class {{pascalCase packageName}}Package : ReactPackage { 16 | override fun createNativeModules(reactContext: ReactApplicationContext): List { 17 | {{#if modules.length}} 18 | return listOf( 19 | {{#each modules}} 20 | {{pascalCase this}}(reactContext){{#unless @last}},{{/unless}} 21 | {{/each}} 22 | ) 23 | {{else}} 24 | return listOf() 25 | {{/if}} 26 | } 27 | 28 | override fun createViewManagers(reactContext: ReactApplicationContext): List> { 29 | {{#if components.length}} 30 | return listOf( 31 | {{#each components}} 32 | {{pascalCase this}}Manager(){{#unless @last}},{{/unless}} 33 | {{/each}} 34 | ) 35 | {{else}} 36 | return listOf() 37 | {{/if}} 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /template/android/{{gitignore}}: -------------------------------------------------------------------------------- 1 | build/ 2 | .idea 3 | .gradle 4 | local.properties 5 | *.iml 6 | **/.DS_Store 7 | -------------------------------------------------------------------------------- /template/example/.gitattributes: -------------------------------------------------------------------------------- 1 | *.pbxproj -text 2 | -------------------------------------------------------------------------------- /template/example/.watchmanconfig: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /template/example/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM iyegoroff/ubuntu-node-android-git:{{#if usesJetpackCompose}}2{{else}}1{{/if}} 2 | 3 | RUN mkdir /package 4 | COPY . /package 5 | WORKDIR /package/example 6 | 7 | RUN npm i --unsafe-perm 8 | RUN npm run generate:android:bundle 9 | RUN rm -rf node_modules/.bin && rm -rf ../node_modules/.bin 10 | RUN cd android && ./gradlew assembleRelease 11 | -------------------------------------------------------------------------------- /template/example/README.md: -------------------------------------------------------------------------------- 1 | ### Run debug version 2 | ```bash 3 | $ npm i 4 | $ npm run run:android 5 | ``` 6 | 7 | ### Build signed release apk with Docker 8 | - Generate keystore `npm run generate:android:signing-key` 9 | - Open `android/gradle.properties` file and replace `qwerty`s with your passwords 10 | - Run `npm run build:release:docker` - upon script completion apk will be copied to `{{paramCase appName}}.apk` file 11 | -------------------------------------------------------------------------------- /template/example/android/app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: "com.android.application" 2 | 3 | import com.android.build.OutputFile 4 | 5 | /** 6 | * The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets 7 | * and bundleReleaseJsAndAssets). 8 | * These basically call `react-native bundle` with the correct arguments during the Android build 9 | * cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the 10 | * bundle directly from the development server. Below you can see all the possible configurations 11 | * and their defaults. If you decide to add a configuration block, make sure to add it before the 12 | * `apply from: "../../node_modules/react-native/react.gradle"` line. 13 | * 14 | * project.ext.react = [ 15 | * // the name of the generated asset file containing your JS bundle 16 | * bundleAssetName: "index.android.bundle", 17 | * 18 | * // the entry file for bundle generation. If none specified and 19 | * // "index.android.js" exists, it will be used. Otherwise "index.js" is 20 | * // default. Can be overridden with ENTRY_FILE environment variable. 21 | * entryFile: "index.android.js", 22 | * 23 | * // https://facebook.github.io/react-native/docs/performance#enable-the-ram-format 24 | * bundleCommand: "ram-bundle", 25 | * 26 | * // whether to bundle JS and assets in debug mode 27 | * bundleInDebug: false, 28 | * 29 | * // whether to bundle JS and assets in release mode 30 | * bundleInRelease: true, 31 | * 32 | * // whether to bundle JS and assets in another build variant (if configured). 33 | * // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants 34 | * // The configuration property can be in the following formats 35 | * // 'bundleIn${productFlavor}${buildType}' 36 | * // 'bundleIn${buildType}' 37 | * // bundleInFreeDebug: true, 38 | * // bundleInPaidRelease: true, 39 | * // bundleInBeta: true, 40 | * 41 | * // whether to disable dev mode in custom build variants (by default only disabled in release) 42 | * // for example: to disable dev mode in the staging build type (if configured) 43 | * devDisabledInStaging: true, 44 | * // The configuration property can be in the following formats 45 | * // 'devDisabledIn${productFlavor}${buildType}' 46 | * // 'devDisabledIn${buildType}' 47 | * 48 | * // the root of your project, i.e. where "package.json" lives 49 | * root: "../../", 50 | * 51 | * // where to put the JS bundle asset in debug mode 52 | * jsBundleDirDebug: "$buildDir/intermediates/assets/debug", 53 | * 54 | * // where to put the JS bundle asset in release mode 55 | * jsBundleDirRelease: "$buildDir/intermediates/assets/release", 56 | * 57 | * // where to put drawable resources / React Native assets, e.g. the ones you use via 58 | * // require('./image.png')), in debug mode 59 | * resourcesDirDebug: "$buildDir/intermediates/res/merged/debug", 60 | * 61 | * // where to put drawable resources / React Native assets, e.g. the ones you use via 62 | * // require('./image.png')), in release mode 63 | * resourcesDirRelease: "$buildDir/intermediates/res/merged/release", 64 | * 65 | * // by default the gradle tasks are skipped if none of the JS files or assets change; this means 66 | * // that we don't look at files in android/ or ios/ to determine whether the tasks are up to 67 | * // date; if you have any other folders that you want to ignore for performance reasons (gradle 68 | * // indexes the entire tree), add them here. Alternatively, if you have JS files in android/ 69 | * // for example, you might want to remove it from here. 70 | * inputExcludes: ["android/**", "ios/**"], 71 | * 72 | * // override which node gets called and with what additional arguments 73 | * nodeExecutableAndArgs: ["node"], 74 | * 75 | * // supply additional arguments to the packager 76 | * extraPackagerArgs: [] 77 | * ] 78 | */ 79 | 80 | project.ext.react = [ 81 | enableHermes: false, // clean and rebuild if changing 82 | ] 83 | 84 | apply from: "../../node_modules/react-native/react.gradle" 85 | 86 | /** 87 | * Set this to true to create two separate APKs instead of one: 88 | * - An APK that only works on ARM devices 89 | * - An APK that only works on x86 devices 90 | * The advantage is the size of the APK is reduced by about 4MB. 91 | * Upload all the APKs to the Play Store and people will download 92 | * the correct one based on the CPU architecture of their device. 93 | */ 94 | def enableSeparateBuildPerCPUArchitecture = false 95 | 96 | /** 97 | * Run Proguard to shrink the Java bytecode in release builds. 98 | */ 99 | def enableProguardInReleaseBuilds = false 100 | 101 | /** 102 | * The preferred build flavor of JavaScriptCore. 103 | * 104 | * For example, to use the international variant, you can use: 105 | * `def jscFlavor = 'org.webkit:android-jsc-intl:+'` 106 | * 107 | * The international variant includes ICU i18n library and necessary data 108 | * allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that 109 | * give correct results when using with locales other than en-US. Note that 110 | * this variant is about 6MiB larger per architecture than default. 111 | */ 112 | def jscFlavor = 'org.webkit:android-jsc:+' 113 | 114 | /** 115 | * Whether to enable the Hermes VM. 116 | * 117 | * This should be set on project.ext.react and mirrored here. If it is not set 118 | * on project.ext.react, JavaScript will not be compiled to Hermes Bytecode 119 | * and the benefits of using Hermes will therefore be sharply reduced. 120 | */ 121 | def enableHermes = project.ext.react.get("enableHermes", false); 122 | 123 | android { 124 | compileSdkVersion rootProject.ext.compileSdkVersion 125 | 126 | compileOptions { 127 | sourceCompatibility JavaVersion.VERSION_1_8 128 | targetCompatibility JavaVersion.VERSION_1_8 129 | } 130 | 131 | defaultConfig { 132 | applicationId "com.{{packageCase appName}}" 133 | minSdkVersion rootProject.ext.minSdkVersion 134 | targetSdkVersion rootProject.ext.targetSdkVersion 135 | versionCode 1 136 | versionName "1.0" 137 | } 138 | splits { 139 | abi { 140 | reset() 141 | enable enableSeparateBuildPerCPUArchitecture 142 | universalApk false // If true, also generate a universal APK 143 | include "armeabi-v7a", "x86", "arm64-v8a", "x86_64" 144 | } 145 | } 146 | signingConfigs { 147 | release { 148 | if (project.hasProperty('EXAMPLE_RELEASE_STORE_FILE')) { 149 | storeFile file(EXAMPLE_RELEASE_STORE_FILE) 150 | storePassword EXAMPLE_RELEASE_STORE_PASSWORD 151 | keyAlias EXAMPLE_RELEASE_KEY_ALIAS 152 | keyPassword EXAMPLE_RELEASE_KEY_PASSWORD 153 | } 154 | } 155 | 156 | debug { 157 | storeFile file('debug.keystore') 158 | storePassword 'android' 159 | keyAlias 'androiddebugkey' 160 | keyPassword 'android' 161 | } 162 | } 163 | buildTypes { 164 | debug { 165 | signingConfig signingConfigs.debug 166 | } 167 | release { 168 | // Caution! In production, you need to generate your own keystore file. 169 | // see https://facebook.github.io/react-native/docs/signed-apk-android. 170 | signingConfig signingConfigs.release 171 | minifyEnabled enableProguardInReleaseBuilds 172 | proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" 173 | } 174 | } 175 | 176 | packagingOptions { 177 | pickFirst "lib/armeabi-v7a/libc++_shared.so" 178 | pickFirst "lib/arm64-v8a/libc++_shared.so" 179 | pickFirst "lib/x86/libc++_shared.so" 180 | pickFirst "lib/x86_64/libc++_shared.so" 181 | } 182 | 183 | // applicationVariants are e.g. debug, release 184 | applicationVariants.all { variant -> 185 | variant.outputs.each { output -> 186 | // For each separate APK per architecture, set a unique version code as described here: 187 | // https://developer.android.com/studio/build/configure-apk-splits.html 188 | def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4] 189 | def abi = output.getFilter(OutputFile.ABI) 190 | if (abi != null) { // null for the universal-debug, universal-release variants 191 | output.versionCodeOverride = 192 | versionCodes.get(abi) * 1048576 + defaultConfig.versionCode 193 | } 194 | 195 | } 196 | } 197 | } 198 | 199 | dependencies { 200 | implementation fileTree(dir: "libs", include: ["*.jar"]) 201 | //noinspection GradleDynamicVersion 202 | implementation "com.facebook.react:react-native:+" // From node_modules 203 | 204 | implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0" 205 | 206 | debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") { 207 | exclude group:'com.facebook.fbjni' 208 | } 209 | 210 | debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") { 211 | exclude group:'com.facebook.flipper' 212 | } 213 | 214 | debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") { 215 | exclude group:'com.facebook.flipper' 216 | } 217 | 218 | if (enableHermes) { 219 | def hermesPath = "../../node_modules/hermes-engine/android/"; 220 | debugImplementation files(hermesPath + "hermes-debug.aar") 221 | releaseImplementation files(hermesPath + "hermes-release.aar") 222 | } else { 223 | implementation jscFlavor 224 | } 225 | {{#if usesLitho}} 226 | 227 | configurations.all { 228 | exclude group: 'com.facebook.yoga', module: 'yoga' 229 | exclude group: 'com.google.code.findbugs', module: 'jsr305' 230 | } 231 | {{/if}} 232 | } 233 | 234 | // Run this once to be able to run the application with BUCK 235 | // puts all compile dependencies into folder libs for BUCK to use 236 | task copyDownloadableDepsToLibs(type: Copy) { 237 | from configurations.compile 238 | into 'libs' 239 | } 240 | 241 | apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project) 242 | -------------------------------------------------------------------------------- /template/example/android/app/debug.keystore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iyegoroff/make-react-native-package/8267d873f638b63d05960f0cf664f784f0e14238/template/example/android/app/debug.keystore -------------------------------------------------------------------------------- /template/example/android/app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | -------------------------------------------------------------------------------- /template/example/android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /template/example/android/app/src/debug/java/com/{{packageCase appName}}/ReactNativeFlipper.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | *

This source code is licensed under the MIT license found in the LICENSE file in the root 5 | * directory of this source tree. 6 | */ 7 | package com.{{packageCase appName}}; 8 | 9 | import android.content.Context; 10 | import com.facebook.flipper.android.AndroidFlipperClient; 11 | import com.facebook.flipper.android.utils.FlipperUtils; 12 | import com.facebook.flipper.core.FlipperClient; 13 | import com.facebook.flipper.plugins.crashreporter.CrashReporterPlugin; 14 | import com.facebook.flipper.plugins.databases.DatabasesFlipperPlugin; 15 | import com.facebook.flipper.plugins.fresco.FrescoFlipperPlugin; 16 | import com.facebook.flipper.plugins.inspector.DescriptorMapping; 17 | import com.facebook.flipper.plugins.inspector.InspectorFlipperPlugin; 18 | import com.facebook.flipper.plugins.network.FlipperOkhttpInterceptor; 19 | import com.facebook.flipper.plugins.network.NetworkFlipperPlugin; 20 | import com.facebook.flipper.plugins.react.ReactFlipperPlugin; 21 | import com.facebook.flipper.plugins.sharedpreferences.SharedPreferencesFlipperPlugin; 22 | import com.facebook.react.ReactInstanceManager; 23 | import com.facebook.react.bridge.ReactContext; 24 | import com.facebook.react.modules.network.NetworkingModule; 25 | import okhttp3.OkHttpClient; 26 | 27 | public class ReactNativeFlipper { 28 | public static void initializeFlipper(Context context, ReactInstanceManager reactInstanceManager) { 29 | if (FlipperUtils.shouldEnableFlipper(context)) { 30 | final FlipperClient client = AndroidFlipperClient.getInstance(context); 31 | 32 | client.addPlugin(new InspectorFlipperPlugin(context, DescriptorMapping.withDefaults())); 33 | client.addPlugin(new ReactFlipperPlugin()); 34 | client.addPlugin(new DatabasesFlipperPlugin(context)); 35 | client.addPlugin(new SharedPreferencesFlipperPlugin(context)); 36 | client.addPlugin(CrashReporterPlugin.getInstance()); 37 | 38 | NetworkFlipperPlugin networkFlipperPlugin = new NetworkFlipperPlugin(); 39 | NetworkingModule.setCustomClientBuilder( 40 | new NetworkingModule.CustomClientBuilder() { 41 | @Override 42 | public void apply(OkHttpClient.Builder builder) { 43 | builder.addNetworkInterceptor(new FlipperOkhttpInterceptor(networkFlipperPlugin)); 44 | } 45 | }); 46 | client.addPlugin(networkFlipperPlugin); 47 | client.start(); 48 | 49 | // Fresco Plugin needs to ensure that ImagePipelineFactory is initialized 50 | // Hence we run if after all native modules have been initialized 51 | ReactContext reactContext = reactInstanceManager.getCurrentReactContext(); 52 | if (reactContext == null) { 53 | reactInstanceManager.addReactInstanceEventListener( 54 | new ReactInstanceManager.ReactInstanceEventListener() { 55 | @Override 56 | public void onReactContextInitialized(ReactContext reactContext) { 57 | reactInstanceManager.removeReactInstanceEventListener(this); 58 | reactContext.runOnNativeModulesQueueThread( 59 | new Runnable() { 60 | @Override 61 | public void run() { 62 | client.addPlugin(new FrescoFlipperPlugin()); 63 | } 64 | }); 65 | } 66 | }); 67 | } else { 68 | client.addPlugin(new FrescoFlipperPlugin()); 69 | } 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /template/example/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 13 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /template/example/android/app/src/main/assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iyegoroff/make-react-native-package/8267d873f638b63d05960f0cf664f784f0e14238/template/example/android/app/src/main/assets/.gitkeep -------------------------------------------------------------------------------- /template/example/android/app/src/main/java/com/{{packageCase appName}}/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.{{packageCase appName}}; 2 | 3 | import com.facebook.react.ReactActivity; 4 | 5 | public class MainActivity extends ReactActivity { 6 | 7 | /** 8 | * Returns the name of the main component registered from JavaScript. This is used to schedule 9 | * rendering of the component. 10 | */ 11 | @Override 12 | protected String getMainComponentName() { 13 | return "{{appName}}"; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /template/example/android/app/src/main/java/com/{{packageCase appName}}/MainApplication.java: -------------------------------------------------------------------------------- 1 | package com.{{packageCase appName}}; 2 | 3 | import android.app.Application; 4 | import android.content.Context; 5 | import com.facebook.react.PackageList; 6 | import com.facebook.react.ReactApplication; 7 | import com.facebook.react.ReactInstanceManager; 8 | import com.facebook.react.ReactNativeHost; 9 | import com.facebook.react.ReactPackage; 10 | import com.facebook.soloader.SoLoader; 11 | import java.lang.reflect.InvocationTargetException; 12 | import java.util.List; 13 | 14 | public class MainApplication extends Application implements ReactApplication { 15 | 16 | private final ReactNativeHost mReactNativeHost = 17 | new ReactNativeHost(this) { 18 | @Override 19 | public boolean getUseDeveloperSupport() { 20 | return BuildConfig.DEBUG; 21 | } 22 | 23 | @Override 24 | protected List getPackages() { 25 | @SuppressWarnings("UnnecessaryLocalVariable") 26 | List packages = new PackageList(this).getPackages(); 27 | // Packages that cannot be autolinked yet can be added manually here, for example: 28 | // packages.add(new MyReactNativePackage()); 29 | return packages; 30 | } 31 | 32 | @Override 33 | protected String getJSMainModuleName() { 34 | return "index"; 35 | } 36 | }; 37 | 38 | @Override 39 | public ReactNativeHost getReactNativeHost() { 40 | return mReactNativeHost; 41 | } 42 | 43 | @Override 44 | public void onCreate() { 45 | super.onCreate(); 46 | SoLoader.init(this, /* native exopackage */ false); 47 | initializeFlipper(this, getReactNativeHost().getReactInstanceManager()); 48 | } 49 | 50 | /** 51 | * Loads Flipper in React Native templates. Call this in the onCreate method with something like 52 | * initializeFlipper(this, getReactNativeHost().getReactInstanceManager()); 53 | * 54 | * @param context 55 | * @param reactInstanceManager 56 | */ 57 | private static void initializeFlipper( 58 | Context context, ReactInstanceManager reactInstanceManager) { 59 | if (BuildConfig.DEBUG) { 60 | try { 61 | /* 62 | We use reflection here to pick up the class that initializes Flipper, 63 | since Flipper library is not available in release mode 64 | */ 65 | Class aClass = Class.forName("com.example.ReactNativeFlipper"); 66 | aClass 67 | .getMethod("initializeFlipper", Context.class, ReactInstanceManager.class) 68 | .invoke(null, context, reactInstanceManager); 69 | } catch (ClassNotFoundException e) { 70 | e.printStackTrace(); 71 | } catch (NoSuchMethodException e) { 72 | e.printStackTrace(); 73 | } catch (IllegalAccessException e) { 74 | e.printStackTrace(); 75 | } catch (InvocationTargetException e) { 76 | e.printStackTrace(); 77 | } 78 | } 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /template/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iyegoroff/make-react-native-package/8267d873f638b63d05960f0cf664f784f0e14238/template/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /template/example/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iyegoroff/make-react-native-package/8267d873f638b63d05960f0cf664f784f0e14238/template/example/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /template/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iyegoroff/make-react-native-package/8267d873f638b63d05960f0cf664f784f0e14238/template/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /template/example/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iyegoroff/make-react-native-package/8267d873f638b63d05960f0cf664f784f0e14238/template/example/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /template/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iyegoroff/make-react-native-package/8267d873f638b63d05960f0cf664f784f0e14238/template/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /template/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iyegoroff/make-react-native-package/8267d873f638b63d05960f0cf664f784f0e14238/template/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /template/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iyegoroff/make-react-native-package/8267d873f638b63d05960f0cf664f784f0e14238/template/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /template/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iyegoroff/make-react-native-package/8267d873f638b63d05960f0cf664f784f0e14238/template/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /template/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iyegoroff/make-react-native-package/8267d873f638b63d05960f0cf664f784f0e14238/template/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /template/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iyegoroff/make-react-native-package/8267d873f638b63d05960f0cf664f784f0e14238/template/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /template/example/android/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | {{appName}} 3 | 4 | -------------------------------------------------------------------------------- /template/example/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /template/example/android/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | ext { 5 | buildToolsVersion = "{{buildToolsVersion}}" 6 | minSdkVersion = {{minSdkVersion}} 7 | compileSdkVersion = {{compileSdkVersion}} 8 | targetSdkVersion = {{targetSdkVersion}} 9 | kotlinVersion = "{{kotlinVersion}}" 10 | {{#if usesJetpackCompose}} 11 | composeVersion = "{{composeVersion}}" 12 | composeKotlinCompilerVersion = "{{composeKotlinCompilerVersion}}" 13 | {{/if}} 14 | {{#if usesLitho}} 15 | lithoVersion = "{{lithoVersion}}" 16 | {{/if}} 17 | } 18 | repositories { 19 | google() 20 | jcenter() 21 | maven { 22 | url "https://plugins.gradle.org/m2/" 23 | } 24 | } 25 | dependencies { 26 | classpath("com.android.tools.build:gradle:{{buildToolsPluginVersion}}") 27 | classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion") 28 | classpath "org.jlleitschuh.gradle:ktlint-gradle:9.2.1" 29 | // NOTE: Do not place your application dependencies here; they belong 30 | // in the individual module build.gradle files 31 | } 32 | } 33 | 34 | allprojects { 35 | repositories { 36 | mavenLocal() 37 | maven { 38 | // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm 39 | url("$rootDir/../node_modules/react-native/android") 40 | } 41 | maven { 42 | // Android JSC is installed from npm 43 | url("$rootDir/../node_modules/jsc-android/dist") 44 | } 45 | 46 | google() 47 | jcenter() 48 | maven { url "https://www.jitpack.io" } 49 | } 50 | 51 | apply plugin: "org.jlleitschuh.gradle.ktlint" 52 | 53 | ktlint { 54 | android = true 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /template/example/android/gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 14 | 15 | # When configured, Gradle will run in incubating parallel mode. 16 | # This option should only be used with decoupled projects. More details, visit 17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 18 | # org.gradle.parallel=true 19 | 20 | # AndroidX package structure to make it clearer which packages are bundled with the 21 | # Android operating system, and which are packaged with your app's APK 22 | # https://developer.android.com/topic/libraries/support-library/androidx-rn 23 | android.useAndroidX=true 24 | # Automatically convert third-party libraries to use AndroidX 25 | android.enableJetifier=true 26 | 27 | # Version of flipper SDK to use with React Native 28 | FLIPPER_VERSION=0.33.1 29 | 30 | EXAMPLE_RELEASE_STORE_FILE=example.keystore 31 | EXAMPLE_RELEASE_KEY_ALIAS=example 32 | EXAMPLE_RELEASE_STORE_PASSWORD=qwerty 33 | EXAMPLE_RELEASE_KEY_PASSWORD=qwerty 34 | -------------------------------------------------------------------------------- /template/example/android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iyegoroff/make-react-native-package/8267d873f638b63d05960f0cf664f784f0e14238/template/example/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /template/example/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-{{gradleWrapperVersion}}-all.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /template/example/android/gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # 4 | # Copyright 2015 the original author or authors. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # https://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | ############################################################################## 20 | ## 21 | ## Gradle start up script for UN*X 22 | ## 23 | ############################################################################## 24 | 25 | # Attempt to set APP_HOME 26 | # Resolve links: $0 may be a link 27 | PRG="$0" 28 | # Need this for relative symlinks. 29 | while [ -h "$PRG" ] ; do 30 | ls=`ls -ld "$PRG"` 31 | link=`expr "$ls" : '.*-> \(.*\)$'` 32 | if expr "$link" : '/.*' > /dev/null; then 33 | PRG="$link" 34 | else 35 | PRG=`dirname "$PRG"`"/$link" 36 | fi 37 | done 38 | SAVED="`pwd`" 39 | cd "`dirname \"$PRG\"`/" >/dev/null 40 | APP_HOME="`pwd -P`" 41 | cd "$SAVED" >/dev/null 42 | 43 | APP_NAME="Gradle" 44 | APP_BASE_NAME=`basename "$0"` 45 | 46 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 47 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 48 | 49 | # Use the maximum available, or set MAX_FD != -1 to use that value. 50 | MAX_FD="maximum" 51 | 52 | warn () { 53 | echo "$*" 54 | } 55 | 56 | die () { 57 | echo 58 | echo "$*" 59 | echo 60 | exit 1 61 | } 62 | 63 | # OS specific support (must be 'true' or 'false'). 64 | cygwin=false 65 | msys=false 66 | darwin=false 67 | nonstop=false 68 | case "`uname`" in 69 | CYGWIN* ) 70 | cygwin=true 71 | ;; 72 | Darwin* ) 73 | darwin=true 74 | ;; 75 | MINGW* ) 76 | msys=true 77 | ;; 78 | NONSTOP* ) 79 | nonstop=true 80 | ;; 81 | esac 82 | 83 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 84 | 85 | # Determine the Java command to use to start the JVM. 86 | if [ -n "$JAVA_HOME" ] ; then 87 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 88 | # IBM's JDK on AIX uses strange locations for the executables 89 | JAVACMD="$JAVA_HOME/jre/sh/java" 90 | else 91 | JAVACMD="$JAVA_HOME/bin/java" 92 | fi 93 | if [ ! -x "$JAVACMD" ] ; then 94 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 95 | 96 | Please set the JAVA_HOME variable in your environment to match the 97 | location of your Java installation." 98 | fi 99 | else 100 | JAVACMD="java" 101 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 102 | 103 | Please set the JAVA_HOME variable in your environment to match the 104 | location of your Java installation." 105 | fi 106 | 107 | # Increase the maximum file descriptors if we can. 108 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 109 | MAX_FD_LIMIT=`ulimit -H -n` 110 | if [ $? -eq 0 ] ; then 111 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 112 | MAX_FD="$MAX_FD_LIMIT" 113 | fi 114 | ulimit -n $MAX_FD 115 | if [ $? -ne 0 ] ; then 116 | warn "Could not set maximum file descriptor limit: $MAX_FD" 117 | fi 118 | else 119 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 120 | fi 121 | fi 122 | 123 | # For Darwin, add options to specify how the application appears in the dock 124 | if $darwin; then 125 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 126 | fi 127 | 128 | # For Cygwin or MSYS, switch paths to Windows format before running java 129 | if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then 130 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 131 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 132 | JAVACMD=`cygpath --unix "$JAVACMD"` 133 | 134 | # We build the pattern for arguments to be converted via cygpath 135 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 136 | SEP="" 137 | for dir in $ROOTDIRSRAW ; do 138 | ROOTDIRS="$ROOTDIRS$SEP$dir" 139 | SEP="|" 140 | done 141 | OURCYGPATTERN="(^($ROOTDIRS))" 142 | # Add a user-defined pattern to the cygpath arguments 143 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 144 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 145 | fi 146 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 147 | i=0 148 | for arg in "$@" ; do 149 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 150 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 151 | 152 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 153 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 154 | else 155 | eval `echo args$i`="\"$arg\"" 156 | fi 157 | i=$((i+1)) 158 | done 159 | case $i in 160 | (0) set -- ;; 161 | (1) set -- "$args0" ;; 162 | (2) set -- "$args0" "$args1" ;; 163 | (3) set -- "$args0" "$args1" "$args2" ;; 164 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 165 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 166 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 167 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 168 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 169 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 170 | esac 171 | fi 172 | 173 | # Escape application args 174 | save () { 175 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 176 | echo " " 177 | } 178 | APP_ARGS=$(save "$@") 179 | 180 | # Collect all arguments for the java command, following the shell quoting and substitution rules 181 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 182 | 183 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong 184 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then 185 | cd "$(dirname "$0")" 186 | fi 187 | 188 | exec "$JAVACMD" "$@" 189 | -------------------------------------------------------------------------------- /template/example/android/gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%" == "" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%" == "" set DIRNAME=. 29 | set APP_BASE_NAME=%~n0 30 | set APP_HOME=%DIRNAME% 31 | 32 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 33 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 34 | 35 | @rem Find java.exe 36 | if defined JAVA_HOME goto findJavaFromJavaHome 37 | 38 | set JAVA_EXE=java.exe 39 | %JAVA_EXE% -version >NUL 2>&1 40 | if "%ERRORLEVEL%" == "0" goto init 41 | 42 | echo. 43 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 44 | echo. 45 | echo Please set the JAVA_HOME variable in your environment to match the 46 | echo location of your Java installation. 47 | 48 | goto fail 49 | 50 | :findJavaFromJavaHome 51 | set JAVA_HOME=%JAVA_HOME:"=% 52 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 53 | 54 | if exist "%JAVA_EXE%" goto init 55 | 56 | echo. 57 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 58 | echo. 59 | echo Please set the JAVA_HOME variable in your environment to match the 60 | echo location of your Java installation. 61 | 62 | goto fail 63 | 64 | :init 65 | @rem Get command-line arguments, handling Windows variants 66 | 67 | if not "%OS%" == "Windows_NT" goto win9xME_args 68 | 69 | :win9xME_args 70 | @rem Slurp the command line arguments. 71 | set CMD_LINE_ARGS= 72 | set _SKIP=2 73 | 74 | :win9xME_args_slurp 75 | if "x%~1" == "x" goto execute 76 | 77 | set CMD_LINE_ARGS=%* 78 | 79 | :execute 80 | @rem Setup the command line 81 | 82 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 83 | 84 | @rem Execute Gradle 85 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 86 | 87 | :end 88 | @rem End local scope for the variables with windows NT shell 89 | if "%ERRORLEVEL%"=="0" goto mainEnd 90 | 91 | :fail 92 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 93 | rem the _cmd.exe /c_ return code! 94 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 95 | exit /b 1 96 | 97 | :mainEnd 98 | if "%OS%"=="Windows_NT" endlocal 99 | 100 | :omega 101 | -------------------------------------------------------------------------------- /template/example/android/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = '{{appName}}' 2 | apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings) 3 | include ':app' 4 | -------------------------------------------------------------------------------- /template/example/android/{{gitignore}}: -------------------------------------------------------------------------------- 1 | **/build/ 2 | **/infer-out/ 3 | .idea 4 | .gradle 5 | local.properties 6 | *.iml 7 | .DS_Store 8 | app/*.keystore 9 | !app/debug.keystore 10 | app/src/main/assets/*.bundle 11 | app/src/main/res/drawable-* 12 | gradle-yandex.properties -------------------------------------------------------------------------------- /template/example/app.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "{{appName}}", 3 | "displayName": "{{appName}}" 4 | } 5 | -------------------------------------------------------------------------------- /template/example/babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: ['module:metro-react-native-babel-preset'], 3 | }; 4 | -------------------------------------------------------------------------------- /template/example/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @format 3 | */ 4 | 5 | import {AppRegistry} from 'react-native'; 6 | import App from './build/App'; 7 | import {name as appName} from './app.json'; 8 | 9 | AppRegistry.registerComponent(appName, () => App); 10 | -------------------------------------------------------------------------------- /template/example/ios/Podfile: -------------------------------------------------------------------------------- 1 | platform :ios, '{{iosVersion}}' 2 | require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules' 3 | 4 | def add_flipper_pods!(versions = {}) 5 | versions['Flipper'] ||= '~> 0.33.1' 6 | versions['DoubleConversion'] ||= '1.1.7' 7 | versions['Flipper-Folly'] ||= '~> 2.1' 8 | versions['Flipper-Glog'] ||= '0.3.6' 9 | versions['Flipper-PeerTalk'] ||= '~> 0.0.4' 10 | versions['Flipper-RSocket'] ||= '~> 1.0' 11 | 12 | pod 'FlipperKit', versions['Flipper'], :configuration => 'Debug' 13 | pod 'FlipperKit/FlipperKitLayoutPlugin', versions['Flipper'], :configuration => 'Debug' 14 | pod 'FlipperKit/SKIOSNetworkPlugin', versions['Flipper'], :configuration => 'Debug' 15 | pod 'FlipperKit/FlipperKitUserDefaultsPlugin', versions['Flipper'], :configuration => 'Debug' 16 | pod 'FlipperKit/FlipperKitReactPlugin', versions['Flipper'], :configuration => 'Debug' 17 | 18 | # List all transitive dependencies for FlipperKit pods 19 | # to avoid them being linked in Release builds 20 | pod 'Flipper', versions['Flipper'], :configuration => 'Debug' 21 | pod 'Flipper-DoubleConversion', versions['DoubleConversion'], :configuration => 'Debug' 22 | pod 'Flipper-Folly', versions['Flipper-Folly'], :configuration => 'Debug' 23 | pod 'Flipper-Glog', versions['Flipper-Glog'], :configuration => 'Debug' 24 | pod 'Flipper-PeerTalk', versions['Flipper-PeerTalk'], :configuration => 'Debug' 25 | pod 'Flipper-RSocket', versions['Flipper-RSocket'], :configuration => 'Debug' 26 | pod 'FlipperKit/Core', versions['Flipper'], :configuration => 'Debug' 27 | pod 'FlipperKit/CppBridge', versions['Flipper'], :configuration => 'Debug' 28 | pod 'FlipperKit/FBCxxFollyDynamicConvert', versions['Flipper'], :configuration => 'Debug' 29 | pod 'FlipperKit/FBDefines', versions['Flipper'], :configuration => 'Debug' 30 | pod 'FlipperKit/FKPortForwarding', versions['Flipper'], :configuration => 'Debug' 31 | pod 'FlipperKit/FlipperKitHighlightOverlay', versions['Flipper'], :configuration => 'Debug' 32 | pod 'FlipperKit/FlipperKitLayoutTextSearchable', versions['Flipper'], :configuration => 'Debug' 33 | pod 'FlipperKit/FlipperKitNetworkPlugin', versions['Flipper'], :configuration => 'Debug' 34 | end 35 | 36 | # Post Install processing for Flipper 37 | def flipper_post_install(installer) 38 | installer.pods_project.targets.each do |target| 39 | if target.name == 'YogaKit' 40 | target.build_configurations.each do |config| 41 | config.build_settings['SWIFT_VERSION'] = '4.1' 42 | end 43 | end 44 | end 45 | end 46 | 47 | target '{{appName}}' do 48 | # Pods for {{appName}} 49 | pod 'FBLazyVector', :path => "../node_modules/react-native/Libraries/FBLazyVector" 50 | pod 'FBReactNativeSpec', :path => "../node_modules/react-native/Libraries/FBReactNativeSpec" 51 | pod 'RCTRequired', :path => "../node_modules/react-native/Libraries/RCTRequired" 52 | pod 'RCTTypeSafety', :path => "../node_modules/react-native/Libraries/TypeSafety" 53 | pod 'React', :path => '../node_modules/react-native/' 54 | pod 'React-Core', :path => '../node_modules/react-native/' 55 | pod 'React-CoreModules', :path => '../node_modules/react-native/React/CoreModules' 56 | pod 'React-Core/DevSupport', :path => '../node_modules/react-native/' 57 | pod 'React-RCTActionSheet', :path => '../node_modules/react-native/Libraries/ActionSheetIOS' 58 | pod 'React-RCTAnimation', :path => '../node_modules/react-native/Libraries/NativeAnimation' 59 | pod 'React-RCTBlob', :path => '../node_modules/react-native/Libraries/Blob' 60 | pod 'React-RCTImage', :path => '../node_modules/react-native/Libraries/Image' 61 | pod 'React-RCTLinking', :path => '../node_modules/react-native/Libraries/LinkingIOS' 62 | pod 'React-RCTNetwork', :path => '../node_modules/react-native/Libraries/Network' 63 | pod 'React-RCTSettings', :path => '../node_modules/react-native/Libraries/Settings' 64 | pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text' 65 | pod 'React-RCTVibration', :path => '../node_modules/react-native/Libraries/Vibration' 66 | pod 'React-Core/RCTWebSocket', :path => '../node_modules/react-native/' 67 | 68 | pod 'React-cxxreact', :path => '../node_modules/react-native/ReactCommon/cxxreact' 69 | pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi' 70 | pod 'React-jsiexecutor', :path => '../node_modules/react-native/ReactCommon/jsiexecutor' 71 | pod 'React-jsinspector', :path => '../node_modules/react-native/ReactCommon/jsinspector' 72 | pod 'ReactCommon/callinvoker', :path => "../node_modules/react-native/ReactCommon" 73 | pod 'ReactCommon/turbomodule/core', :path => "../node_modules/react-native/ReactCommon" 74 | pod 'Yoga', :path => '../node_modules/react-native/ReactCommon/yoga', :modular_headers => true 75 | 76 | pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec' 77 | pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec' 78 | pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec' 79 | 80 | pod '{{packageName}}', :path => '../../' 81 | {{#unless usesComponentKit}} 82 | 83 | pod 'SwiftLint' 84 | {{/unless}} 85 | 86 | target '{{appName}}Tests' do 87 | inherit! :complete 88 | # Pods for testing 89 | end 90 | 91 | use_native_modules! 92 | 93 | # Enables Flipper. 94 | # 95 | # Note that if you have use_frameworks! enabled, Flipper will not work and 96 | # you should disable these next few lines. 97 | add_flipper_pods! 98 | post_install do |installer| 99 | flipper_post_install(installer) 100 | end 101 | end 102 | -------------------------------------------------------------------------------- /template/example/ios/empty.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | -------------------------------------------------------------------------------- /template/example/ios/{{appName}}-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | // 2 | // Use this file to import your target's public headers that you would like to expose to Swift. 3 | // 4 | 5 | -------------------------------------------------------------------------------- /template/example/ios/{{appName}}.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 13B07FBC1A68108700A75B9A /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB01A68108700A75B9A /* AppDelegate.m */; }; 11 | 13B07FBD1A68108700A75B9A /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB11A68108700A75B9A /* LaunchScreen.xib */; }; 12 | 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; }; 13 | 13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; }; 14 | 3A53AD83D59C97BD111E5122 /* libPods-{{appName}}-{{appName}}Tests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 1BCF9AD9EBBA7155E1D4E4E8 /* libPods-{{appName}}-{{appName}}Tests.a */; }; 15 | {{#unless usesComponentKit}} 16 | 746C4BEF2459F9B2001E6020 /* empty.swift in Sources */ = {isa = PBXBuildFile; fileRef = 746C4BEE2459F9B2001E6020 /* empty.swift */; }; 17 | 746C4BF22459F9CA001E6020 /* {{appName}}Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 746C4BF12459F9CA001E6020 /* {{appName}}Tests.swift */; }; 18 | {{else}} 19 | 74ECE77624A2D4D5004FD0D0 /* {{appName}}Tests.m in Sources */ = {isa = PBXBuildFile; fileRef = 74ECE77524A2D4D5004FD0D0 /* {{appName}}Tests.m */; }; 20 | {{/unless}} 21 | D9640D77AFFAF29CD4846835 /* libPods-{{appName}}.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 8C14A143EE359C564D85A054 /* libPods-{{appName}}.a */; }; 22 | /* End PBXBuildFile section */ 23 | 24 | /* Begin PBXContainerItemProxy section */ 25 | 00E356F41AD99517003FC87E /* PBXContainerItemProxy */ = { 26 | isa = PBXContainerItemProxy; 27 | containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */; 28 | proxyType = 1; 29 | remoteGlobalIDString = 13B07F861A680F5B00A75B9A; 30 | remoteInfo = {{appName}}; 31 | }; 32 | /* End PBXContainerItemProxy section */ 33 | 34 | /* Begin PBXFileReference section */ 35 | 008F07F21AC5B25A0029DE68 /* main.jsbundle */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = main.jsbundle; sourceTree = ""; }; 36 | 00E356EE1AD99517003FC87E /* {{appName}}Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = {{appName}}Tests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 37 | 00E356F11AD99517003FC87E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 38 | 13B07F961A680F5B00A75B9A /* {{appName}}.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = {{appName}}.app; sourceTree = BUILT_PRODUCTS_DIR; }; 39 | 13B07FAF1A68108700A75B9A /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppDelegate.h; path = {{appName}}/AppDelegate.h; sourceTree = ""; }; 40 | 13B07FB01A68108700A75B9A /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AppDelegate.m; path = {{appName}}/AppDelegate.m; sourceTree = ""; }; 41 | 13B07FB21A68108700A75B9A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; 42 | 13B07FB51A68108700A75B9A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = {{appName}}/Images.xcassets; sourceTree = ""; }; 43 | 13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = {{appName}}/Info.plist; sourceTree = ""; }; 44 | 13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = {{appName}}/main.m; sourceTree = ""; }; 45 | 1BCF9AD9EBBA7155E1D4E4E8 /* libPods-{{appName}}-{{appName}}Tests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-{{appName}}-{{appName}}Tests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 46 | 1F7B058A711A43D60959BE98 /* Pods-{{appName}}.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-{{appName}}.debug.xcconfig"; path = "Target Support Files/Pods-{{appName}}/Pods-{{appName}}.debug.xcconfig"; sourceTree = ""; }; 47 | {{#unless usesComponentKit}} 48 | 746C4BED2459F9B1001E6020 /* {{appName}}-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "{{appName}}-Bridging-Header.h"; sourceTree = ""; }; 49 | 746C4BEE2459F9B2001E6020 /* empty.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = empty.swift; sourceTree = ""; }; 50 | 746C4BF02459F9C9001E6020 /* {{appName}}Tests-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "{{appName}}Tests-Bridging-Header.h"; sourceTree = ""; }; 51 | 746C4BF12459F9CA001E6020 /* {{appName}}Tests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = {{appName}}Tests.swift; sourceTree = ""; }; 52 | {{else}} 53 | 74ECE77524A2D4D5004FD0D0 /* {{appName}}Tests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = {{appName}}Tests.m; sourceTree = ""; }; 54 | {{/unless}} 55 | 8C14A143EE359C564D85A054 /* libPods-{{appName}}.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-{{appName}}.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 56 | B1776C9724F7C106BB2DD5F5 /* Pods-{{appName}}-{{appName}}Tests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-{{appName}}-{{appName}}Tests.debug.xcconfig"; path = "Target Support Files/Pods-{{appName}}-{{appName}}Tests/Pods-{{appName}}-{{appName}}Tests.debug.xcconfig"; sourceTree = ""; }; 57 | ECBC5F5387C6F7C192F74149 /* Pods-{{appName}}.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-{{appName}}.release.xcconfig"; path = "Target Support Files/Pods-{{appName}}/Pods-{{appName}}.release.xcconfig"; sourceTree = ""; }; 58 | ECD6E46A56A353F20CC64700 /* Pods-{{appName}}-{{appName}}Tests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-{{appName}}-{{appName}}Tests.release.xcconfig"; path = "Target Support Files/Pods-{{appName}}-{{appName}}Tests/Pods-{{appName}}-{{appName}}Tests.release.xcconfig"; sourceTree = ""; }; 59 | ED297162215061F000B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; }; 60 | /* End PBXFileReference section */ 61 | 62 | /* Begin PBXFrameworksBuildPhase section */ 63 | 00E356EB1AD99517003FC87E /* Frameworks */ = { 64 | isa = PBXFrameworksBuildPhase; 65 | buildActionMask = 2147483647; 66 | files = ( 67 | 3A53AD83D59C97BD111E5122 /* libPods-{{appName}}-{{appName}}Tests.a in Frameworks */, 68 | ); 69 | runOnlyForDeploymentPostprocessing = 0; 70 | }; 71 | 13B07F8C1A680F5B00A75B9A /* Frameworks */ = { 72 | isa = PBXFrameworksBuildPhase; 73 | buildActionMask = 2147483647; 74 | files = ( 75 | D9640D77AFFAF29CD4846835 /* libPods-{{appName}}.a in Frameworks */, 76 | ); 77 | runOnlyForDeploymentPostprocessing = 0; 78 | }; 79 | /* End PBXFrameworksBuildPhase section */ 80 | 81 | /* Begin PBXGroup section */ 82 | 00E356EF1AD99517003FC87E /* {{appName}}Tests */ = { 83 | isa = PBXGroup; 84 | children = ( 85 | {{#unless usesComponentKit}} 86 | 746C4BF12459F9CA001E6020 /* {{appName}}Tests.swift */, 87 | 746C4BF02459F9C9001E6020 /* {{appName}}Tests-Bridging-Header.h */, 88 | {{else}} 89 | 74ECE77524A2D4D5004FD0D0 /* {{appName}}Tests.m */, 90 | {{/unless}} 91 | 00E356F01AD99517003FC87E /* Supporting Files */, 92 | ); 93 | path = {{appName}}Tests; 94 | sourceTree = ""; 95 | }; 96 | 00E356F01AD99517003FC87E /* Supporting Files */ = { 97 | isa = PBXGroup; 98 | children = ( 99 | 00E356F11AD99517003FC87E /* Info.plist */, 100 | ); 101 | name = "Supporting Files"; 102 | sourceTree = ""; 103 | }; 104 | 13B07FAE1A68108700A75B9A /* {{appName}} */ = { 105 | isa = PBXGroup; 106 | children = ( 107 | 008F07F21AC5B25A0029DE68 /* main.jsbundle */, 108 | 13B07FAF1A68108700A75B9A /* AppDelegate.h */, 109 | 13B07FB01A68108700A75B9A /* AppDelegate.m */, 110 | 13B07FB51A68108700A75B9A /* Images.xcassets */, 111 | 13B07FB61A68108700A75B9A /* Info.plist */, 112 | 13B07FB11A68108700A75B9A /* LaunchScreen.xib */, 113 | 13B07FB71A68108700A75B9A /* main.m */, 114 | {{#unless usesComponentKit}} 115 | 746C4BEE2459F9B2001E6020 /* empty.swift */, 116 | 746C4BED2459F9B1001E6020 /* {{appName}}-Bridging-Header.h */, 117 | {{/unless}} 118 | ); 119 | name = {{appName}}; 120 | sourceTree = ""; 121 | }; 122 | 2D16E6871FA4F8E400B85C8A /* Frameworks */ = { 123 | isa = PBXGroup; 124 | children = ( 125 | ED297162215061F000B7C4FE /* JavaScriptCore.framework */, 126 | 8C14A143EE359C564D85A054 /* libPods-{{appName}}.a */, 127 | 1BCF9AD9EBBA7155E1D4E4E8 /* libPods-{{appName}}-{{appName}}Tests.a */, 128 | ); 129 | name = Frameworks; 130 | sourceTree = ""; 131 | }; 132 | 832341AE1AAA6A7D00B99B32 /* Libraries */ = { 133 | isa = PBXGroup; 134 | children = ( 135 | ); 136 | name = Libraries; 137 | sourceTree = ""; 138 | }; 139 | 83CBB9F61A601CBA00E9B192 = { 140 | isa = PBXGroup; 141 | children = ( 142 | 13B07FAE1A68108700A75B9A /* {{appName}} */, 143 | 832341AE1AAA6A7D00B99B32 /* Libraries */, 144 | 00E356EF1AD99517003FC87E /* {{appName}}Tests */, 145 | 83CBBA001A601CBA00E9B192 /* Products */, 146 | 2D16E6871FA4F8E400B85C8A /* Frameworks */, 147 | ED4A12158B4A0924001A603B /* Pods */, 148 | ); 149 | indentWidth = 2; 150 | sourceTree = ""; 151 | tabWidth = 2; 152 | usesTabs = 0; 153 | }; 154 | 83CBBA001A601CBA00E9B192 /* Products */ = { 155 | isa = PBXGroup; 156 | children = ( 157 | 13B07F961A680F5B00A75B9A /* {{appName}}.app */, 158 | 00E356EE1AD99517003FC87E /* {{appName}}Tests.xctest */, 159 | ); 160 | name = Products; 161 | sourceTree = ""; 162 | }; 163 | ED4A12158B4A0924001A603B /* Pods */ = { 164 | isa = PBXGroup; 165 | children = ( 166 | 1F7B058A711A43D60959BE98 /* Pods-{{appName}}.debug.xcconfig */, 167 | ECBC5F5387C6F7C192F74149 /* Pods-{{appName}}.release.xcconfig */, 168 | B1776C9724F7C106BB2DD5F5 /* Pods-{{appName}}-{{appName}}Tests.debug.xcconfig */, 169 | ECD6E46A56A353F20CC64700 /* Pods-{{appName}}-{{appName}}Tests.release.xcconfig */, 170 | ); 171 | path = Pods; 172 | sourceTree = ""; 173 | }; 174 | /* End PBXGroup section */ 175 | 176 | /* Begin PBXNativeTarget section */ 177 | 00E356ED1AD99517003FC87E /* {{appName}}Tests */ = { 178 | isa = PBXNativeTarget; 179 | buildConfigurationList = 00E357021AD99517003FC87E /* Build configuration list for PBXNativeTarget "{{appName}}Tests" */; 180 | buildPhases = ( 181 | 7ECAE1A36BD4A78D5C1C1416 /* [CP] Check Pods Manifest.lock */, 182 | 00E356EA1AD99517003FC87E /* Sources */, 183 | 00E356EB1AD99517003FC87E /* Frameworks */, 184 | 00E356EC1AD99517003FC87E /* Resources */, 185 | ); 186 | buildRules = ( 187 | ); 188 | dependencies = ( 189 | 00E356F51AD99517003FC87E /* PBXTargetDependency */, 190 | ); 191 | name = {{appName}}Tests; 192 | productName = {{appName}}Tests; 193 | productReference = 00E356EE1AD99517003FC87E /* {{appName}}Tests.xctest */; 194 | productType = "com.apple.product-type.bundle.unit-test"; 195 | }; 196 | 13B07F861A680F5B00A75B9A /* {{appName}} */ = { 197 | isa = PBXNativeTarget; 198 | buildConfigurationList = 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "{{appName}}" */; 199 | buildPhases = ( 200 | DEF0A39D21D98F692AE4C03B /* [CP] Check Pods Manifest.lock */, 201 | {{#unless usesComponentKit}} 202 | 7497CD0B2463708500312218 /* SwiftLint */, 203 | {{/unless}} 204 | FD10A7F022414F080027D42C /* Start Packager */, 205 | 13B07F871A680F5B00A75B9A /* Sources */, 206 | 13B07F8C1A680F5B00A75B9A /* Frameworks */, 207 | 13B07F8E1A680F5B00A75B9A /* Resources */, 208 | 00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */, 209 | ); 210 | buildRules = ( 211 | ); 212 | dependencies = ( 213 | ); 214 | name = {{appName}}; 215 | productName = {{appName}}; 216 | productReference = 13B07F961A680F5B00A75B9A /* {{appName}}.app */; 217 | productType = "com.apple.product-type.application"; 218 | }; 219 | /* End PBXNativeTarget section */ 220 | 221 | /* Begin PBXProject section */ 222 | 83CBB9F71A601CBA00E9B192 /* Project object */ = { 223 | isa = PBXProject; 224 | attributes = { 225 | LastUpgradeCheck = 1130; 226 | TargetAttributes = { 227 | 00E356ED1AD99517003FC87E = { 228 | CreatedOnToolsVersion = 6.2; 229 | LastSwiftMigration = 1140; 230 | TestTargetID = 13B07F861A680F5B00A75B9A; 231 | }; 232 | 13B07F861A680F5B00A75B9A = { 233 | LastSwiftMigration = 1140; 234 | }; 235 | }; 236 | }; 237 | buildConfigurationList = 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "{{appName}}" */; 238 | compatibilityVersion = "Xcode 3.2"; 239 | developmentRegion = en; 240 | hasScannedForEncodings = 0; 241 | knownRegions = ( 242 | en, 243 | Base, 244 | ); 245 | mainGroup = 83CBB9F61A601CBA00E9B192; 246 | productRefGroup = 83CBBA001A601CBA00E9B192 /* Products */; 247 | projectDirPath = ""; 248 | projectRoot = ""; 249 | targets = ( 250 | 13B07F861A680F5B00A75B9A /* {{appName}} */, 251 | 00E356ED1AD99517003FC87E /* {{appName}}Tests */, 252 | ); 253 | }; 254 | /* End PBXProject section */ 255 | 256 | /* Begin PBXResourcesBuildPhase section */ 257 | 00E356EC1AD99517003FC87E /* Resources */ = { 258 | isa = PBXResourcesBuildPhase; 259 | buildActionMask = 2147483647; 260 | files = ( 261 | ); 262 | runOnlyForDeploymentPostprocessing = 0; 263 | }; 264 | 13B07F8E1A680F5B00A75B9A /* Resources */ = { 265 | isa = PBXResourcesBuildPhase; 266 | buildActionMask = 2147483647; 267 | files = ( 268 | 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */, 269 | 13B07FBD1A68108700A75B9A /* LaunchScreen.xib in Resources */, 270 | ); 271 | runOnlyForDeploymentPostprocessing = 0; 272 | }; 273 | /* End PBXResourcesBuildPhase section */ 274 | 275 | /* Begin PBXShellScriptBuildPhase section */ 276 | 00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */ = { 277 | isa = PBXShellScriptBuildPhase; 278 | buildActionMask = 2147483647; 279 | files = ( 280 | ); 281 | inputPaths = ( 282 | ); 283 | name = "Bundle React Native code and images"; 284 | outputPaths = ( 285 | ); 286 | runOnlyForDeploymentPostprocessing = 0; 287 | shellPath = /bin/sh; 288 | shellScript = "if [ -z \"${RCT_NO_BUNDLE+xxx}\" ] ; then\n export NODE_BINARY=node\n ../node_modules/react-native/scripts/react-native-xcode.sh\nfi\n"; 289 | }; 290 | {{#unless usesComponentKit}} 291 | 7497CD0B2463708500312218 /* SwiftLint */ = { 292 | isa = PBXShellScriptBuildPhase; 293 | buildActionMask = 2147483647; 294 | files = ( 295 | ); 296 | inputFileListPaths = ( 297 | ); 298 | inputPaths = ( 299 | ); 300 | name = SwiftLint; 301 | outputFileListPaths = ( 302 | ); 303 | outputPaths = ( 304 | ); 305 | runOnlyForDeploymentPostprocessing = 0; 306 | shellPath = /bin/sh; 307 | shellScript = "cd ../../ios && \"${PODS_ROOT}/SwiftLint/swiftlint\"\n"; 308 | }; 309 | {{/unless}} 310 | 7ECAE1A36BD4A78D5C1C1416 /* [CP] Check Pods Manifest.lock */ = { 311 | isa = PBXShellScriptBuildPhase; 312 | buildActionMask = 2147483647; 313 | files = ( 314 | ); 315 | inputFileListPaths = ( 316 | ); 317 | inputPaths = ( 318 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 319 | "${PODS_ROOT}/Manifest.lock", 320 | ); 321 | name = "[CP] Check Pods Manifest.lock"; 322 | outputFileListPaths = ( 323 | ); 324 | outputPaths = ( 325 | "$(DERIVED_FILE_DIR)/Pods-{{appName}}-{{appName}}Tests-checkManifestLockResult.txt", 326 | ); 327 | runOnlyForDeploymentPostprocessing = 0; 328 | shellPath = /bin/sh; 329 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; 330 | showEnvVarsInLog = 0; 331 | }; 332 | DEF0A39D21D98F692AE4C03B /* [CP] Check Pods Manifest.lock */ = { 333 | isa = PBXShellScriptBuildPhase; 334 | buildActionMask = 2147483647; 335 | files = ( 336 | ); 337 | inputFileListPaths = ( 338 | ); 339 | inputPaths = ( 340 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 341 | "${PODS_ROOT}/Manifest.lock", 342 | ); 343 | name = "[CP] Check Pods Manifest.lock"; 344 | outputFileListPaths = ( 345 | ); 346 | outputPaths = ( 347 | "$(DERIVED_FILE_DIR)/Pods-{{appName}}-checkManifestLockResult.txt", 348 | ); 349 | runOnlyForDeploymentPostprocessing = 0; 350 | shellPath = /bin/sh; 351 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; 352 | showEnvVarsInLog = 0; 353 | }; 354 | FD10A7F022414F080027D42C /* Start Packager */ = { 355 | isa = PBXShellScriptBuildPhase; 356 | buildActionMask = 2147483647; 357 | files = ( 358 | ); 359 | inputFileListPaths = ( 360 | ); 361 | inputPaths = ( 362 | ); 363 | name = "Start Packager"; 364 | outputFileListPaths = ( 365 | ); 366 | outputPaths = ( 367 | ); 368 | runOnlyForDeploymentPostprocessing = 0; 369 | shellPath = /bin/sh; 370 | shellScript = "export RCT_METRO_PORT=\"${RCT_METRO_PORT:=8081}\"\necho \"export RCT_METRO_PORT=${RCT_METRO_PORT}\" > \"${SRCROOT}/../node_modules/react-native/scripts/.packager.env\"\nif [ -z \"${RCT_NO_LAUNCH_PACKAGER+xxx}\" ] ; then\n if nc -w 5 -z localhost ${RCT_METRO_PORT} ; then\n if ! curl -s \"http://localhost:${RCT_METRO_PORT}/status\" | grep -q \"packager-status:running\" ; then\n echo \"Port ${RCT_METRO_PORT} already in use, packager is either not running or not running correctly\"\n exit 2\n fi\n else\n open \"$SRCROOT/../node_modules/react-native/scripts/launchPackager.command\" || echo \"Can't start packager automatically\"\n fi\nfi\n"; 371 | showEnvVarsInLog = 0; 372 | }; 373 | /* End PBXShellScriptBuildPhase section */ 374 | 375 | /* Begin PBXSourcesBuildPhase section */ 376 | 00E356EA1AD99517003FC87E /* Sources */ = { 377 | isa = PBXSourcesBuildPhase; 378 | buildActionMask = 2147483647; 379 | files = ( 380 | {{#unless usesComponentKit}} 381 | 746C4BF22459F9CA001E6020 /* {{appName}}Tests.swift in Sources */, 382 | {{else}} 383 | 74ECE77624A2D4D5004FD0D0 /* {{appName}}Tests.m in Sources */, 384 | {{/unless}} 385 | ); 386 | runOnlyForDeploymentPostprocessing = 0; 387 | }; 388 | 13B07F871A680F5B00A75B9A /* Sources */ = { 389 | isa = PBXSourcesBuildPhase; 390 | buildActionMask = 2147483647; 391 | files = ( 392 | 13B07FBC1A68108700A75B9A /* AppDelegate.m in Sources */, 393 | 13B07FC11A68108700A75B9A /* main.m in Sources */, 394 | {{#unless usesComponentKit}} 395 | 746C4BEF2459F9B2001E6020 /* empty.swift in Sources */, 396 | {{/unless}} 397 | ); 398 | runOnlyForDeploymentPostprocessing = 0; 399 | }; 400 | /* End PBXSourcesBuildPhase section */ 401 | 402 | /* Begin PBXTargetDependency section */ 403 | 00E356F51AD99517003FC87E /* PBXTargetDependency */ = { 404 | isa = PBXTargetDependency; 405 | target = 13B07F861A680F5B00A75B9A /* {{appName}} */; 406 | targetProxy = 00E356F41AD99517003FC87E /* PBXContainerItemProxy */; 407 | }; 408 | /* End PBXTargetDependency section */ 409 | 410 | /* Begin PBXVariantGroup section */ 411 | 13B07FB11A68108700A75B9A /* LaunchScreen.xib */ = { 412 | isa = PBXVariantGroup; 413 | children = ( 414 | 13B07FB21A68108700A75B9A /* Base */, 415 | ); 416 | name = LaunchScreen.xib; 417 | path = {{appName}}; 418 | sourceTree = ""; 419 | }; 420 | /* End PBXVariantGroup section */ 421 | 422 | /* Begin XCBuildConfiguration section */ 423 | 00E356F61AD99517003FC87E /* Debug */ = { 424 | isa = XCBuildConfiguration; 425 | baseConfigurationReference = B1776C9724F7C106BB2DD5F5 /* Pods-{{appName}}-{{appName}}Tests.debug.xcconfig */; 426 | buildSettings = { 427 | {{#unless usesComponentKit}} 428 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = "$(inherited)"; 429 | {{/unless}} 430 | BUNDLE_LOADER = "$(TEST_HOST)"; 431 | CLANG_ENABLE_MODULES = YES; 432 | GCC_PREPROCESSOR_DEFINITIONS = ( 433 | "DEBUG=1", 434 | "$(inherited)", 435 | ); 436 | INFOPLIST_FILE = {{appName}}Tests/Info.plist; 437 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 438 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 439 | OTHER_LDFLAGS = ( 440 | "-ObjC", 441 | "-lc++", 442 | "$(inherited)", 443 | ); 444 | PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.{{appName}}.$(PRODUCT_NAME:rfc1034identifier)"; 445 | PRODUCT_NAME = "$(TARGET_NAME)"; 446 | {{#unless usesComponentKit}} 447 | SWIFT_OBJC_BRIDGING_HEADER = "{{appName}}Tests/{{appName}}Tests-Bridging-Header.h"; 448 | {{/unless}} 449 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 450 | SWIFT_VERSION = 5.0; 451 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/{{appName}}.app/{{appName}}"; 452 | }; 453 | name = Debug; 454 | }; 455 | 00E356F71AD99517003FC87E /* Release */ = { 456 | isa = XCBuildConfiguration; 457 | baseConfigurationReference = ECD6E46A56A353F20CC64700 /* Pods-{{appName}}-{{appName}}Tests.release.xcconfig */; 458 | buildSettings = { 459 | {{#unless usesComponentKit}} 460 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = "$(inherited)"; 461 | {{/unless}} 462 | BUNDLE_LOADER = "$(TEST_HOST)"; 463 | CLANG_ENABLE_MODULES = YES; 464 | COPY_PHASE_STRIP = NO; 465 | INFOPLIST_FILE = {{appName}}Tests/Info.plist; 466 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 467 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 468 | OTHER_LDFLAGS = ( 469 | "-ObjC", 470 | "-lc++", 471 | "$(inherited)", 472 | ); 473 | PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.{{appName}}.$(PRODUCT_NAME:rfc1034identifier)"; 474 | PRODUCT_NAME = "$(TARGET_NAME)"; 475 | {{#unless usesComponentKit}} 476 | SWIFT_OBJC_BRIDGING_HEADER = "{{appName}}Tests/{{appName}}Tests-Bridging-Header.h"; 477 | {{/unless}} 478 | SWIFT_VERSION = 5.0; 479 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/{{appName}}.app/{{appName}}"; 480 | }; 481 | name = Release; 482 | }; 483 | 13B07F941A680F5B00A75B9A /* Debug */ = { 484 | isa = XCBuildConfiguration; 485 | baseConfigurationReference = 1F7B058A711A43D60959BE98 /* Pods-{{appName}}.debug.xcconfig */; 486 | buildSettings = { 487 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 488 | CLANG_ENABLE_MODULES = YES; 489 | CURRENT_PROJECT_VERSION = 1; 490 | ENABLE_BITCODE = NO; 491 | GCC_PREPROCESSOR_DEFINITIONS = ( 492 | "$(inherited)", 493 | "FB_SONARKIT_ENABLED=1", 494 | ); 495 | INFOPLIST_FILE = {{appName}}/Info.plist; 496 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 497 | OTHER_LDFLAGS = ( 498 | "$(inherited)", 499 | "-ObjC", 500 | "-lc++", 501 | ); 502 | PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.{{appName}}.$(PRODUCT_NAME:rfc1034identifier)"; 503 | PRODUCT_NAME = {{appName}}; 504 | {{#unless usesComponentKit}} 505 | SWIFT_OBJC_BRIDGING_HEADER = "{{appName}}-Bridging-Header.h"; 506 | {{/unless}} 507 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 508 | SWIFT_VERSION = 5.0; 509 | TARGETED_DEVICE_FAMILY = "1,2"; 510 | VERSIONING_SYSTEM = "apple-generic"; 511 | }; 512 | name = Debug; 513 | }; 514 | 13B07F951A680F5B00A75B9A /* Release */ = { 515 | isa = XCBuildConfiguration; 516 | baseConfigurationReference = ECBC5F5387C6F7C192F74149 /* Pods-{{appName}}.release.xcconfig */; 517 | buildSettings = { 518 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 519 | CLANG_ENABLE_MODULES = YES; 520 | CURRENT_PROJECT_VERSION = 1; 521 | INFOPLIST_FILE = {{appName}}/Info.plist; 522 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 523 | OTHER_LDFLAGS = ( 524 | "$(inherited)", 525 | "-ObjC", 526 | "-lc++", 527 | ); 528 | PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.{{appName}}.$(PRODUCT_NAME:rfc1034identifier)"; 529 | PRODUCT_NAME = {{appName}}; 530 | {{#unless usesComponentKit}} 531 | SWIFT_OBJC_BRIDGING_HEADER = "{{appName}}-Bridging-Header.h"; 532 | {{/unless}} 533 | SWIFT_VERSION = 5.0; 534 | TARGETED_DEVICE_FAMILY = "1,2"; 535 | VERSIONING_SYSTEM = "apple-generic"; 536 | }; 537 | name = Release; 538 | }; 539 | 83CBBA201A601CBA00E9B192 /* Debug */ = { 540 | isa = XCBuildConfiguration; 541 | buildSettings = { 542 | ALWAYS_SEARCH_USER_PATHS = NO; 543 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; 544 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 545 | CLANG_CXX_LIBRARY = "libc++"; 546 | CLANG_ENABLE_MODULES = YES; 547 | CLANG_ENABLE_OBJC_ARC = YES; 548 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 549 | CLANG_WARN_BOOL_CONVERSION = YES; 550 | CLANG_WARN_COMMA = YES; 551 | CLANG_WARN_CONSTANT_CONVERSION = YES; 552 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 553 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 554 | CLANG_WARN_EMPTY_BODY = YES; 555 | CLANG_WARN_ENUM_CONVERSION = YES; 556 | CLANG_WARN_INFINITE_RECURSION = YES; 557 | CLANG_WARN_INT_CONVERSION = YES; 558 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 559 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 560 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 561 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 562 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 563 | CLANG_WARN_STRICT_PROTOTYPES = YES; 564 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 565 | CLANG_WARN_UNREACHABLE_CODE = YES; 566 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 567 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 568 | COPY_PHASE_STRIP = NO; 569 | ENABLE_STRICT_OBJC_MSGSEND = YES; 570 | ENABLE_TESTABILITY = YES; 571 | GCC_C_LANGUAGE_STANDARD = gnu99; 572 | GCC_DYNAMIC_NO_PIC = NO; 573 | GCC_NO_COMMON_BLOCKS = YES; 574 | GCC_OPTIMIZATION_LEVEL = 0; 575 | GCC_PREPROCESSOR_DEFINITIONS = ( 576 | "DEBUG=1", 577 | "$(inherited)", 578 | ); 579 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 580 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 581 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 582 | GCC_WARN_UNDECLARED_SELECTOR = YES; 583 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 584 | GCC_WARN_UNUSED_FUNCTION = YES; 585 | GCC_WARN_UNUSED_VARIABLE = YES; 586 | IPHONEOS_DEPLOYMENT_TARGET = {{iosVersion}}; 587 | LD_RUNPATH_SEARCH_PATHS = "/usr/lib/swift $(inherited)"; 588 | LIBRARY_SEARCH_PATHS = ( 589 | "\"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)\"", 590 | {{#unless usesSwiftUI}} 591 | "\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)\"", 592 | {{/unless}} 593 | "\"$(inherited)\"", 594 | ); 595 | MTL_ENABLE_DEBUG_INFO = YES; 596 | ONLY_ACTIVE_ARCH = YES; 597 | SDKROOT = iphoneos; 598 | }; 599 | name = Debug; 600 | }; 601 | 83CBBA211A601CBA00E9B192 /* Release */ = { 602 | isa = XCBuildConfiguration; 603 | buildSettings = { 604 | ALWAYS_SEARCH_USER_PATHS = NO; 605 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; 606 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 607 | CLANG_CXX_LIBRARY = "libc++"; 608 | CLANG_ENABLE_MODULES = YES; 609 | CLANG_ENABLE_OBJC_ARC = YES; 610 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 611 | CLANG_WARN_BOOL_CONVERSION = YES; 612 | CLANG_WARN_COMMA = YES; 613 | CLANG_WARN_CONSTANT_CONVERSION = YES; 614 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 615 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 616 | CLANG_WARN_EMPTY_BODY = YES; 617 | CLANG_WARN_ENUM_CONVERSION = YES; 618 | CLANG_WARN_INFINITE_RECURSION = YES; 619 | CLANG_WARN_INT_CONVERSION = YES; 620 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 621 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 622 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 623 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 624 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 625 | CLANG_WARN_STRICT_PROTOTYPES = YES; 626 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 627 | CLANG_WARN_UNREACHABLE_CODE = YES; 628 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 629 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 630 | COPY_PHASE_STRIP = YES; 631 | ENABLE_NS_ASSERTIONS = NO; 632 | ENABLE_STRICT_OBJC_MSGSEND = YES; 633 | GCC_C_LANGUAGE_STANDARD = gnu99; 634 | GCC_NO_COMMON_BLOCKS = YES; 635 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 636 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 637 | GCC_WARN_UNDECLARED_SELECTOR = YES; 638 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 639 | GCC_WARN_UNUSED_FUNCTION = YES; 640 | GCC_WARN_UNUSED_VARIABLE = YES; 641 | IPHONEOS_DEPLOYMENT_TARGET = {{iosVersion}}; 642 | LD_RUNPATH_SEARCH_PATHS = "/usr/lib/swift $(inherited)"; 643 | LIBRARY_SEARCH_PATHS = ( 644 | "\"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)\"", 645 | {{#unless usesSwiftUI}} 646 | "\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)\"", 647 | {{/unless}} 648 | "\"$(inherited)\"", 649 | ); 650 | MTL_ENABLE_DEBUG_INFO = NO; 651 | SDKROOT = iphoneos; 652 | VALIDATE_PRODUCT = YES; 653 | }; 654 | name = Release; 655 | }; 656 | /* End XCBuildConfiguration section */ 657 | 658 | /* Begin XCConfigurationList section */ 659 | 00E357021AD99517003FC87E /* Build configuration list for PBXNativeTarget "{{appName}}Tests" */ = { 660 | isa = XCConfigurationList; 661 | buildConfigurations = ( 662 | 00E356F61AD99517003FC87E /* Debug */, 663 | 00E356F71AD99517003FC87E /* Release */, 664 | ); 665 | defaultConfigurationIsVisible = 0; 666 | defaultConfigurationName = Release; 667 | }; 668 | 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "{{appName}}" */ = { 669 | isa = XCConfigurationList; 670 | buildConfigurations = ( 671 | 13B07F941A680F5B00A75B9A /* Debug */, 672 | 13B07F951A680F5B00A75B9A /* Release */, 673 | ); 674 | defaultConfigurationIsVisible = 0; 675 | defaultConfigurationName = Release; 676 | }; 677 | 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "{{appName}}" */ = { 678 | isa = XCConfigurationList; 679 | buildConfigurations = ( 680 | 83CBBA201A601CBA00E9B192 /* Debug */, 681 | 83CBBA211A601CBA00E9B192 /* Release */, 682 | ); 683 | defaultConfigurationIsVisible = 0; 684 | defaultConfigurationName = Release; 685 | }; 686 | /* End XCConfigurationList section */ 687 | }; 688 | rootObject = 83CBB9F71A601CBA00E9B192 /* Project object */; 689 | } 690 | -------------------------------------------------------------------------------- /template/example/ios/{{appName}}.xcodeproj/xcshareddata/xcschemes/{{appName}}.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 42 | 43 | 53 | 55 | 61 | 62 | 63 | 64 | 70 | 72 | 78 | 79 | 80 | 81 | 83 | 84 | 87 | 88 | 89 | -------------------------------------------------------------------------------- /template/example/ios/{{appName}}.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /template/example/ios/{{appName}}/AppDelegate.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | @interface AppDelegate : UIResponder 5 | 6 | @property (nonatomic, strong) UIWindow *window; 7 | 8 | @end 9 | -------------------------------------------------------------------------------- /template/example/ios/{{appName}}/AppDelegate.m: -------------------------------------------------------------------------------- 1 | #import "AppDelegate.h" 2 | 3 | #import 4 | #import 5 | #import 6 | 7 | #if DEBUG 8 | #import 9 | #import 10 | #import 11 | #import 12 | #import 13 | #import 14 | 15 | static void InitializeFlipper(UIApplication *application) { 16 | FlipperClient *client = [FlipperClient sharedClient]; 17 | SKDescriptorMapper *layoutDescriptorMapper = [[SKDescriptorMapper alloc] initWithDefaults]; 18 | [client addPlugin:[[FlipperKitLayoutPlugin alloc] initWithRootNode:application withDescriptorMapper:layoutDescriptorMapper]]; 19 | [client addPlugin:[[FKUserDefaultsPlugin alloc] initWithSuiteName:nil]]; 20 | [client addPlugin:[FlipperKitReactPlugin new]]; 21 | [client addPlugin:[[FlipperKitNetworkPlugin alloc] initWithNetworkAdapter:[SKIOSNetworkAdapter new]]]; 22 | [client start]; 23 | } 24 | #endif 25 | 26 | @implementation AppDelegate 27 | 28 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 29 | { 30 | #if DEBUG 31 | InitializeFlipper(application); 32 | #endif 33 | 34 | RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions]; 35 | RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge 36 | moduleName:@"{{appName}}" 37 | initialProperties:nil]; 38 | 39 | rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1]; 40 | 41 | self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; 42 | UIViewController *rootViewController = [UIViewController new]; 43 | rootViewController.view = rootView; 44 | self.window.rootViewController = rootViewController; 45 | [self.window makeKeyAndVisible]; 46 | return YES; 47 | } 48 | 49 | - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge 50 | { 51 | #if DEBUG 52 | return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil]; 53 | #else 54 | return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]; 55 | #endif 56 | } 57 | 58 | @end 59 | -------------------------------------------------------------------------------- /template/example/ios/{{appName}}/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 21 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /template/example/ios/{{appName}}/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /template/example/ios/{{appName}}/Images.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /template/example/ios/{{appName}}/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | {{appName}} 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | LSRequiresIPhoneOS 26 | 27 | NSAppTransportSecurity 28 | 29 | NSAllowsArbitraryLoads 30 | 31 | NSExceptionDomains 32 | 33 | localhost 34 | 35 | NSExceptionAllowsInsecureHTTPLoads 36 | 37 | 38 | 39 | 40 | NSLocationWhenInUseUsageDescription 41 | 42 | UILaunchStoryboardName 43 | LaunchScreen 44 | UIRequiredDeviceCapabilities 45 | 46 | armv7 47 | 48 | UISupportedInterfaceOrientations 49 | 50 | UIInterfaceOrientationPortrait 51 | UIInterfaceOrientationLandscapeLeft 52 | UIInterfaceOrientationLandscapeRight 53 | 54 | UIViewControllerBasedStatusBarAppearance 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /template/example/ios/{{appName}}/main.m: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | #import "AppDelegate.h" 4 | 5 | int main(int argc, char * argv[]) { 6 | @autoreleasepool { 7 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /template/example/ios/{{appName}}Tests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /template/example/ios/{{appName}}Tests/{{appName}}Tests-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | // 2 | // Use this file to import your target's public headers that you would like to expose to Swift. 3 | // 4 | 5 | -------------------------------------------------------------------------------- /template/example/ios/{{appName}}Tests/{{appName}}Tests.m: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @interface {{appName}}Tests : XCTestCase 4 | 5 | @end 6 | 7 | @implementation {{appName}}Tests 8 | 9 | - (void)testExample 10 | { 11 | XCTAssert(YES); 12 | } 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /template/example/ios/{{appName}}Tests/{{appName}}Tests.swift: -------------------------------------------------------------------------------- 1 | import XCTest 2 | 3 | class {{appName}}Tests: XCTestCase { 4 | func testExample() { 5 | XCTAssert(true) 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /template/example/ios/{{gitignore}}: -------------------------------------------------------------------------------- 1 | **/build/ 2 | **/infer-out/ 3 | *.pbxuser 4 | !default.pbxuser 5 | *.mode1v3 6 | !default.mode1v3 7 | *.mode2v3 8 | !default.mode2v3 9 | *.perspectivev3 10 | !default.perspectivev3 11 | xcuserdata 12 | *.xccheckout 13 | *.moved-aside 14 | DerivedData 15 | *.hmap 16 | *.ipa 17 | *.xcuserstate 18 | project.xcworkspace 19 | compile_commands.json 20 | xcodebuild.log 21 | .DS_Store 22 | -------------------------------------------------------------------------------- /template/example/metro.config.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Metro configuration for React Native 3 | * https://github.com/facebook/react-native 4 | * 5 | * @format 6 | */ 7 | 8 | const path = require('path') 9 | const blacklist = require('metro-config/src/defaults/blacklist') 10 | 11 | const packagePath = path.resolve(__dirname, '../') 12 | 13 | const extraNodeModules = { 14 | 'react': path.resolve(__dirname, 'node_modules/react'), 15 | 'react-native': path.resolve(__dirname, 'node_modules/react-native'), 16 | '@babel/runtime': path.resolve(__dirname, 'node_modules/@babel/runtime'), 17 | '{{packageName}}': packagePath 18 | } 19 | 20 | module.exports = { 21 | resolver: { 22 | extraNodeModules, 23 | blacklistRE: blacklist([ 24 | /^src[/\\].*/, 25 | /^example[/\\]src[/\\].*/ 26 | ]) 27 | }, 28 | watchFolders: [packagePath], 29 | transformer: { 30 | getTransformOptions: async () => ({ 31 | transform: { 32 | experimentalImportSupport: false, 33 | inlineRequires: false 34 | } 35 | }) 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /template/example/src/App.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | {{#if components.length}} 3 | import { View, StyleSheet, StatusBar } from 'react-native' 4 | {{/if}} 5 | import { 6 | {{#each modules}} 7 | {{pascalCase this}}{{#unless @last}},{{else if ../components.length}},{{/unless}} 8 | {{/each}} 9 | {{#each components}} 10 | {{pascalCase this}}{{#unless @last}},{{/unless}} 11 | {{/each}} 12 | } from '{{packageName}}' 13 | {{#if components.length}} 14 | 15 | const styles = StyleSheet.create({ 16 | container: { 17 | width: '100%', 18 | height: '100%', 19 | flexWrap: 'wrap' 20 | }, 21 | component: { 22 | width: 150, 23 | height: 150, 24 | margin: 5 25 | } 26 | }) 27 | {{/if}} 28 | 29 | class App extends React.Component { 30 | {{#if modules.length}} 31 | 32 | componentDidMount() { 33 | {{#each modules}} 34 | {{pascalCase this}}.show('{{pascalCase this}}') 35 | {{/each}} 36 | } 37 | {{/if}} 38 | 39 | render() { 40 | {{#if components.length}} 41 | return ( 42 | 43 | 51 | ) 52 | {{else}} 53 | return false 54 | {{/if}} 55 | } 56 | } 57 | 58 | export default App 59 | -------------------------------------------------------------------------------- /template/example/src/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../src/tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../build", 5 | "types": [] 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /template/example/{{gitignore}}: -------------------------------------------------------------------------------- 1 | # OSX 2 | # 3 | .DS_Store 4 | 5 | # Xcode 6 | # 7 | build/ 8 | *.pbxuser 9 | !default.pbxuser 10 | *.mode1v3 11 | !default.mode1v3 12 | *.mode2v3 13 | !default.mode2v3 14 | *.perspectivev3 15 | !default.perspectivev3 16 | xcuserdata 17 | *.xccheckout 18 | *.moved-aside 19 | DerivedData 20 | *.hmap 21 | *.ipa 22 | *.xcuserstate 23 | project.xcworkspace 24 | 25 | # Android/IntelliJ 26 | # 27 | build/ 28 | .idea 29 | .gradle 30 | local.properties 31 | *.iml 32 | 33 | # node.js 34 | # 35 | node_modules/ 36 | npm-debug.log 37 | yarn-error.log 38 | 39 | # BUCK 40 | buck-out/ 41 | \.buckd/ 42 | *.keystore 43 | 44 | # fastlane 45 | # 46 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 47 | # screenshots whenever they are needed. 48 | # For more information about the recommended setup visit: 49 | # https://docs.fastlane.tools/best-practices/source-control/ 50 | 51 | */fastlane/report.xml 52 | */fastlane/Preview.html 53 | */fastlane/screenshots 54 | 55 | # Bundle artifact 56 | *.jsbundle 57 | 58 | # CocoaPods 59 | /ios/Pods/ 60 | *.apk 61 | -------------------------------------------------------------------------------- /template/example/{{package}}.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "{{appName}}", 3 | "version": "0.0.1", 4 | "private": true, 5 | "scripts": { 6 | "preinstall": "cd .. && npm i && npm run build", 7 | "postinstall": "npm run build", 8 | "build": "rm -rf build && ../node_modules/.bin/tsc -p ./src", 9 | "lint": "../node_modules/.bin/tslint -p ./src", 10 | "watch": "npm run build -- -w", 11 | "reset:packager": "which watchman && watchman watch-del-all || : && react-native start --reset-cache", 12 | "run:android": "react-native run-android --no-jetifier", 13 | "clean:android": "cd android && ./gradlew clean", 14 | "install:pods": "cd ios && which pod && pod install || echo '\\033[1;33m Warning: cocoapods not found!\\033[0m'", 15 | "generate:android:signing-key": "keytool -genkey -v -keystore example.keystore -alias example -keyalg RSA -keysize 2048 -validity 10000 && mv example.keystore android/app", 16 | "generate:android:apk": "npm run generate:android:bundle && cd android && ./gradlew assembleRelease", 17 | "generate:android:bundle": "npm run build && react-native bundle --platform android --dev false --entry-file index.js --bundle-output ./android/app/src/main/assets/index.android.bundle", 18 | "build:docker:image": "docker build -t {{paramCase appName}}.image -f ./Dockerfile ../", 19 | "extract:docker:apk": "docker create -ti --name {{paramCase appName}}-container {{paramCase appName}}.image /bin/bash && docker cp {{paramCase appName}}-container:/package/example/android/app/build/outputs/apk/release/app-release.apk {{paramCase appName}}.apk && docker rm -fv {{paramCase appName}}-container", 20 | "build:release:docker": "npm run build:docker:image && npm run extract:docker:apk" 21 | }, 22 | "dependencies": { 23 | "react": "16.11.0", 24 | "react-native": "0.62.2", 25 | "{{packageName}}": "file:.." 26 | }, 27 | "devDependencies": { 28 | "@babel/core": "7.9.0", 29 | "@babel/runtime": "7.9.2", 30 | "metro-react-native-babel-preset": "0.58.0" 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /template/ios/.swiftlint.yml: -------------------------------------------------------------------------------- 1 | line_length: 100 2 | -------------------------------------------------------------------------------- /template/ios/UIImage+Color.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | NS_ASSUME_NONNULL_BEGIN 4 | 5 | @interface UIImage (Color) 6 | 7 | + (UIImage *)newWithColor:(UIColor *)color; 8 | 9 | @end 10 | 11 | NS_ASSUME_NONNULL_END 12 | -------------------------------------------------------------------------------- /template/ios/UIImage+Color.m: -------------------------------------------------------------------------------- 1 | #import "UIImage+Color.h" 2 | 3 | @implementation UIImage (Color) 4 | 5 | + (UIImage *)newWithColor:(UIColor *)color 6 | { 7 | CGRect rect = CGRectMake(0, 0, 1, 1); 8 | UIGraphicsBeginImageContext(rect.size); 9 | CGContextRef context = UIGraphicsGetCurrentContext(); 10 | CGContextSetFillColorWithColor(context, [color CGColor]); 11 | CGContextFillRect(context, rect); 12 | UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); 13 | UIGraphicsEndImageContext(); 14 | return image; 15 | } 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /template/ios/UIImage+Color.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | extension UIImage { 4 | class func new(with color: UIColor) -> UIImage? { 5 | let rect = CGRect(x: 0, y: 0, width: 1, height: 1) 6 | UIGraphicsBeginImageContext(rect.size) 7 | let context = UIGraphicsGetCurrentContext() 8 | context?.setFillColor(color.cgColor) 9 | context?.fill(rect) 10 | let image = UIGraphicsGetImageFromCurrentImageContext() 11 | UIGraphicsEndImageContext() 12 | return image 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /template/ios/component-kit-component-template/{{objcPrefix}}{{lazyPascalCaseComponentName}}.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | NS_ASSUME_NONNULL_BEGIN 4 | 5 | @interface {{objcPrefix}}{{lazyPascalCaseComponentName}}Model : NSObject 6 | 7 | + (instancetype)newWithCount:(NSInteger)count color:(UIColor *)color; 8 | 9 | @end 10 | 11 | 12 | typedef void (^OnIncrement)(void); 13 | 14 | @interface {{objcPrefix}}{{lazyPascalCaseComponentName}}Context : NSObject 15 | 16 | + (instancetype)newWithOnIncrement:(OnIncrement)onIncrement; 17 | 18 | @end 19 | 20 | 21 | @interface {{objcPrefix}}{{lazyPascalCaseComponentName}} : NSObject 22 | 23 | @end 24 | 25 | NS_ASSUME_NONNULL_END 26 | -------------------------------------------------------------------------------- /template/ios/component-kit-component-template/{{objcPrefix}}{{lazyPascalCaseComponentName}}.mm: -------------------------------------------------------------------------------- 1 | #import 2 | #import "{{objcPrefix}}{{lazyPascalCaseComponentName}}.h" 3 | #import "UIImage+Color.h" 4 | 5 | @interface {{objcPrefix}}{{lazyPascalCaseComponentName}}Model () 6 | 7 | @property (nonatomic, assign, readonly) NSInteger count; 8 | @property (nonatomic, strong, readonly) UIColor* color; 9 | 10 | @end 11 | 12 | @implementation {{objcPrefix}}{{lazyPascalCaseComponentName}}Model 13 | 14 | + (instancetype)newWithCount:(NSInteger)count color:(UIColor *)color 15 | { 16 | {{objcPrefix}}{{lazyPascalCaseComponentName}}Model *item = [{{objcPrefix}}{{lazyPascalCaseComponentName}}Model new]; 17 | item->_count = count; 18 | item->_color = color; 19 | 20 | return item; 21 | } 22 | 23 | @end 24 | 25 | 26 | @implementation {{objcPrefix}}{{lazyPascalCaseComponentName}}Context 27 | { 28 | OnIncrement _onIncrement; 29 | } 30 | 31 | + (instancetype)newWithOnIncrement:(OnIncrement)onIncrement 32 | { 33 | {{objcPrefix}}{{lazyPascalCaseComponentName}}Context *item = [{{objcPrefix}}{{lazyPascalCaseComponentName}}Context new]; 34 | item->_onIncrement = onIncrement; 35 | 36 | return item; 37 | } 38 | 39 | - (void)increment 40 | { 41 | _onIncrement(); 42 | } 43 | 44 | @end 45 | 46 | 47 | @implementation {{objcPrefix}}{{lazyPascalCaseComponentName}} 48 | 49 | + (CKComponent *)componentForModel:({{objcPrefix}}{{lazyPascalCaseComponentName}}Model *)model context:({{objcPrefix}}{{lazyPascalCaseComponentName}}Context *)context 50 | { 51 | return 52 | [CKFlexboxComponent 53 | newWithView:{ 54 | [UIView class], 55 | { 56 | {@selector(setBackgroundColor:), model.color} 57 | } 58 | } 59 | size:{} 60 | style:{ 61 | .direction = CKFlexboxDirectionColumn, 62 | .justifyContent = CKFlexboxJustifyContentSpaceBetween, 63 | .alignItems = CKFlexboxAlignItemsCenter, 64 | .padding = {5.0f, 5.0f, 5.0f, 5.0f} 65 | } 66 | children:{ 67 | { 68 | .flexGrow = 1.0f, 69 | .component = 70 | [CKLabelComponent 71 | newWithLabelAttributes:{ 72 | .string = [NSString stringWithFormat:@"Count %li", model.count], 73 | .font = [UIFont systemFontOfSize:20.0f] 74 | } 75 | viewAttributes:{ 76 | {@selector(setBackgroundColor:), [UIColor clearColor]}, 77 | {@selector(setUserInteractionEnabled:), @NO} 78 | } 79 | size:{}] 80 | }, 81 | { 82 | .sizeConstraints = {.width = CKRelativeDimension::Percent(1.0f)}, 83 | .flexGrow = 1.0f, 84 | .component = 85 | [CKButtonComponent 86 | newWithAction:{context, @selector(increment)} 87 | options:{ 88 | .titles = @"+", 89 | .backgroundImages = { 90 | {UIControlStateNormal, [UIImage newWithColor:[UIColor lightGrayColor]]}, 91 | {UIControlStateHighlighted, [UIImage newWithColor:[UIColor clearColor]]} 92 | } 93 | }] 94 | } 95 | } 96 | ]; 97 | } 98 | 99 | @end 100 | -------------------------------------------------------------------------------- /template/ios/component-kit-component-template/{{objcPrefix}}{{lazyPascalCaseComponentName}}Manager.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @interface {{objcPrefix}}{{lazyPascalCaseComponentName}}Manager : RCTViewManager 4 | 5 | @end 6 | -------------------------------------------------------------------------------- /template/ios/component-kit-component-template/{{objcPrefix}}{{lazyPascalCaseComponentName}}Manager.m: -------------------------------------------------------------------------------- 1 | #import 2 | #import "{{objcPrefix}}{{lazyPascalCaseComponentName}}Manager.h" 3 | #import "{{objcPrefix}}{{lazyPascalCaseComponentName}}Proxy.h" 4 | 5 | @implementation {{objcPrefix}}{{lazyPascalCaseComponentName}}Manager 6 | 7 | @synthesize bridge = _bridge; 8 | 9 | RCT_EXPORT_MODULE(); 10 | 11 | - (UIView *)view 12 | { 13 | return [{{objcPrefix}}{{lazyPascalCaseComponentName}}Proxy new]; 14 | } 15 | 16 | //+ (BOOL)requiresMainQueueSetup 17 | //{ 18 | // return YES; 19 | //} 20 | 21 | //- (dispatch_queue_t)methodQueue 22 | //{ 23 | // return dispatch_get_main_queue(); 24 | //} 25 | 26 | RCT_EXPORT_VIEW_PROPERTY(color, UIColor) 27 | RCT_EXPORT_VIEW_PROPERTY(count, NSInteger) 28 | RCT_EXPORT_VIEW_PROPERTY(onCountChange, RCTDirectEventBlock) 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /template/ios/component-kit-component-template/{{objcPrefix}}{{lazyPascalCaseComponentName}}Proxy.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | NS_ASSUME_NONNULL_BEGIN 5 | 6 | @interface {{objcPrefix}}{{lazyPascalCaseComponentName}}Proxy : UIView 7 | 8 | @property (nonatomic, assign) NSInteger count; 9 | @property (nonatomic, strong) UIColor *color; 10 | @property (nonatomic, copy) RCTDirectEventBlock onCountChange; 11 | 12 | @end 13 | 14 | NS_ASSUME_NONNULL_END 15 | -------------------------------------------------------------------------------- /template/ios/component-kit-component-template/{{objcPrefix}}{{lazyPascalCaseComponentName}}Proxy.mm: -------------------------------------------------------------------------------- 1 | #import 2 | #import "{{objcPrefix}}{{lazyPascalCaseComponentName}}Proxy.h" 3 | #import "{{objcPrefix}}{{lazyPascalCaseComponentName}}.h" 4 | 5 | @implementation {{objcPrefix}}{{lazyPascalCaseComponentName}}Proxy 6 | { 7 | CKComponentHostingView *_hostingView; 8 | } 9 | 10 | - (instancetype)init 11 | { 12 | if ((self = [super initWithFrame:CGRectZero])) { 13 | _count = 0; 14 | _color = [UIColor clearColor]; 15 | _hostingView = 16 | [[CKComponentHostingView alloc] 17 | initWithComponentProvider:[{{objcPrefix}}{{lazyPascalCaseComponentName}} class] 18 | sizeRangeProvider:[CKComponentFlexibleSizeRangeProvider providerWithFlexibility:CKComponentSizeRangeFlexibleWidthAndHeight]]; 19 | 20 | [self addSubview:_hostingView]; 21 | 22 | [_hostingView updateContext:[{{objcPrefix}}{{lazyPascalCaseComponentName}}Context newWithOnIncrement:^{ [self updateCount]; }] 23 | mode:CKUpdateModeSynchronous]; 24 | [self updateModel]; 25 | } 26 | 27 | return self; 28 | } 29 | 30 | - (void)updateModel 31 | { 32 | [_hostingView updateModel:[{{objcPrefix}}{{lazyPascalCaseComponentName}}Model newWithCount:_count color:_color] 33 | mode:CKUpdateModeSynchronous]; 34 | } 35 | 36 | - (void)layoutSubviews 37 | { 38 | [super layoutSubviews]; 39 | 40 | _hostingView.frame = CGRectMake(0.0f, 0.0f, self.frame.size.width, self.frame.size.height); 41 | } 42 | 43 | - (void)updateCount 44 | { 45 | _onCountChange(@{ @"count": @(_count + 1) }); 46 | } 47 | 48 | - (void)setCount:(NSInteger)count 49 | { 50 | _count = count; 51 | 52 | [self updateModel]; 53 | } 54 | 55 | - (void)setColor:(UIColor *)color 56 | { 57 | _color = color; 58 | 59 | [self updateModel]; 60 | } 61 | 62 | @end 63 | -------------------------------------------------------------------------------- /template/ios/component-template/{{lazyPascalCaseComponentName}}.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | class {{lazyPascalCaseComponentName}}: UIView { 4 | private var label = UILabel() 5 | private var button = UIButton() 6 | 7 | public init() { 8 | super.init(frame: CGRect.zero) 9 | 10 | label.text = "Count: 0" 11 | label.textAlignment = NSTextAlignment.center 12 | 13 | button.setTitle("+", for: UIControl.State.normal) 14 | 15 | button.addTarget( 16 | self, 17 | action: #selector({{lazyPascalCaseComponentName}}.updateCount), 18 | for: UIControl.Event.touchUpInside) 19 | 20 | button.setBackgroundImage(UIImage.new(with: UIColor.lightGray), for: UIControl.State.normal) 21 | button.setBackgroundImage(UIImage.new(with: UIColor.clear), for: UIControl.State.highlighted) 22 | 23 | addSubview(label) 24 | addSubview(button) 25 | } 26 | 27 | required init?(coder aDecoder: NSCoder) { 28 | super.init(coder: aDecoder) 29 | } 30 | 31 | override func draw(_ rect: CGRect) { 32 | super.draw(rect) 33 | 34 | (button.frame, label.frame) = rect.divided( 35 | atDistance: rect.height / 2, 36 | from: CGRectEdge.maxYEdge) 37 | } 38 | 39 | @objc var onCountChange: RCTDirectEventBlock = { _ in } 40 | 41 | @objc var count: NSInteger = 0 { 42 | didSet { 43 | label.text = "Count: \(count)" 44 | } 45 | } 46 | 47 | @objc func setColor(_ color: UIColor) { 48 | backgroundColor = color 49 | } 50 | 51 | @objc func updateCount() { 52 | onCountChange(["count": count + 1]) 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /template/ios/component-template/{{lazyPascalCaseComponentName}}Manager.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | @objc ({{objcPrefix}}{{lazyPascalCaseComponentName}}Manager) 4 | class {{lazyPascalCaseComponentName}}Manager: RCTViewManager { 5 | 6 | override func view() -> UIView! { 7 | return {{lazyPascalCaseComponentName}}() 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /template/ios/component-template/{{objcPrefix}}{{lazyPascalCaseComponentName}}Manager.m: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @interface RCT_EXTERN_MODULE({{objcPrefix}}{{lazyPascalCaseComponentName}}Manager, RCTViewManager) 4 | 5 | + (BOOL)requiresMainQueueSetup 6 | { 7 | return YES; 8 | } 9 | 10 | // - (dispatch_queue_t)methodQueue 11 | // { 12 | // return dispatch_get_main_queue(); 13 | // } 14 | 15 | RCT_EXPORT_VIEW_PROPERTY(color, UIColor) 16 | RCT_EXPORT_VIEW_PROPERTY(count, NSInteger) 17 | RCT_EXPORT_VIEW_PROPERTY(onCountChange, RCTDirectEventBlock) 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /template/ios/module-template/{{lazyPascalCaseModuleName}}.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | @objc ({{objcPrefix}}{{lazyPascalCaseModuleName}}) 4 | class {{lazyPascalCaseModuleName}}: NSObject { 5 | 6 | @objc func show(_ message: String) { 7 | let alert = UIAlertController(title: "{{objcPrefix}}{{lazyPascalCaseModuleName}}", 8 | message: message, 9 | preferredStyle: UIAlertController.Style.alert) 10 | alert.addAction(UIAlertAction(title: "Cancel", style: .cancel)) 11 | 12 | RCTPresentedViewController()?.present(alert, animated: true) 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /template/ios/module-template/{{objcPrefix}}{{lazyPascalCaseModuleName}}.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | NS_ASSUME_NONNULL_BEGIN 4 | 5 | @interface {{objcPrefix}}{{lazyPascalCaseModuleName}} : NSObject 6 | 7 | @end 8 | 9 | NS_ASSUME_NONNULL_END 10 | -------------------------------------------------------------------------------- /template/ios/module-template/{{objcPrefix}}{{lazyPascalCaseModuleName}}.m: -------------------------------------------------------------------------------- 1 | {{#if usesComponentKit}} 2 | #import 3 | #import "{{objcPrefix}}{{lazyPascalCaseModuleName}}.h" 4 | 5 | @implementation {{objcPrefix}}{{lazyPascalCaseModuleName}} 6 | 7 | RCT_EXPORT_MODULE(); 8 | 9 | //+ (BOOL)requiresMainQueueSetup 10 | //{ 11 | // return YES; 12 | //} 13 | 14 | - (dispatch_queue_t)methodQueue 15 | { 16 | return dispatch_get_main_queue(); 17 | } 18 | 19 | RCT_EXPORT_METHOD(show:(NSString *)message) 20 | { 21 | UIAlertController *alert = [UIAlertController 22 | alertControllerWithTitle:@"{{objcPrefix}}{{lazyPascalCaseModuleName}}" 23 | message:message 24 | preferredStyle:UIAlertControllerStyleAlert]; 25 | 26 | [alert addAction:[UIAlertAction actionWithTitle:@"Cancel" 27 | style:UIAlertActionStyleCancel 28 | handler:^(UIAlertAction * _Nonnull action) {}]]; 29 | 30 | [RCTPresentedViewController() presentViewController:alert animated:YES completion:^{}]; 31 | } 32 | 33 | @end 34 | {{else}} 35 | #import 36 | 37 | @interface RCT_EXTERN_MODULE({{objcPrefix}}{{lazyPascalCaseModuleName}}, NSObject) 38 | 39 | + (BOOL)requiresMainQueueSetup 40 | { 41 | return YES; 42 | } 43 | 44 | - (dispatch_queue_t)methodQueue 45 | { 46 | return dispatch_get_main_queue(); 47 | } 48 | 49 | RCT_EXTERN_METHOD(show:(NSString *)message) 50 | 51 | @end 52 | {{/if}} 53 | -------------------------------------------------------------------------------- /template/ios/swift-ui-component-template/{{lazyPascalCaseComponentName}}.swift: -------------------------------------------------------------------------------- 1 | import SwiftUI 2 | 3 | class ButtonProps: ObservableObject { 4 | @Published var color: UIColor = UIColor.clear 5 | @Published var count: Int = 0 6 | @Published var onCountChange: RCTDirectEventBlock = { _ in } 7 | } 8 | 9 | struct {{lazyPascalCaseComponentName}}: View { 10 | @ObservedObject var props = ButtonProps() 11 | 12 | var body: some View { 13 | GeometryReader { geometry in 14 | VStack { 15 | Text("Count \(self.props.count)") 16 | .padding() 17 | 18 | Button( 19 | action: { self.props.onCountChange(["count": self.props.count + 1]) }, 20 | label: { 21 | Image(systemName: "plus.circle.fill") 22 | .foregroundColor(.white) 23 | .padding() 24 | .background(Color.red) 25 | .clipShape(Circle()) 26 | }) 27 | } 28 | .frame(width: geometry.size.width, height: geometry.size.height, alignment: .center) 29 | .background(Color.init(self.props.color)) 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /template/ios/swift-ui-component-template/{{lazyPascalCaseComponentName}}Manager.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | @objc ({{objcPrefix}}{{lazyPascalCaseComponentName}}Manager) 4 | class {{lazyPascalCaseComponentName}}Manager: RCTViewManager { 5 | 6 | override func view() -> UIView! { 7 | let proxy = {{lazyPascalCaseComponentName}}Proxy() 8 | let view = proxy.view 9 | {{lazyPascalCaseComponentName}}Proxy.storage[NSValue(nonretainedObject: view)] = proxy 10 | 11 | return view 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /template/ios/swift-ui-component-template/{{lazyPascalCaseComponentName}}Proxy.swift: -------------------------------------------------------------------------------- 1 | import SwiftUI 2 | 3 | @objcMembers open class {{lazyPascalCaseComponentName}}Proxy: NSObject { 4 | private var ctrl = UIHostingController(rootView: {{lazyPascalCaseComponentName}}()) 5 | 6 | public static let storage = NSMutableDictionary() 7 | 8 | open var color: UIColor { 9 | set { ctrl.rootView.props.color = newValue } 10 | get { return ctrl.rootView.props.color } 11 | } 12 | 13 | open var count: Int { 14 | set { ctrl.rootView.props.count = newValue } 15 | get { return ctrl.rootView.props.count } 16 | } 17 | 18 | open var onCountChange: RCTBubblingEventBlock { 19 | set { ctrl.rootView.props.onCountChange = newValue } 20 | get { return ctrl.rootView.props.onCountChange } 21 | } 22 | 23 | open var view: UIView { 24 | return ctrl.view 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /template/ios/swift-ui-component-template/{{objcPrefix}}{{lazyPascalCaseComponentName}}Manager.m: -------------------------------------------------------------------------------- 1 | #import 2 | #import "{{objcPrefix}}Defines.h" 3 | #import "{{snakeCase packageName}}-Swift.h" 4 | 5 | @interface RCT_EXTERN_MODULE({{objcPrefix}}{{lazyPascalCaseComponentName}}Manager, RCTViewManager) 6 | 7 | + (BOOL)requiresMainQueueSetup 8 | { 9 | return YES; 10 | } 11 | 12 | // - (dispatch_queue_t)methodQueue 13 | // { 14 | // return dispatch_get_main_queue(); 15 | // } 16 | 17 | RCT_CUSTOM_SWIFTUI_PROPERTY(color, UIColor, {{lazyPascalCaseComponentName}}Proxy) { 18 | return [RCTConvert UIColor:json] ?: UIColor.clearColor; 19 | } 20 | RCT_EXPORT_SWIFTUI_PROPERTY(count, int, {{lazyPascalCaseComponentName}}Proxy) 21 | RCT_EXPORT_SWIFTUI_CALLBACK(onCountChange, RCTDirectEventBlock, {{lazyPascalCaseComponentName}}Proxy) 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /template/ios/{{gitignore}}: -------------------------------------------------------------------------------- 1 | *.pbxuser 2 | !default.pbxuser 3 | *.mode1v3 4 | !default.mode1v3 5 | *.mode2v3 6 | !default.mode2v3 7 | *.perspectivev3 8 | !default.perspectivev3 9 | xcuserdata 10 | *.xccheckout 11 | *.moved-aside 12 | DerivedData 13 | *.hmap 14 | *.ipa 15 | *.xcuserstate 16 | project.xcworkspace -------------------------------------------------------------------------------- /template/ios/{{objcPrefix}}Defines.h: -------------------------------------------------------------------------------- 1 | #ifndef {{objcPrefix}}Defines_h 2 | #define {{objcPrefix}}Defines_h 3 | 4 | #import 5 | #import 6 | #import 7 | 8 | #define RCT_CUSTOM_SWIFTUI_PROPERTY(name, type, proxyClass) \ 9 | RCT_REMAP_VIEW_PROPERTY(name, __custom__, type) \ 10 | - (void)set_##name:(id)json forView:(UIView *)view withDefaultView:(UIView *)defaultView RCT_DYNAMIC { \ 11 | NSMutableDictionary *storage = [proxyClass storage]; \ 12 | proxyClass *proxy = storage[[NSValue valueWithNonretainedObject:view]]; \ 13 | proxy.name = [self custom_##name:json]; \ 14 | } \ 15 | - (type *)custom_##name:(id)json RCT_DYNAMIC 16 | 17 | #define RCT_EXPORT_SWIFTUI_PROPERTY(name, type, proxyClass) \ 18 | RCT_REMAP_VIEW_PROPERTY(name, __custom__, type) \ 19 | - (void)set_##name:(id)json forView:(UIView *)view withDefaultView:(UIView *)defaultView RCT_DYNAMIC { \ 20 | NSMutableDictionary *storage = [proxyClass storage]; \ 21 | proxyClass *proxy = storage[[NSValue valueWithNonretainedObject:view]]; \ 22 | proxy.name = [json type##Value]; \ 23 | } 24 | 25 | #define RCT_EXPORT_SWIFTUI_CALLBACK(name, type, proxyClass) \ 26 | RCT_REMAP_VIEW_PROPERTY(name, __custom__, type) \ 27 | - (void)set_##name:(id)json forView:(UIView *)view withDefaultView:(UIView *)defaultView RCT_DYNAMIC { \ 28 | NSMutableDictionary *storage = [proxyClass storage]; \ 29 | proxyClass *proxy = storage[[NSValue valueWithNonretainedObject:view]]; \ 30 | void (^eventHandler)(NSDictionary *event) = ^(NSDictionary *event) { \ 31 | RCTComponentEvent *componentEvent = [[RCTComponentEvent alloc] initWithName:@""#name \ 32 | viewTag:view.reactTag \ 33 | body:event]; \ 34 | [self.bridge.eventDispatcher sendEvent:componentEvent]; \ 35 | }; \ 36 | proxy.name = eventHandler; \ 37 | } 38 | 39 | 40 | #endif /* {{objcPrefix}}Defines_h */ 41 | -------------------------------------------------------------------------------- /template/ios/{{objcPrefix}}{{pascalCase packageName}}.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iyegoroff/make-react-native-package/8267d873f638b63d05960f0cf664f784f0e14238/template/ios/{{objcPrefix}}{{pascalCase packageName}}.xcodeproj/project.pbxproj -------------------------------------------------------------------------------- /template/ios/{{objcPrefix}}{{pascalCase packageName}}Umbrella.h: -------------------------------------------------------------------------------- 1 | #ifndef {{objcPrefix}}{{pascalCase packageName}}Umbrella_h 2 | #define {{objcPrefix}}{{pascalCase packageName}}Umbrella_h 3 | 4 | #import 5 | #import 6 | #import 7 | #import 8 | #import 9 | #import 10 | 11 | #endif /* {{objcPrefix}}{{pascalCase packageName}}Umbrella_h */ 12 | -------------------------------------------------------------------------------- /template/src/component-template/component.tsx: -------------------------------------------------------------------------------- 1 | import React, { useState } from 'react' 2 | import { NativeProps, NativeComponent } from './native-component' 3 | 4 | type Props = Omit 5 | 6 | const RefComponent = (props: Props, forwardedRef?: React.Ref>) => { 7 | const [count, updateCount] = useState(0) 8 | 9 | return ( 10 | updateCount(e.nativeEvent.count)} 14 | ref={forwardedRef} 15 | /> 16 | ) 17 | } 18 | 19 | export const Component = React.forwardRef(RefComponent) 20 | Component.displayName = '{{lazyPascalCaseComponentName}}' 21 | -------------------------------------------------------------------------------- /template/src/component-template/index.ts: -------------------------------------------------------------------------------- 1 | export { Component as {{lazyPascalCaseComponentName}} } from './component' 2 | -------------------------------------------------------------------------------- /template/src/component-template/native-component.ts: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import { requireNativeComponent, ViewProps, NativeSyntheticEvent } from 'react-native' 3 | 4 | export type NativeProps = ViewProps & { 5 | readonly color: string 6 | readonly count: number 7 | readonly onCountChange: (event: NativeSyntheticEvent<{ readonly count: number }>) => void 8 | } 9 | 10 | export const NativeComponent: React.ComponentClass = requireNativeComponent( 11 | '{{objcPrefix}}{{lazyPascalCaseComponentName}}' 12 | ) 13 | -------------------------------------------------------------------------------- /template/src/index.ts: -------------------------------------------------------------------------------- 1 | {{#each modules}} 2 | export * from './{{pascalCase this}}' 3 | {{/each}} 4 | {{#each components}} 5 | export * from './{{pascalCase this}}' 6 | {{/each}} 7 | -------------------------------------------------------------------------------- /template/src/module-template/index.ts: -------------------------------------------------------------------------------- 1 | export { Module as {{lazyPascalCaseModuleName}} } from './module' 2 | -------------------------------------------------------------------------------- /template/src/module-template/module.ts: -------------------------------------------------------------------------------- 1 | import { NativeModule } from './native-module' 2 | 3 | export const Module = { 4 | ...NativeModule 5 | } 6 | -------------------------------------------------------------------------------- /template/src/module-template/native-module.ts: -------------------------------------------------------------------------------- 1 | import { NativeModules } from 'react-native' 2 | 3 | export const NativeModule = NativeModules.{{objcPrefix}}{{lazyPascalCaseModuleName}} as { 4 | readonly show: (message: string) => void 5 | } 6 | -------------------------------------------------------------------------------- /template/src/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "sourceMap": true, 4 | "target": "es6", 5 | "strict": true, 6 | "outDir": "../dist", 7 | "jsx": "react-native", 8 | "lib": ["es2016"], 9 | "declaration": true, 10 | "moduleResolution": "node", 11 | "allowSyntheticDefaultImports": true, 12 | "esModuleInterop": true, 13 | "noEmitOnError": true, 14 | "noImplicitReturns": true, 15 | "noFallthroughCasesInSwitch": true, 16 | "removeComments": true 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /template/{{gitignore}}: -------------------------------------------------------------------------------- 1 | 2 | # OSX 3 | # 4 | **/.DS_Store 5 | 6 | # node.js 7 | # 8 | node_modules/ 9 | npm-debug.log 10 | yarn-error.log 11 | 12 | 13 | # Xcode 14 | # 15 | build/ 16 | *.pbxuser 17 | !default.pbxuser 18 | *.mode1v3 19 | !default.mode1v3 20 | *.mode2v3 21 | !default.mode2v3 22 | *.perspectivev3 23 | !default.perspectivev3 24 | xcuserdata 25 | *.xccheckout 26 | *.moved-aside 27 | DerivedData 28 | *.hmap 29 | *.ipa 30 | *.xcuserstate 31 | project.xcworkspace 32 | 33 | 34 | # Android/IntelliJ 35 | # 36 | build/ 37 | .idea 38 | .gradle 39 | local.properties 40 | *.iml 41 | 42 | # BUCK 43 | buck-out/ 44 | \.buckd/ 45 | *.keystore 46 | 47 | dist 48 | .ionide/ 49 | *.tgz 50 | -------------------------------------------------------------------------------- /template/{{packageName}}.podspec: -------------------------------------------------------------------------------- 1 | require 'json' 2 | 3 | package = JSON.parse(File.read(File.join(__dir__, 'package.json'))) 4 | 5 | Pod::Spec.new do |s| 6 | s.name = package['name'] 7 | s.version = package['version'] 8 | s.summary = package['description'] 9 | s.homepage = package['homepage'] 10 | s.license = package['license'] 11 | s.author = package['author'] 12 | s.platform = :ios, '{{iosVersion}}' 13 | s.source = { :git => 'https://github.com/{{githubUsername}}/{{packageName}}.git', :tag => 'v#{s.version}' } 14 | s.source_files = 'ios/**/*.{h,m,mm,swift}' 15 | s.requires_arc = true 16 | {{#unless usesComponentKit}} 17 | s.swift_version = '5.0' 18 | {{/unless}} 19 | 20 | s.dependency 'React' 21 | {{#if usesComponentKit}} 22 | s.dependency 'ComponentKit' 23 | {{/if}} 24 | 25 | {{#if usesSwiftUI}} 26 | s.script_phase = { 27 | :name => 'Create {{snakeCase packageName}}.h', 28 | :script => 'touch "${PODS_ROOT}/Headers/Public/{{snakeCase packageName}}/{{snakeCase packageName}}.h"', 29 | :execution_position => :before_compile 30 | } 31 | {{/if}} 32 | end 33 | 34 | -------------------------------------------------------------------------------- /template/{{package}}.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "{{packageName}}", 3 | "version": "0.0.1", 4 | "description": "{{{description}}}", 5 | "main": "dist/index.js", 6 | "types": "dist/index.d.ts", 7 | "keywords": [ 8 | "react-native" 9 | ], 10 | "author": "{{npmUsername}}{{{email}}}", 11 | "license": "MIT", 12 | "scripts": { 13 | "init:package": "cd example && npm i && npm run install:pods", 14 | "build": "rm -rf dist && tsc -p ./src", 15 | "watch": "npm run build -- -w", 16 | "lint": "npm run lint:ts && npm run lint:kotlin && npm run lint:swift", 17 | "lint:ts": "eslint . --ext .ts,.tsx --fix", 18 | "lint:kotlin": "cd example/android && ./gradlew ktlintMainSourceSetFormat", 19 | "lint:swift": "cd ios && ../example/ios/Pods/SwiftLint/swiftlint autocorrect && ../example/ios/Pods/SwiftLint/swiftlint", 20 | "ci:build": "cd example && npm i", 21 | "ci:lint": "npm run ci:lint:ts && npm run ci:lint:kotlin && npm run ci:lint:swift", 22 | "ci:lint:ts": "eslint . --ext .ts,.tsx", 23 | "ci:lint:kotlin": "cd example/android && ./gradlew ktlintMainSourceSetCheck", 24 | "ci:lint:swift": "cd ios && ../example/ios/Pods/SwiftLint/swiftlint", 25 | "ci:compile:android": "cd example/android && ./gradlew compileDebugSources", 26 | "ci:compile:ios": "cd example/ios && export RCT_NO_LAUNCH_PACKAGER=\"true\" && export RCT_NO_BUNDLE=\"true\" && xcodebuild CODE_SIGN_IDENTITY=\"\" CODE_SIGNING_REQUIRED=\"NO\" CODE_SIGN_ENTITLEMENTS=\"\" CODE_SIGNING_ALLOWED=\"NO\" -destination \"platform=iOS Simulator,name=iPhone 11,OS=13.5\" -workspace {{appName}}.xcworkspace -scheme {{appName}} build-for-testing", 27 | "preversion": "npm run lint && npm run build && git add -u && git commit -am lint || :", 28 | "postversion": "git push && git push --tags" 29 | }, 30 | "bugs": { 31 | "url": "https://github.com/{{githubUsername}}/{{packageName}}/issues" 32 | }, 33 | "homepage": "https://github.com/{{githubUsername}}/{{packageName}}#readme", 34 | "repository": { 35 | "type": "git", 36 | "url": "git+https://github.com/{{githubUsername}}/{{packageName}}.git" 37 | }, 38 | "peerDependencies": { 39 | "@babel/runtime": "*", 40 | "react": "*", 41 | "react-native": "*" 42 | }, 43 | "devDependencies": { 44 | "@react-native-community/eslint-config": "2.0.0", 45 | "@types/react": "16.9.38", 46 | "@types/react-native": "0.62.13", 47 | "@typescript-eslint/eslint-plugin": "3.3.0", 48 | "@typescript-eslint/parser": "3.3.0", 49 | "eslint": "7.3.0", 50 | "eslint-config-prettier": "6.11.0", 51 | "eslint-config-standard-with-typescript": "18.0.2", 52 | "eslint-plugin-import": "2.21.2", 53 | "eslint-plugin-no-null": "1.0.2", 54 | "eslint-plugin-node": "11.1.0", 55 | "eslint-plugin-prettier": "3.1.4", 56 | "eslint-plugin-promise": "4.2.1", 57 | "eslint-plugin-react": "7.20.0", 58 | "eslint-plugin-react-hooks": "4.0.4", 59 | "eslint-plugin-standard": "4.0.1", 60 | "prettier": "2.0.5", 61 | "typescript": "3.9.5" 62 | }, 63 | "files": [ 64 | "android", 65 | "ios", 66 | "src", 67 | "dist", 68 | "example", 69 | ".dockerignore", 70 | ".editorconfig", 71 | ".eslintrc", 72 | ".eslintignore", 73 | ".prettierrc", 74 | "*.md", 75 | "*.podspec", 76 | "LICENSE" 77 | ] 78 | } 79 | --------------------------------------------------------------------------------