Commit e7a281942d7ba07122d3b8d738ef13d3b128ea0e
First commit, downloading files from Dat
romuloalves committed on 11/12/2017, 1:02:16 PMFiles changed
.buckconfig | ||
---|---|---|
@@ -1,0 +1,6 @@ | ||
1 … | + | |
2 … | +[android] | |
3 … | + target = Google Inc.:Google APIs:23 | |
4 … | + | |
5 … | +[maven_repositories] | |
6 … | + central = https://repo1.maven.org/maven2 |
.flowconfig | ||
---|---|---|
@@ -1,0 +1,48 @@ | ||
1 … | +[ignore] | |
2 … | +; We fork some components by platform | |
3 … | +.*/*[.]android.js | |
4 … | + | |
5 … | +; Ignore "BUCK" generated dirs | |
6 … | +<PROJECT_ROOT>/\.buckd/ | |
7 … | + | |
8 … | +; Ignore unexpected extra "@providesModule" | |
9 … | +.*/node_modules/.*/node_modules/fbjs/.* | |
10 … | + | |
11 … | +; Ignore duplicate module providers | |
12 … | +; For RN Apps installed via npm, "Libraries" folder is inside | |
13 … | +; "node_modules/react-native" but in the source repo it is in the root | |
14 … | +.*/Libraries/react-native/React.js | |
15 … | + | |
16 … | +; Ignore polyfills | |
17 … | +.*/Libraries/polyfills/.* | |
18 … | + | |
19 … | +[include] | |
20 … | + | |
21 … | +[libs] | |
22 … | +node_modules/react-native/Libraries/react-native/react-native-interface.js | |
23 … | +node_modules/react-native/flow/ | |
24 … | + | |
25 … | +[options] | |
26 … | +emoji=true | |
27 … | + | |
28 … | +module.system=haste | |
29 … | + | |
30 … | +munge_underscores=true | |
31 … | + | |
32 … | +module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> 'RelativeImageStub' | |
33 … | + | |
34 … | +suppress_type=$FlowIssue | |
35 … | +suppress_type=$FlowFixMe | |
36 … | +suppress_type=$FlowFixMeProps | |
37 … | +suppress_type=$FlowFixMeState | |
38 … | +suppress_type=$FixMe | |
39 … | + | |
40 … | +suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(5[0-6]\\|[1-4][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\) | |
41 … | +suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(5[0-6]\\|[1-4][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+ | |
42 … | +suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy | |
43 … | +suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError | |
44 … | + | |
45 … | +unsafe.enable_getters_and_setters=true | |
46 … | + | |
47 … | +[version] | |
48 … | +^0.56.0 |
.gitignore | ||
---|---|---|
@@ -1,0 +1,53 @@ | ||
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 |
App.js | ||
---|---|---|
@@ -1,0 +1,110 @@ | ||
1 … | +/** | |
2 … | + * Sample React Native App | |
3 … | + * https://github.com/facebook/react-native | |
4 … | + * @flow | |
5 … | + */ | |
6 … | + | |
7 … | +import React, { Component } from 'react' | |
8 … | +import { | |
9 … | + Button, | |
10 … | + Text, | |
11 … | + TextInput, | |
12 … | + View | |
13 … | +} from 'react-native' | |
14 … | + | |
15 … | +import nodejs from 'nodejs-mobile-react-native' | |
16 … | + | |
17 … | +import RNFS from 'react-native-fs' | |
18 … | + | |
19 … | +const BASE_URI = 'http://localhost:8182' | |
20 … | + | |
21 … | +export default class App extends Component<{}> { | |
22 … | + constructor (props) { | |
23 … | + super(props) | |
24 … | + | |
25 … | + this.state = { | |
26 … | + key: '', | |
27 … | + files: [] | |
28 … | + } | |
29 … | + | |
30 … | + this.getDatFiles = this.getDatFiles.bind(this) | |
31 … | + this.setPath = this.setPath.bind(this) | |
32 … | + } | |
33 … | + | |
34 … | + componentWillMount () { | |
35 … | + nodejs.start(); | |
36 … | + nodejs.channel.addListener( | |
37 … | + 'message', | |
38 … | + () => { | |
39 … | + this.setPath() | |
40 … | + }, | |
41 … | + this | |
42 … | + ); | |
43 … | + } | |
44 … | + | |
45 … | + async setPath () { | |
46 … | + try { | |
47 … | + await fetch(`${BASE_URI}/setPath`, { | |
48 … | + method: 'POST', | |
49 … | + headers: { | |
50 … | + 'Content-Type': 'application/json' | |
51 … | + }, | |
52 … | + body: JSON.stringify({ | |
53 … | + path: RNFS.DocumentDirectoryPath | |
54 … | + }) | |
55 … | + }) | |
56 … | + } catch (err) { | |
57 … | + alert(JSON.stringify(err)) | |
58 … | + } | |
59 … | + } | |
60 … | + | |
61 … | + async getDatFiles () { | |
62 … | + const { key } = this.state | |
63 … | + | |
64 … | + try { | |
65 … | + const response = await fetch(`${BASE_URI}/download/${key}`, { method: 'POST' }) | |
66 … | + alert('Dat downloaded!') | |
67 … | + | |
68 … | + const filesJson = await response.json() | |
69 … | + | |
70 … | + this.setState({ | |
71 … | + files: filesJson | |
72 … | + }) | |
73 … | + } catch (err) { | |
74 … | + alert(JSON.stringify(err)) | |
75 … | + } | |
76 … | + } | |
77 … | + | |
78 … | + render() { | |
79 … | + const files = this.state.files.map(item => { | |
80 … | + return <Text key={ item }>{ item }</Text> | |
81 … | + }) | |
82 … | + | |
83 … | + return ( | |
84 … | + <View style={{ | |
85 … | + paddingTop: 40, | |
86 … | + paddingLeft: 20, | |
87 … | + paddingRight: 20, | |
88 … | + flex: 1, | |
89 … | + justifyContent: 'center' | |
90 … | + }}> | |
91 … | + <TextInput | |
92 … | + onChangeText={ text => this.setState({ key: text }) } | |
93 … | + style={{ | |
94 … | + height: 40, | |
95 … | + borderColor: 'gray', | |
96 … | + borderWidth: 1 | |
97 … | + }} /> | |
98 … | + <Button title="Download" | |
99 … | + onPress={ () => this.getDatFiles() } /> | |
100 … | + | |
101 … | + <View style={{ | |
102 … | + flex: 1, | |
103 … | + height: 300 | |
104 … | + }}> | |
105 … | + { files } | |
106 … | + </View> | |
107 … | + </View> | |
108 … | + ); | |
109 … | + } | |
110 … | +} |
__tests__/App.js | ||
---|---|---|
@@ -1,0 +1,12 @@ | ||
1 … | +import 'react-native'; | |
2 … | +import React from 'react'; | |
3 … | +import App from '../App'; | |
4 … | + | |
5 … | +// Note: test renderer must be required after react-native. | |
6 … | +import renderer from 'react-test-renderer'; | |
7 … | + | |
8 … | +it('renders correctly', () => { | |
9 … | + const tree = renderer.create( | |
10 … | + <App /> | |
11 … | + ); | |
12 … | +}); |
android/app/BUCK | ||
---|---|---|
@@ -1,0 +1,65 @@ | ||
1 … | +# To learn about Buck see [Docs](https://buckbuild.com/). | |
2 … | +# To run your application with Buck: | |
3 … | +# - install Buck | |
4 … | +# - `npm start` - to start the packager | |
5 … | +# - `cd android` | |
6 … | +# - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US"` | |
7 … | +# - `./gradlew :app:copyDownloadableDepsToLibs` - make all Gradle compile dependencies available to Buck | |
8 … | +# - `buck install -r android/app` - compile, install and run application | |
9 … | +# | |
10 … | + | |
11 … | +lib_deps = [] | |
12 … | + | |
13 … | +for jarfile in glob(['libs/*.jar']): | |
14 … | + name = 'jars__' + jarfile[jarfile.rindex('/') + 1: jarfile.rindex('.jar')] | |
15 … | + lib_deps.append(':' + name) | |
16 … | + prebuilt_jar( | |
17 … | + name = name, | |
18 … | + binary_jar = jarfile, | |
19 … | + ) | |
20 … | + | |
21 … | +for aarfile in glob(['libs/*.aar']): | |
22 … | + name = 'aars__' + aarfile[aarfile.rindex('/') + 1: aarfile.rindex('.aar')] | |
23 … | + lib_deps.append(':' + name) | |
24 … | + android_prebuilt_aar( | |
25 … | + name = name, | |
26 … | + aar = aarfile, | |
27 … | + ) | |
28 … | + | |
29 … | +android_library( | |
30 … | + name = "all-libs", | |
31 … | + exported_deps = lib_deps, | |
32 … | +) | |
33 … | + | |
34 … | +android_library( | |
35 … | + name = "app-code", | |
36 … | + srcs = glob([ | |
37 … | + "src/main/java/**/*.java", | |
38 … | + ]), | |
39 … | + deps = [ | |
40 … | + ":all-libs", | |
41 … | + ":build_config", | |
42 … | + ":res", | |
43 … | + ], | |
44 … | +) | |
45 … | + | |
46 … | +android_build_config( | |
47 … | + name = "build_config", | |
48 … | + package = "com.datreactnative", | |
49 … | +) | |
50 … | + | |
51 … | +android_resource( | |
52 … | + name = "res", | |
53 … | + package = "com.datreactnative", | |
54 … | + res = "src/main/res", | |
55 … | +) | |
56 … | + | |
57 … | +android_binary( | |
58 … | + name = "app", | |
59 … | + keystore = "//android/keystores:debug", | |
60 … | + manifest = "src/main/AndroidManifest.xml", | |
61 … | + package_type = "debug", | |
62 … | + deps = [ | |
63 … | + ":app-code", | |
64 … | + ], | |
65 … | +) |
android/app/build.gradle | ||
---|---|---|
@@ -1,0 +1,152 @@ | ||
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 | |
19 … | + * entryFile: "index.android.js", | |
20 … | + * | |
21 … | + * // whether to bundle JS and assets in debug mode | |
22 … | + * bundleInDebug: false, | |
23 … | + * | |
24 … | + * // whether to bundle JS and assets in release mode | |
25 … | + * bundleInRelease: true, | |
26 … | + * | |
27 … | + * // whether to bundle JS and assets in another build variant (if configured). | |
28 … | + * // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants | |
29 … | + * // The configuration property can be in the following formats | |
30 … | + * // 'bundleIn${productFlavor}${buildType}' | |
31 … | + * // 'bundleIn${buildType}' | |
32 … | + * // bundleInFreeDebug: true, | |
33 … | + * // bundleInPaidRelease: true, | |
34 … | + * // bundleInBeta: true, | |
35 … | + * | |
36 … | + * // whether to disable dev mode in custom build variants (by default only disabled in release) | |
37 … | + * // for example: to disable dev mode in the staging build type (if configured) | |
38 … | + * devDisabledInStaging: true, | |
39 … | + * // The configuration property can be in the following formats | |
40 … | + * // 'devDisabledIn${productFlavor}${buildType}' | |
41 … | + * // 'devDisabledIn${buildType}' | |
42 … | + * | |
43 … | + * // the root of your project, i.e. where "package.json" lives | |
44 … | + * root: "../../", | |
45 … | + * | |
46 … | + * // where to put the JS bundle asset in debug mode | |
47 … | + * jsBundleDirDebug: "$buildDir/intermediates/assets/debug", | |
48 … | + * | |
49 … | + * // where to put the JS bundle asset in release mode | |
50 … | + * jsBundleDirRelease: "$buildDir/intermediates/assets/release", | |
51 … | + * | |
52 … | + * // where to put drawable resources / React Native assets, e.g. the ones you use via | |
53 … | + * // require('./image.png')), in debug mode | |
54 … | + * resourcesDirDebug: "$buildDir/intermediates/res/merged/debug", | |
55 … | + * | |
56 … | + * // where to put drawable resources / React Native assets, e.g. the ones you use via | |
57 … | + * // require('./image.png')), in release mode | |
58 … | + * resourcesDirRelease: "$buildDir/intermediates/res/merged/release", | |
59 … | + * | |
60 … | + * // by default the gradle tasks are skipped if none of the JS files or assets change; this means | |
61 … | + * // that we don't look at files in android/ or ios/ to determine whether the tasks are up to | |
62 … | + * // date; if you have any other folders that you want to ignore for performance reasons (gradle | |
63 … | + * // indexes the entire tree), add them here. Alternatively, if you have JS files in android/ | |
64 … | + * // for example, you might want to remove it from here. | |
65 … | + * inputExcludes: ["android/**", "ios/**"], | |
66 … | + * | |
67 … | + * // override which node gets called and with what additional arguments | |
68 … | + * nodeExecutableAndArgs: ["node"], | |
69 … | + * | |
70 … | + * // supply additional arguments to the packager | |
71 … | + * extraPackagerArgs: [] | |
72 … | + * ] | |
73 … | + */ | |
74 … | + | |
75 … | +project.ext.react = [ | |
76 … | + entryFile: "index.js" | |
77 … | +] | |
78 … | + | |
79 … | +apply from: "../../node_modules/react-native/react.gradle" | |
80 … | + | |
81 … | +/** | |
82 … | + * Set this to true to create two separate APKs instead of one: | |
83 … | + * - An APK that only works on ARM devices | |
84 … | + * - An APK that only works on x86 devices | |
85 … | + * The advantage is the size of the APK is reduced by about 4MB. | |
86 … | + * Upload all the APKs to the Play Store and people will download | |
87 … | + * the correct one based on the CPU architecture of their device. | |
88 … | + */ | |
89 … | +def enableSeparateBuildPerCPUArchitecture = false | |
90 … | + | |
91 … | +/** | |
92 … | + * Run Proguard to shrink the Java bytecode in release builds. | |
93 … | + */ | |
94 … | +def enableProguardInReleaseBuilds = false | |
95 … | + | |
96 … | +android { | |
97 … | + compileSdkVersion 23 | |
98 … | + buildToolsVersion "23.0.1" | |
99 … | + | |
100 … | + defaultConfig { | |
101 … | + applicationId "com.datreactnative" | |
102 … | + minSdkVersion 16 | |
103 … | + targetSdkVersion 22 | |
104 … | + versionCode 1 | |
105 … | + versionName "1.0" | |
106 … | + ndk { | |
107 … | + abiFilters "armeabi-v7a", "x86" | |
108 … | + } | |
109 … | + } | |
110 … | + splits { | |
111 … | + abi { | |
112 … | + reset() | |
113 … | + enable enableSeparateBuildPerCPUArchitecture | |
114 … | + universalApk false // If true, also generate a universal APK | |
115 … | + include "armeabi-v7a", "x86" | |
116 … | + } | |
117 … | + } | |
118 … | + buildTypes { | |
119 … | + release { | |
120 … | + minifyEnabled enableProguardInReleaseBuilds | |
121 … | + proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" | |
122 … | + } | |
123 … | + } | |
124 … | + // applicationVariants are e.g. debug, release | |
125 … | + applicationVariants.all { variant -> | |
126 … | + variant.outputs.each { output -> | |
127 … | + // For each separate APK per architecture, set a unique version code as described here: | |
128 … | + // http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits | |
129 … | + def versionCodes = ["armeabi-v7a":1, "x86":2] | |
130 … | + def abi = output.getFilter(OutputFile.ABI) | |
131 … | + if (abi != null) { // null for the universal-debug, universal-release variants | |
132 … | + output.versionCodeOverride = | |
133 … | + versionCodes.get(abi) * 1048576 + defaultConfig.versionCode | |
134 … | + } | |
135 … | + } | |
136 … | + } | |
137 … | +} | |
138 … | + | |
139 … | +dependencies { | |
140 … | + compile project(':react-native-fs') | |
141 … | + compile project(':nodejs-mobile-react-native') | |
142 … | + compile fileTree(dir: "libs", include: ["*.jar"]) | |
143 … | + compile "com.android.support:appcompat-v7:23.0.1" | |
144 … | + compile "com.facebook.react:react-native:+" // From node_modules | |
145 … | +} | |
146 … | + | |
147 … | +// Run this once to be able to run the application with BUCK | |
148 … | +// puts all compile dependencies into folder libs for BUCK to use | |
149 … | +task copyDownloadableDepsToLibs(type: Copy) { | |
150 … | + from configurations.compile | |
151 … | + into 'libs' | |
152 … | +} |
android/app/proguard-rules.pro | ||
---|---|---|
@@ -1,0 +1,70 @@ | ||
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 … | + | |
12 … | +# If your project uses WebView with JS, uncomment the following | |
13 … | +# and specify the fully qualified class name to the JavaScript interface | |
14 … | +# class: | |
15 … | +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { | |
16 … | +# public *; | |
17 … | +#} | |
18 … | + | |
19 … | +# Disabling obfuscation is useful if you collect stack traces from production crashes | |
20 … | +# (unless you are using a system that supports de-obfuscate the stack traces). | |
21 … | +-dontobfuscate | |
22 … | + | |
23 … | +# React Native | |
24 … | + | |
25 … | +# Keep our interfaces so they can be used by other ProGuard rules. | |
26 … | +# See http://sourceforge.net/p/proguard/bugs/466/ | |
27 … | +-keep,allowobfuscation @interface com.facebook.proguard.annotations.DoNotStrip | |
28 … | +-keep,allowobfuscation @interface com.facebook.proguard.annotations.KeepGettersAndSetters | |
29 … | +-keep,allowobfuscation @interface com.facebook.common.internal.DoNotStrip | |
30 … | + | |
31 … | +# Do not strip any method/class that is annotated with @DoNotStrip | |
32 … | +-keep @com.facebook.proguard.annotations.DoNotStrip class * | |
33 … | +-keep @com.facebook.common.internal.DoNotStrip class * | |
34 … | +-keepclassmembers class * { | |
35 … | + @com.facebook.proguard.annotations.DoNotStrip *; | |
36 … | + @com.facebook.common.internal.DoNotStrip *; | |
37 … | +} | |
38 … | + | |
39 … | +-keepclassmembers @com.facebook.proguard.annotations.KeepGettersAndSetters class * { | |
40 … | + void set*(***); | |
41 … | + *** get*(); | |
42 … | +} | |
43 … | + | |
44 … | +-keep class * extends com.facebook.react.bridge.JavaScriptModule { *; } | |
45 … | +-keep class * extends com.facebook.react.bridge.NativeModule { *; } | |
46 … | +-keepclassmembers,includedescriptorclasses class * { native <methods>; } | |
47 … | +-keepclassmembers class * { @com.facebook.react.uimanager.UIProp <fields>; } | |
48 … | +-keepclassmembers class * { @com.facebook.react.uimanager.annotations.ReactProp <methods>; } | |
49 … | +-keepclassmembers class * { @com.facebook.react.uimanager.annotations.ReactPropGroup <methods>; } | |
50 … | + | |
51 … | +-dontwarn com.facebook.react.** | |
52 … | + | |
53 … | +# TextLayoutBuilder uses a non-public Android constructor within StaticLayout. | |
54 … | +# See libs/proxy/src/main/java/com/facebook/fbui/textlayoutbuilder/proxy for details. | |
55 … | +-dontwarn android.text.StaticLayout | |
56 … | + | |
57 … | +# okhttp | |
58 … | + | |
59 … | +-keepattributes Signature | |
60 … | +-keepattributes *Annotation* | |
61 … | +-keep class okhttp3.** { *; } | |
62 … | +-keep interface okhttp3.** { *; } | |
63 … | +-dontwarn okhttp3.** | |
64 … | + | |
65 … | +# okio | |
66 … | + | |
67 … | +-keep class sun.misc.Unsafe { *; } | |
68 … | +-dontwarn java.nio.file.* | |
69 … | +-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement | |
70 … | +-dontwarn okio.** |
android/app/src/main/AndroidManifest.xml | ||
---|---|---|
@@ -1,0 +1,32 @@ | ||
1 … | +<manifest xmlns:android="http://schemas.android.com/apk/res/android" | |
2 … | + package="com.datreactnative" | |
3 … | + android:versionCode="1" | |
4 … | + android:versionName="1.0"> | |
5 … | + | |
6 … | + <uses-permission android:name="android.permission.INTERNET" /> | |
7 … | + <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/> | |
8 … | + | |
9 … | + <uses-sdk | |
10 … | + android:minSdkVersion="16" | |
11 … | + android:targetSdkVersion="22" /> | |
12 … | + | |
13 … | + <application | |
14 … | + android:name=".MainApplication" | |
15 … | + android:allowBackup="true" | |
16 … | + android:label="@string/app_name" | |
17 … | + android:icon="@mipmap/ic_launcher" | |
18 … | + android:theme="@style/AppTheme"> | |
19 … | + <activity | |
20 … | + android:name=".MainActivity" | |
21 … | + android:label="@string/app_name" | |
22 … | + android:configChanges="keyboard|keyboardHidden|orientation|screenSize" | |
23 … | + android:windowSoftInputMode="adjustResize"> | |
24 … | + <intent-filter> | |
25 … | + <action android:name="android.intent.action.MAIN" /> | |
26 … | + <category android:name="android.intent.category.LAUNCHER" /> | |
27 … | + </intent-filter> | |
28 … | + </activity> | |
29 … | + <activity android:name="com.facebook.react.devsupport.DevSettingsActivity" /> | |
30 … | + </application> | |
31 … | + | |
32 … | +</manifest> |
android/app/src/main/java/com/datreactnative/MainActivity.java | ||
---|---|---|
@@ -1,0 +1,15 @@ | ||
1 … | +package com.datreactnative; | |
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. | |
9 … | + * This is used to schedule rendering of the component. | |
10 … | + */ | |
11 … | + | |
12 … | + protected String getMainComponentName() { | |
13 … | + return "datReactNative"; | |
14 … | + } | |
15 … | +} |
android/app/src/main/java/com/datreactnative/MainApplication.java | ||
---|---|---|
@@ -1,0 +1,49 @@ | ||
1 … | +package com.datreactnative; | |
2 … | + | |
3 … | +import android.app.Application; | |
4 … | + | |
5 … | +import com.facebook.react.ReactApplication; | |
6 … | +import com.rnfs.RNFSPackage; | |
7 … | +import com.janeasystems.rn_nodejs_mobile.RNNodeJsMobilePackage; | |
8 … | +import com.facebook.react.ReactNativeHost; | |
9 … | +import com.facebook.react.ReactPackage; | |
10 … | +import com.facebook.react.shell.MainReactPackage; | |
11 … | +import com.facebook.soloader.SoLoader; | |
12 … | + | |
13 … | +import java.util.Arrays; | |
14 … | +import java.util.List; | |
15 … | + | |
16 … | +public class MainApplication extends Application implements ReactApplication { | |
17 … | + | |
18 … | + private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) { | |
19 … | + | |
20 … | + public boolean getUseDeveloperSupport() { | |
21 … | + return BuildConfig.DEBUG; | |
22 … | + } | |
23 … | + | |
24 … | + | |
25 … | + protected List<ReactPackage> getPackages() { | |
26 … | + return Arrays.<ReactPackage>asList( | |
27 … | + new MainReactPackage(), | |
28 … | + new RNFSPackage(), | |
29 … | + new RNNodeJsMobilePackage() | |
30 … | + ); | |
31 … | + } | |
32 … | + | |
33 … | + | |
34 … | + protected String getJSMainModuleName() { | |
35 … | + return "index"; | |
36 … | + } | |
37 … | + }; | |
38 … | + | |
39 … | + | |
40 … | + public ReactNativeHost getReactNativeHost() { | |
41 … | + return mReactNativeHost; | |
42 … | + } | |
43 … | + | |
44 … | + | |
45 … | + public void onCreate() { | |
46 … | + super.onCreate(); | |
47 … | + SoLoader.init(this, /* native exopackage */ false); | |
48 … | + } | |
49 … | +} |
android/app/src/main/res/mipmap-hdpi/ic_launcher.png |
---|
android/app/src/main/res/mipmap-mdpi/ic_launcher.png |
---|
android/app/src/main/res/mipmap-xhdpi/ic_launcher.png |
---|
android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png |
---|
android/app/src/main/res/values/strings.xml | ||
---|---|---|
@@ -1,0 +1,3 @@ | ||
1 … | +<resources> | |
2 … | + <string name="app_name">datReactNative</string> | |
3 … | +</resources> |
android/app/src/main/res/values/styles.xml | ||
---|---|---|
@@ -1,0 +1,8 @@ | ||
1 … | +<resources> | |
2 … | + | |
3 … | + <!-- Base application theme. --> | |
4 … | + <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar"> | |
5 … | + <!-- Customize your theme here. --> | |
6 … | + </style> | |
7 … | + | |
8 … | +</resources> |
android/build.gradle | ||
---|---|---|
@@ -1,0 +1,24 @@ | ||
1 … | +// Top-level build file where you can add configuration options common to all sub-projects/modules. | |
2 … | + | |
3 … | +buildscript { | |
4 … | + repositories { | |
5 … | + jcenter() | |
6 … | + } | |
7 … | + dependencies { | |
8 … | + classpath 'com.android.tools.build:gradle:2.2.3' | |
9 … | + | |
10 … | + // NOTE: Do not place your application dependencies here; they belong | |
11 … | + // in the individual module build.gradle files | |
12 … | + } | |
13 … | +} | |
14 … | + | |
15 … | +allprojects { | |
16 … | + repositories { | |
17 … | + mavenLocal() | |
18 … | + jcenter() | |
19 … | + maven { | |
20 … | + // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm | |
21 … | + url "$rootDir/../node_modules/react-native/android" | |
22 … | + } | |
23 … | + } | |
24 … | +} |
android/gradle.properties | ||
---|---|---|
@@ -1,0 +1,20 @@ | ||
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 … | +android.useDeprecatedNdk=true |
android/gradle/wrapper/gradle-wrapper.jar | ||
---|---|---|
@@ -1,0 +1,313 @@ | ||
1 … | +PK | |
2 … | + `Q�F META-INF/ PK | |
3 … | + `Q�Fr+��? T META-INF/MANIFEST.MF�M��LK-.� K-*��ϳR0�3����-�I�M�+I, | |
4 … | +�d��Z)�%��b�µ��r�r PK | |
5 … | + ]Q�F org/ PK | |
6 … | + ]Q�F org/gradle/ PK | |
7 … | + ]Q�F org/gradle/wrapper/ PK | |
8 … | + ]Q�Fh�df� � # org/gradle/wrapper/Download$1.class}�M | |
9 … | +�0��h5Z+v/�׆��p!.<AlCl II�����q�<�=�|��� C��bB|�7��}�%a����V�J�a�3���4�(��-&��u�+' | |
10 … | +-y�D]K��� Br0F���KOH;��(~�T2o�?�t=|���"BF��� u-} PK | |
11 … | + ]Q�F�ޅ� p D org/gradle/wrapper/Download$SystemPropertiesProxyAuthenticator.class�SmoA~(����`����zT�o�` �� 1M�ML?mag�wdo���m4�����@� ����<��<;������ �xj"�� k)�6���6SX��[�k"����{�^�]��S<dH�¦`X�{�x�=9�-?�)b������~L��1��#%N�e�Ry""�_������*��� ���(�yYe�mI��ۓ�CTw/�~ț��V�[B�S�^(�c�N����n �;=�b�>H�3SK��;�a(�Id0®l�W�O�*i)2X�sd1,���:���"! <�P�Kw���jd�@��C<�x°��e��V9�Μ Cv@�y�r�}������[N},EI/hU���MI�Gjv2F"TXksY�����S<�1䧴8���^�qL��_fAq����#Z��K�^���LNYZ�� �eZ�al\#�@��JQ��!��N�c�N��9R_p�槉rb�\~X��n��='iaӵ� #-�[��mu�W���Q���N��/PK | |
12 … | + ]Q�F��Xs� � " |