forked from facebook/react-native
-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from foghina/initandroid
react-native init should generate an android project
- Loading branch information
Showing
27 changed files
with
159 additions
and
100 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
26 changes: 26 additions & 0 deletions
26
local-cli/generator-react-native-android/generators/app/templates/package/RNActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package <%= package %>; | ||
|
||
import android.os.Bundle; | ||
|
||
import com.facebook.react.shell.BaseReactActivity; | ||
|
||
|
||
public class RNActivity extends BaseReactActivity { | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
loadApp("<%= name %>"); | ||
} | ||
|
||
@Override | ||
protected String getDefaultBundleName() { | ||
return "index.android.js"; | ||
} | ||
|
||
@Override | ||
protected String getDefaultMainModule() { | ||
return "<%= name %>"; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
18 changes: 18 additions & 0 deletions
18
...erator-react-native-android/generators/app/templates/src/app/src/main/AndroidManifest.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="<%= package %>"> | ||
|
||
<application | ||
android:allowBackup="true" | ||
android:label="@string/app_name" | ||
android:icon="@mipmap/ic_launcher" | ||
android:theme="@style/AppTheme"> | ||
<activity | ||
android:name=".RNActivity"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
</application> | ||
|
||
</manifest> |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
3 changes: 3 additions & 0 deletions
3
local-cli/generator-react-native-android/generators/app/templates/src/settings.gradle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
rootProject.name = '<%= appname %>' | ||
|
||
include ':app' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
'use strict'; | ||
|
||
var path = require('path'); | ||
var assert = require('yeoman-generator').assert; | ||
var helpers = require('yeoman-generator').test; | ||
var os = require('os'); | ||
|
||
describe('react-native-android:app', function () { | ||
before(function (done) { | ||
helpers.run(path.join(__dirname, '..', 'generators', 'app')) | ||
.withArguments(['TestApp']) | ||
.withPrompts({package: 'com.reactnative.test', name: 'Test App', sdkdir: '/path/to/sdk'}) | ||
.on('end', done); | ||
}); | ||
|
||
it('creates files', function () { | ||
assert.file([ | ||
'build.gradle', | ||
'gradle.properties', | ||
'gradlew.bat', | ||
'gradlew', | ||
'local.properties', | ||
'settings.gradle', | ||
path.join('app', 'build.gradle'), | ||
path.join('app', 'proguard-rules.pro'), | ||
path.join('app', 'src', 'main', 'AndroidManifest.xml'), | ||
path.join('app', 'src', 'main', 'java', 'com', 'reactnative', 'test', 'RNActivity.java'), | ||
path.join('app', 'src', 'main', 'res', 'mipmap-hdpi', 'ic_launcher.png'), | ||
path.join('app', 'src', 'main', 'res', 'mipmap-mdpi', 'ic_launcher.png'), | ||
path.join('app', 'src', 'main', 'res', 'mipmap-xhdpi', 'ic_launcher.png'), | ||
path.join('app', 'src', 'main', 'res', 'mipmap-xxhdpi', 'ic_launcher.png'), | ||
path.join('app', 'src', 'main', 'res', 'values', 'strings.xml'), | ||
path.join('app', 'src', 'main', 'res', 'values', 'styles.xml'), | ||
path.join('gradle', 'wrapper', 'gradle-wrapper.jar'), | ||
path.join('gradle', 'wrapper', 'gradle-wrapper.properties') | ||
]); | ||
}); | ||
|
||
it('replaces variables', function() { | ||
assert.fileContent('local.properties', 'sdk.dir=/path/to/sdk'); | ||
assert.fileContent(path.join('app', 'build.gradle'), 'applicationId "com.reactnative.test"'); | ||
assert.fileContent( | ||
path.join('app', 'src', 'main', 'AndroidManifest.xml'), | ||
'package="com.reactnative.test"' | ||
); | ||
assert.fileContent( | ||
path.join('app', 'src', 'main', 'AndroidManifest.xml'), | ||
'name=".RNActivity"' | ||
); | ||
assert.fileContent( | ||
path.join('app', 'src', 'main', 'java', 'com', 'reactnative', 'test', 'RNActivity.java'), | ||
'package com.reactnative.test;' | ||
); | ||
assert.fileContent( | ||
path.join('app', 'src', 'main', 'java', 'com', 'reactnative', 'test', 'RNActivity.java'), | ||
'loadApp("TestApp");' | ||
); | ||
assert.fileContent( | ||
path.join('app', 'src', 'main', 'res', 'values', 'strings.xml'), | ||
'<string name="app_name">Test App</string>' | ||
); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 0 additions & 1 deletion
1
react-native-cli/generator-react-native-android/generators/app/templates/bin/settings.gradle
This file was deleted.
Oops, something went wrong.
9 changes: 0 additions & 9 deletions
9
...erator-react-native-android/generators/app/templates/src/app/src/main/AndroidManifest.xml
This file was deleted.
Oops, something went wrong.
56 changes: 0 additions & 56 deletions
56
react-native-cli/generator-react-native-android/test/test-app.js
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters