├── .gitignore
├── LICENSE
├── README.md
├── generators
└── app
│ ├── index.js
│ ├── string-utils.js
│ └── templates
│ ├── android
│ ├── module
│ │ ├── android
│ │ │ ├── build.gradle
│ │ │ └── src
│ │ │ │ └── main
│ │ │ │ └── AndroidManifest.xml
│ │ └── index.android.js
│ └── package
│ │ ├── Module.java
│ │ └── Package.java
│ ├── common
│ └── README.md
│ └── ios
│ ├── RCTModule.xcodeproj
│ └── project.pbxproj
│ ├── RCTModule
│ ├── RCTModule.h
│ └── RCTModule.m
│ └── index.ios.js
└── package.json
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules/
2 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2015 Alexandre Moureaux
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
23 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # React native module boilerplate generator
2 |
3 | Generate boilerplate for a new React Native module with [Yeoman](http://yeoman.io/).
4 |
5 | Install Yeoman:
6 |
7 | ```shell
8 | npm install -g yo
9 | ```
10 |
11 | Install the generator
12 |
13 | ```shell
14 | npm install -g generator-module-react-native
15 | ```
16 |
17 | Run the generator
18 | ```shell
19 | mkdir my-awesome-module && cd my-awesome-module
20 | yo module-react-native
21 | ```
22 |
23 | ## To Do
24 |
25 | See [the list](https://github.com/bamlab/generator-react-native-module/issues/2)
26 |
--------------------------------------------------------------------------------
/generators/app/index.js:
--------------------------------------------------------------------------------
1 | var generators = require('yeoman-generator');
2 | var stringUtils = require('./string-utils');
3 | var mkdirp = require('mkdirp');
4 |
5 | var writeCommonPart = function(generator) {
6 | generator.directory('common/', '.');
7 | };
8 |
9 | var setupAndroidPackageFolders = function(packageName) {
10 | var packageFolders = packageName.split('.');
11 | var currentFolder = './android/src/main/java/';
12 | packageFolders.forEach(function(packageFolder) {
13 | mkdirp.sync(currentFolder + packageFolder);
14 | currentFolder += packageFolder + '/';
15 | });
16 |
17 | return currentFolder;
18 | };
19 |
20 | var writeAndroidPart = function(generator) {
21 | generator.directory('android/module/', '.');
22 | var packageFolder = setupAndroidPackageFolders(generator.packageName);
23 | generator.copy('android/package/Module.java', packageFolder + generator.moduleName + 'Module.java');
24 | generator.copy('android/package/Package.java', packageFolder + generator.moduleName + 'Package.java');
25 | };
26 |
27 | var writeIOSPart = function(generator) {
28 | generator.copy('ios/index.ios.js', 'index.ios.js');
29 | var iosFiles = [
30 | 'ios/RCTModule/RCTModule.h',
31 | 'ios/RCTModule/RCTModule.m',
32 | 'ios/RCTModule.xcodeproj/project.pbxproj'
33 | ];
34 |
35 | iosFiles.forEach(function (iosFile) {
36 | generator.copy(iosFile, iosFile.replace(/Module/g, generator.moduleName));
37 | });
38 | };
39 |
40 | module.exports = generators.Base.extend({
41 | prompting: function () {
42 | var done = this.async();
43 | var appName = stringUtils.camelize(this.appname);
44 |
45 | var prompts = [
46 | {
47 | type : 'input',
48 | name : 'moduleName',
49 | message : 'Your module name',
50 | default : stringUtils.capitalizeFirstLetter(appName),
51 | },
52 | {
53 | type : 'input',
54 | name : 'reactMethodName',
55 | message : 'Your first react method name',
56 | default : appName,
57 | },
58 | {
59 | type : 'input',
60 | name : 'reactNativeVersion',
61 | message : 'The react native version you want to use',
62 | default : '0.14.+',
63 | },
64 | {
65 | type : 'input',
66 | name : 'packageName',
67 | message : 'Your Android module package name',
68 | default : 'fr.bamlab.' + appName.toLowerCase(),
69 | },
70 | ];
71 |
72 | this.prompt(prompts, function (answers) {
73 | for (var key in answers) {
74 | if (answers.hasOwnProperty(key)) {
75 | this[key] = answers[key];
76 | }
77 | }
78 | done();
79 | }.bind(this));
80 | },
81 |
82 | writing: function () {
83 | writeCommonPart(this);
84 | writeAndroidPart(this);
85 | writeIOSPart(this);
86 | }
87 | });
88 |
--------------------------------------------------------------------------------
/generators/app/string-utils.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | camelize: function(str) {
3 | return str.replace(/(?:^\w|[A-Z]|\b\w|\s+)/g, function(match, index) {
4 | if (+match === 0) return ""; // or if (/\s+/.test(match)) for white spaces
5 | return index == 0 ? match.toLowerCase() : match.toUpperCase();
6 | });
7 | },
8 | capitalizeFirstLetter: function(str) {
9 | return str[0].toUpperCase() + (str.length > 1 ? str.substring(1) : '');
10 | }
11 | };
12 |
--------------------------------------------------------------------------------
/generators/app/templates/android/module/android/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 |
3 | android {
4 | compileSdkVersion 23
5 | buildToolsVersion "23.0.2"
6 |
7 | defaultConfig {
8 | minSdkVersion 16
9 | targetSdkVersion 23
10 | versionCode 1
11 | versionName "1.0"
12 | }
13 | buildTypes {
14 | release {
15 | minifyEnabled false
16 | }
17 | }
18 | }
19 |
20 | dependencies {
21 | compile 'com.android.support:appcompat-v7:23.1.0'
22 | compile 'com.facebook.react:react-native:<%= reactNativeVersion %>'
23 | }
24 |
--------------------------------------------------------------------------------
/generators/app/templates/android/module/android/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
--------------------------------------------------------------------------------
/generators/app/templates/android/module/index.android.js:
--------------------------------------------------------------------------------
1 | import React from 'react-native';
2 |
3 | const <%= moduleName %> = React.NativeModules.<%= moduleName %>;
4 |
5 | export default {
6 | <%= reactMethodName %>: (onSuccess, onFailure) => {
7 | return <%= moduleName %>.<%= reactMethodName %>(onSuccess, onFailure);
8 | },
9 | };
10 |
--------------------------------------------------------------------------------
/generators/app/templates/android/package/Module.java:
--------------------------------------------------------------------------------
1 | package <%= packageName %>;
2 |
3 | import android.content.Context;
4 |
5 | import com.facebook.react.bridge.ReactApplicationContext;
6 | import com.facebook.react.bridge.ReactContextBaseJavaModule;
7 | import com.facebook.react.bridge.ReactMethod;
8 | import com.facebook.react.bridge.Callback;
9 |
10 | class <%= moduleName %>Module extends ReactContextBaseJavaModule {
11 | private Context context;
12 |
13 | public <%= moduleName %>Module(ReactApplicationContext reactContext) {
14 | super(reactContext);
15 | this.context = reactContext;
16 | }
17 |
18 | /**
19 | * @return the name of this module. This will be the name used to {@code require()} this module
20 | * from javascript.
21 | */
22 | @Override
23 | public String getName() {
24 | return "<%= moduleName %>";
25 | }
26 |
27 | @ReactMethod
28 | public void <%= reactMethodName %>(Callback onSuccess, Callback onFailure) {
29 | onSuccess.invoke("Hello World!");
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/generators/app/templates/android/package/Package.java:
--------------------------------------------------------------------------------
1 | package <%= packageName %>;
2 |
3 | import com.facebook.react.ReactPackage;
4 | import com.facebook.react.bridge.JavaScriptModule;
5 | import com.facebook.react.bridge.NativeModule;
6 | import com.facebook.react.bridge.ReactApplicationContext;
7 | import com.facebook.react.uimanager.ViewManager;
8 |
9 | import java.util.ArrayList;
10 | import java.util.Collections;
11 | import java.util.List;
12 |
13 | public class <%= moduleName %>Package implements ReactPackage {
14 | /**
15 | * @param reactContext react application context that can be used to create modules
16 | * @return list of native modules to register with the newly created catalyst instance
17 | */
18 | @Override
19 | public List createNativeModules(ReactApplicationContext reactContext) {
20 | List modules = new ArrayList<>();
21 | modules.add(new <%= moduleName %>Module(reactContext));
22 |
23 | return modules;
24 | }
25 |
26 | /**
27 | * @return list of JS modules to register with the newly created catalyst instance.
28 | *
29 | * IMPORTANT: Note that only modules that needs to be accessible from the native code should be
30 | * listed here. Also listing a native module here doesn't imply that the JS implementation of it
31 | * will be automatically included in the JS bundle.
32 | */
33 | @Override
34 | public List> createJSModules() {
35 | return Collections.emptyList();
36 | }
37 |
38 | /**
39 | * @param reactContext
40 | * @return a list of view managers that should be registered with {@link UIManagerModule}
41 | */
42 | @Override
43 | public List createViewManagers(ReactApplicationContext reactContext) {
44 | return Collections.emptyList();
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/generators/app/templates/common/README.md:
--------------------------------------------------------------------------------
1 | # <%= moduleName %>
2 |
--------------------------------------------------------------------------------
/generators/app/templates/ios/RCTModule.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 46;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 5D72D2EC1C16249000E22EC1 /* RCT<%= moduleName %>.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5D72D2EB1C16249000E22EC1 /* RCT<%= moduleName %>.h */; };
11 | 5D72D2EE1C16249000E22EC1 /* RCT<%= moduleName %>.m in Sources */ = {isa = PBXBuildFile; fileRef = 5D72D2ED1C16249000E22EC1 /* RCT<%= moduleName %>.m */; };
12 | /* End PBXBuildFile section */
13 |
14 | /* Begin PBXCopyFilesBuildPhase section */
15 | 5D72D2E61C16249000E22EC1 /* CopyFiles */ = {
16 | isa = PBXCopyFilesBuildPhase;
17 | buildActionMask = 2147483647;
18 | dstPath = "include/$(PRODUCT_NAME)";
19 | dstSubfolderSpec = 16;
20 | files = (
21 | 5D72D2EC1C16249000E22EC1 /* RCT<%= moduleName %>.h in CopyFiles */,
22 | );
23 | runOnlyForDeploymentPostprocessing = 0;
24 | };
25 | /* End PBXCopyFilesBuildPhase section */
26 |
27 | /* Begin PBXFileReference section */
28 | 5D72D2E81C16249000E22EC1 /* libRCT<%= moduleName %>.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRCT<%= moduleName %>.a; sourceTree = BUILT_PRODUCTS_DIR; };
29 | 5D72D2EB1C16249000E22EC1 /* RCT<%= moduleName %>.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RCT<%= moduleName %>.h; sourceTree = ""; };
30 | 5D72D2ED1C16249000E22EC1 /* RCT<%= moduleName %>.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RCT<%= moduleName %>.m; sourceTree = ""; };
31 | /* End PBXFileReference section */
32 |
33 | /* Begin PBXFrameworksBuildPhase section */
34 | 5D72D2E51C16249000E22EC1 /* Frameworks */ = {
35 | isa = PBXFrameworksBuildPhase;
36 | buildActionMask = 2147483647;
37 | files = (
38 | );
39 | runOnlyForDeploymentPostprocessing = 0;
40 | };
41 | /* End PBXFrameworksBuildPhase section */
42 |
43 | /* Begin PBXGroup section */
44 | 5D72D2DF1C16249000E22EC1 = {
45 | isa = PBXGroup;
46 | children = (
47 | 5D72D2EA1C16249000E22EC1 /* RCT<%= moduleName %> */,
48 | 5D72D2E91C16249000E22EC1 /* Products */,
49 | );
50 | sourceTree = "";
51 | };
52 | 5D72D2E91C16249000E22EC1 /* Products */ = {
53 | isa = PBXGroup;
54 | children = (
55 | 5D72D2E81C16249000E22EC1 /* libRCT<%= moduleName %>.a */,
56 | );
57 | name = Products;
58 | sourceTree = "";
59 | };
60 | 5D72D2EA1C16249000E22EC1 /* RCT<%= moduleName %> */ = {
61 | isa = PBXGroup;
62 | children = (
63 | 5D72D2EB1C16249000E22EC1 /* RCT<%= moduleName %>.h */,
64 | 5D72D2ED1C16249000E22EC1 /* RCT<%= moduleName %>.m */,
65 | );
66 | path = RCT<%= moduleName %>;
67 | sourceTree = "";
68 | };
69 | /* End PBXGroup section */
70 |
71 | /* Begin PBXNativeTarget section */
72 | 5D72D2E71C16249000E22EC1 /* RCT<%= moduleName %> */ = {
73 | isa = PBXNativeTarget;
74 | buildConfigurationList = 5D72D2F11C16249000E22EC1 /* Build configuration list for PBXNativeTarget "RCT<%= moduleName %>" */;
75 | buildPhases = (
76 | 5D72D2E41C16249000E22EC1 /* Sources */,
77 | 5D72D2E51C16249000E22EC1 /* Frameworks */,
78 | 5D72D2E61C16249000E22EC1 /* CopyFiles */,
79 | );
80 | buildRules = (
81 | );
82 | dependencies = (
83 | );
84 | name = RCT<%= moduleName %>;
85 | productName = RCT<%= moduleName %>;
86 | productReference = 5D72D2E81C16249000E22EC1 /* libRCT<%= moduleName %>.a */;
87 | productType = "com.apple.product-type.library.static";
88 | };
89 | /* End PBXNativeTarget section */
90 |
91 | /* Begin PBXProject section */
92 | 5D72D2E01C16249000E22EC1 /* Project object */ = {
93 | isa = PBXProject;
94 | attributes = {
95 | LastUpgradeCheck = 0710;
96 | ORGANIZATIONNAME = "Atticus White";
97 | TargetAttributes = {
98 | 5D72D2E71C16249000E22EC1 = {
99 | CreatedOnToolsVersion = 7.1.1;
100 | };
101 | };
102 | };
103 | buildConfigurationList = 5D72D2E31C16249000E22EC1 /* Build configuration list for PBXProject "RCT<%= moduleName %>" */;
104 | compatibilityVersion = "Xcode 3.2";
105 | developmentRegion = English;
106 | hasScannedForEncodings = 0;
107 | knownRegions = (
108 | en,
109 | );
110 | mainGroup = 5D72D2DF1C16249000E22EC1;
111 | productRefGroup = 5D72D2E91C16249000E22EC1 /* Products */;
112 | projectDirPath = "";
113 | projectRoot = "";
114 | targets = (
115 | 5D72D2E71C16249000E22EC1 /* RCT<%= moduleName %> */,
116 | );
117 | };
118 | /* End PBXProject section */
119 |
120 | /* Begin PBXSourcesBuildPhase section */
121 | 5D72D2E41C16249000E22EC1 /* Sources */ = {
122 | isa = PBXSourcesBuildPhase;
123 | buildActionMask = 2147483647;
124 | files = (
125 | 5D72D2EE1C16249000E22EC1 /* RCT<%= moduleName %>.m in Sources */,
126 | );
127 | runOnlyForDeploymentPostprocessing = 0;
128 | };
129 | /* End PBXSourcesBuildPhase section */
130 |
131 | /* Begin XCBuildConfiguration section */
132 | 5D72D2EF1C16249000E22EC1 /* Debug */ = {
133 | isa = XCBuildConfiguration;
134 | buildSettings = {
135 | ALWAYS_SEARCH_USER_PATHS = NO;
136 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
137 | CLANG_CXX_LIBRARY = "libc++";
138 | CLANG_ENABLE_MODULES = YES;
139 | CLANG_ENABLE_OBJC_ARC = YES;
140 | CLANG_WARN_BOOL_CONVERSION = YES;
141 | CLANG_WARN_CONSTANT_CONVERSION = YES;
142 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
143 | CLANG_WARN_EMPTY_BODY = YES;
144 | CLANG_WARN_ENUM_CONVERSION = YES;
145 | CLANG_WARN_INT_CONVERSION = YES;
146 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
147 | CLANG_WARN_UNREACHABLE_CODE = YES;
148 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
149 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
150 | COPY_PHASE_STRIP = NO;
151 | DEBUG_INFORMATION_FORMAT = dwarf;
152 | ENABLE_STRICT_OBJC_MSGSEND = YES;
153 | ENABLE_TESTABILITY = YES;
154 | GCC_C_LANGUAGE_STANDARD = gnu99;
155 | GCC_DYNAMIC_NO_PIC = NO;
156 | GCC_NO_COMMON_BLOCKS = YES;
157 | GCC_OPTIMIZATION_LEVEL = 0;
158 | GCC_PREPROCESSOR_DEFINITIONS = (
159 | "DEBUG=1",
160 | "$(inherited)",
161 | );
162 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
163 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
164 | GCC_WARN_UNDECLARED_SELECTOR = YES;
165 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
166 | GCC_WARN_UNUSED_FUNCTION = YES;
167 | GCC_WARN_UNUSED_VARIABLE = YES;
168 | IPHONEOS_DEPLOYMENT_TARGET = 9.1;
169 | MTL_ENABLE_DEBUG_INFO = YES;
170 | ONLY_ACTIVE_ARCH = YES;
171 | SDKROOT = iphoneos;
172 | };
173 | name = Debug;
174 | };
175 | 5D72D2F01C16249000E22EC1 /* Release */ = {
176 | isa = XCBuildConfiguration;
177 | buildSettings = {
178 | ALWAYS_SEARCH_USER_PATHS = NO;
179 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
180 | CLANG_CXX_LIBRARY = "libc++";
181 | CLANG_ENABLE_MODULES = YES;
182 | CLANG_ENABLE_OBJC_ARC = YES;
183 | CLANG_WARN_BOOL_CONVERSION = YES;
184 | CLANG_WARN_CONSTANT_CONVERSION = YES;
185 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
186 | CLANG_WARN_EMPTY_BODY = YES;
187 | CLANG_WARN_ENUM_CONVERSION = YES;
188 | CLANG_WARN_INT_CONVERSION = YES;
189 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
190 | CLANG_WARN_UNREACHABLE_CODE = YES;
191 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
192 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
193 | COPY_PHASE_STRIP = NO;
194 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
195 | ENABLE_NS_ASSERTIONS = NO;
196 | ENABLE_STRICT_OBJC_MSGSEND = YES;
197 | GCC_C_LANGUAGE_STANDARD = gnu99;
198 | GCC_NO_COMMON_BLOCKS = YES;
199 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
200 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
201 | GCC_WARN_UNDECLARED_SELECTOR = YES;
202 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
203 | GCC_WARN_UNUSED_FUNCTION = YES;
204 | GCC_WARN_UNUSED_VARIABLE = YES;
205 | IPHONEOS_DEPLOYMENT_TARGET = 9.1;
206 | MTL_ENABLE_DEBUG_INFO = NO;
207 | SDKROOT = iphoneos;
208 | VALIDATE_PRODUCT = YES;
209 | };
210 | name = Release;
211 | };
212 | 5D72D2F21C16249000E22EC1 /* Debug */ = {
213 | isa = XCBuildConfiguration;
214 | buildSettings = {
215 | HEADER_SEARCH_PATHS = (
216 | "$(inherited)",
217 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
218 | "$(SRCROOT)/../../react-native/React/**",
219 | "$(SRCROOT)/node_modules/react-native/React",
220 | "$(SRCROOT)/../../React/**",
221 | );
222 | OTHER_LDFLAGS = "-ObjC";
223 | PRODUCT_NAME = "$(TARGET_NAME)";
224 | SKIP_INSTALL = YES;
225 | };
226 | name = Debug;
227 | };
228 | 5D72D2F31C16249000E22EC1 /* Release */ = {
229 | isa = XCBuildConfiguration;
230 | buildSettings = {
231 | HEADER_SEARCH_PATHS = (
232 | "$(inherited)",
233 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
234 | "$(SRCROOT)/../../React/**",
235 | "$(SRCROOT)/../../react-native/React/**",
236 | "$(SRCROOT)/node_modules/react-native/React/**",
237 | );
238 | OTHER_LDFLAGS = "-ObjC";
239 | PRODUCT_NAME = "$(TARGET_NAME)";
240 | SKIP_INSTALL = YES;
241 | };
242 | name = Release;
243 | };
244 | /* End XCBuildConfiguration section */
245 |
246 | /* Begin XCConfigurationList section */
247 | 5D72D2E31C16249000E22EC1 /* Build configuration list for PBXProject "RCT<%= moduleName %>" */ = {
248 | isa = XCConfigurationList;
249 | buildConfigurations = (
250 | 5D72D2EF1C16249000E22EC1 /* Debug */,
251 | 5D72D2F01C16249000E22EC1 /* Release */,
252 | );
253 | defaultConfigurationIsVisible = 0;
254 | defaultConfigurationName = Release;
255 | };
256 | 5D72D2F11C16249000E22EC1 /* Build configuration list for PBXNativeTarget "RCT<%= moduleName %>" */ = {
257 | isa = XCConfigurationList;
258 | buildConfigurations = (
259 | 5D72D2F21C16249000E22EC1 /* Debug */,
260 | 5D72D2F31C16249000E22EC1 /* Release */,
261 | );
262 | defaultConfigurationIsVisible = 0;
263 | defaultConfigurationName = Release;
264 | };
265 | /* End XCConfigurationList section */
266 | };
267 | rootObject = 5D72D2E01C16249000E22EC1 /* Project object */;
268 | }
269 |
--------------------------------------------------------------------------------
/generators/app/templates/ios/RCTModule/RCTModule.h:
--------------------------------------------------------------------------------
1 | #import "RCTBridge.h"
2 |
3 | @interface <%= moduleName %> : NSObject
4 |
5 | @end
6 |
--------------------------------------------------------------------------------
/generators/app/templates/ios/RCTModule/RCTModule.m:
--------------------------------------------------------------------------------
1 | #import "RCT<%= moduleName %>.h"
2 |
3 | @implementation <%= moduleName %>
4 |
5 | RCT_EXPORT_MODULE();
6 |
7 | RCT_REMAP_METHOD(<%= reactMethodName %>,
8 | resolver:(RCTPromiseResolveBlock)resolve
9 | rejecter:(RCTPromiseRejectBlock)reject)
10 | {
11 | resolve(@"Hello World!");
12 | }
13 |
14 | @end
15 |
--------------------------------------------------------------------------------
/generators/app/templates/ios/index.ios.js:
--------------------------------------------------------------------------------
1 | import React from 'react-native';
2 |
3 | const <%= moduleName %> = React.NativeModules.<%= moduleName %>;
4 |
5 | export default {
6 | <%= reactMethodName %>: () => {
7 | return <%= moduleName %>.<%= reactMethodName %>();
8 | },
9 | };
10 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "generator-module-react-native",
3 | "version": "0.0.2",
4 | "description": "Generate react-native android module boilerplate",
5 | "files": [
6 | "generators/app"
7 | ],
8 | "dependencies": {
9 | "mkdirp": "^0.5.1",
10 | "yeoman-generator": "^0.21.1"
11 | },
12 | "devDependencies": {},
13 | "repository": {
14 | "type": "git",
15 | "url": "git+https://github.com/bamlab/generator-module-react-native.git"
16 | },
17 | "keywords": [
18 | "yeoman-generator",
19 | "react-native",
20 | "android"
21 | ],
22 | "author": "Almouro (http://bamlab.fr)",
23 | "license": "MIT",
24 | "bugs": {
25 | "url": "https://github.com/bamlab/generator-module-react-native/issues"
26 | },
27 | "homepage": "https://github.com/bamlab/generator-module-react-native#readme"
28 | }
29 |
--------------------------------------------------------------------------------