> {
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 |
44 | {{#each components}}
45 | <{{pascalCase this}}
46 | style={styles.component}
47 | color={'{{randomColor}}'}
48 | />
49 | {{/each}}
50 |
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 |
--------------------------------------------------------------------------------