|
| 1 | +module.exports = platform => [{ |
| 2 | + name: () => `${platform}/build.gradle`, |
| 3 | + content: () => ` |
| 4 | +apply plugin: 'com.android.library' |
| 5 | +
|
| 6 | +android { |
| 7 | + compileSdkVersion 23 |
| 8 | + buildToolsVersion "23.0.1" |
| 9 | +
|
| 10 | + defaultConfig { |
| 11 | + minSdkVersion 16 |
| 12 | + targetSdkVersion 22 |
| 13 | + versionCode 1 |
| 14 | + versionName "1.0" |
| 15 | + ndk { |
| 16 | + abiFilters "armeabi-v7a", "x86" |
| 17 | + } |
| 18 | + } |
| 19 | + lintOptions { |
| 20 | + warning 'InvalidPackage' |
| 21 | + } |
| 22 | +} |
| 23 | +
|
| 24 | +dependencies { |
| 25 | + compile 'com.facebook.react:react-native:0.20.+' |
| 26 | +} |
| 27 | + `, |
| 28 | +}, { |
| 29 | + name: () => `${platform}/src/main/AndroidManifest.xml`, |
| 30 | + content: ({ packageIdentifier }) => ` |
| 31 | +<manifest xmlns:android="http://schemas.android.com/apk/res/android" |
| 32 | + package="${packageIdentifier}"> |
| 33 | +
|
| 34 | +</manifest> |
| 35 | + `, |
| 36 | +}, { |
| 37 | + name: ({ packageIdentifier, name }) => |
| 38 | + `${platform}/src/main/java/${packageIdentifier.split('.').join('/')}/${name}Module.java`, |
| 39 | + content: ({ packageIdentifier, name }) => ` |
| 40 | +package ${packageIdentifier}; |
| 41 | +
|
| 42 | +import com.facebook.react.bridge.ReactApplicationContext; |
| 43 | +import com.facebook.react.bridge.ReactContextBaseJavaModule; |
| 44 | +import com.facebook.react.bridge.ReactMethod; |
| 45 | +import com.facebook.react.bridge.Callback; |
| 46 | +
|
| 47 | +public class ${name}Module extends ReactContextBaseJavaModule { |
| 48 | +
|
| 49 | + private final ReactApplicationContext reactContext; |
| 50 | +
|
| 51 | + public RNShareModule(ReactApplicationContext reactContext) { |
| 52 | + super(reactContext); |
| 53 | + this.reactContext = reactContext; |
| 54 | + } |
| 55 | +
|
| 56 | + @Override |
| 57 | + public String getName() { |
| 58 | + return "${name}"; |
| 59 | + } |
| 60 | +}`, |
| 61 | +}, { |
| 62 | + name: ({ packageIdentifier, name }) => |
| 63 | + `${platform}/src/main/java/${packageIdentifier.split('.').join('/')}/${name}Package.java`, |
| 64 | + content: ({ packageIdentifier, name }) => ` |
| 65 | +package ${packageIdentifier}; |
| 66 | +
|
| 67 | +import java.util.Arrays; |
| 68 | +import java.util.Collections; |
| 69 | +import java.util.List; |
| 70 | +
|
| 71 | +import com.facebook.react.ReactPackage; |
| 72 | +import com.facebook.react.bridge.NativeModule; |
| 73 | +import com.facebook.react.bridge.ReactApplicationContext; |
| 74 | +import com.facebook.react.uimanager.ViewManager; |
| 75 | +import com.facebook.react.bridge.JavaScriptModule; |
| 76 | +public class ${name}Package implements ReactPackage { |
| 77 | + @Override |
| 78 | + public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) { |
| 79 | + return Arrays.<NativeModule>asList(new ${name}Module(reactContext)); |
| 80 | + } |
| 81 | +
|
| 82 | + @Override |
| 83 | + public List<Class<? extends JavaScriptModule>> createJSModules() { |
| 84 | + return Collections.emptyList(); |
| 85 | + } |
| 86 | +
|
| 87 | + @Override |
| 88 | + public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) { |
| 89 | + return Collections.emptyList(); |
| 90 | + } |
| 91 | +}`, |
| 92 | +}]; |
0 commit comments