[SampleApp] adding unsynced changes from PR #3025

This commit is contained in:
Felix Oghină 2015-09-30 15:15:30 +01:00
parent 5b2099f87f
commit 3e7af6e1a4
3 changed files with 15 additions and 16 deletions

View File

@ -16,12 +16,12 @@ Make sure you have the following installed:
- SDK build tools version 22.0.1 (buildToolsVersion in [`build.gradle`](build.gradle)) - SDK build tools version 22.0.1 (buildToolsVersion in [`build.gradle`](build.gradle))
- Android Support Repository 17 (for Android Support Library) - Android Support Repository 17 (for Android Support Library)
- Android NDK (download & extraction instructions [here](http://developer.android.com/ndk/downloads/index.html)) - Android NDK (download & extraction instructions [here](http://developer.android.com/ndk/downloads/index.html))
Point Gradle to your Android SDK: either have `$ANDROID_SDK` and `$ANDROID_NDK` defined, or create a `local.properties` file in the root of your `react-native` checkout with the following contents: Point Gradle to your Android SDK: either have `$ANDROID_SDK` and `$ANDROID_NDK` defined, or create a `local.properties` file in the root of your `react-native` checkout with the following contents:
sdk.dir=absolute_path_to_android_sdk sdk.dir=absolute_path_to_android_sdk
ndk.dir=absolute_path_to_android_ndk ndk.dir=absolute_path_to_android_ndk
Example: Example:
sdk.dir=/Users/your_unix_name/android-sdk-macosx sdk.dir=/Users/your_unix_name/android-sdk-macosx
@ -53,33 +53,32 @@ To install a snapshot version of the framework code in your local Maven repo:
## Running the examples ## Running the examples
To run the Sample app: To run the UIExplorer app:
```bash ```bash
cd react-native cd react-native
./gradlew :Examples:SampleApp:android:app:installDebug ./gradlew :Examples:UIExplorer:android:app:installDebug
# Start the packager in a separate shell: # Start the packager in a separate shell:
# Make sure you ran npm install # Make sure you ran npm install
./packager/packager.sh ./packager/packager.sh
# Open SampleApp in your emulator, Menu button -> Reload JS should work # Open UIExplorer in your emulator, Menu button -> Reload JS should work
``` ```
You can run any other sample app the same way, e.g.: You can run any other sample app the same way, e.g.:
```bash ```bash
./gradlew :Examples:Movies:android:app:installDebug ./gradlew :Examples:Movies:android:app:installDebug
./gradlew :Examples:UIExplorer:android:app:installDebug
``` ```
## Building from Android Studio ## Building from Android Studio
You'll need to do one additional step until we release the React Native Gradle plugin to Maven central. This is because Android Studio has its own local Maven repo: You'll need to do one additional step until we release the React Native Gradle plugin to Maven central. This is because Android Studio has its own local Maven repo:
mkdir -p /Applications/Android\ Studio.app/Contents/gradle/m2repository/com/facebook/react mkdir -p /Applications/Android\ Studio.app/Contents/gradle/m2repository/com/facebook/react
cp -r ~/.m2/repository/com/facebook/react/gradleplugin /Applications/Android\ Studio.app/Contents/gradle/m2repository/com/facebook/react/ cp -r ~/.m2/repository/com/facebook/react/gradleplugin /Applications/Android\ Studio.app/Contents/gradle/m2repository/com/facebook/react/
Now, open Android Studio, click _Import Non-Android Studio project_ and find your `react-native` repo. Now, open Android Studio, click _Import Non-Android Studio project_ and find your `react-native` repo.
In the configurations dropdown, _app_ should be selected. Click _Run_. In the configurations dropdown, _app_ should be selected. Click _Run_.
## Installing the React Native .aar in your local Maven repo ## Installing the React Native .aar in your local Maven repo

View File

@ -56,7 +56,7 @@ describe('React Yeoman Generators', function() {
'AppRegistry.registerComponent(\'TestApp\', () => TestApp);' 'AppRegistry.registerComponent(\'TestApp\', () => TestApp);'
); );
assert.noFileContent('index.ios.js', 'SampleApp'); assert.noFileContent('index.ios.js', '<%= name %>');
}); });
it('replaces vars in index.android.js', function() { it('replaces vars in index.android.js', function() {
@ -66,7 +66,7 @@ describe('React Yeoman Generators', function() {
'AppRegistry.registerComponent(\'TestApp\', () => TestApp);' 'AppRegistry.registerComponent(\'TestApp\', () => TestApp);'
); );
assert.noFileContent('index.ios.js', 'SampleApp'); assert.noFileContent('index.ios.js', '<%= name %>');
}); });
it('composes with ios generator', function() { it('composes with ios generator', function() {
@ -218,14 +218,14 @@ describe('React Yeoman Generators', function() {
var appDelegate = 'ios/TestAppIOS/AppDelegate.m'; var appDelegate = 'ios/TestAppIOS/AppDelegate.m';
assert.fileContent(appDelegate, 'moduleName:@"TestAppIOS"'); assert.fileContent(appDelegate, 'moduleName:@"TestAppIOS"');
assert.noFileContent(appDelegate, 'SampleApp'); assert.noFileContent(appDelegate, '<%= name %>');
}); });
it('replaces vars in LaunchScreen.xib', function() { it('replaces vars in LaunchScreen.xib', function() {
var launchScreen = 'ios/TestAppIOS/Base.lproj/LaunchScreen.xib'; var launchScreen = 'ios/TestAppIOS/Base.lproj/LaunchScreen.xib';
assert.fileContent(launchScreen, 'text="TestAppIOS"'); assert.fileContent(launchScreen, 'text="TestAppIOS"');
assert.noFileContent(launchScreen, 'SampleApp'); assert.noFileContent(launchScreen, '<%= name %>');
}); });
it('replaces vars in TestAppIOSTests.m', function() { it('replaces vars in TestAppIOSTests.m', function() {
@ -233,7 +233,7 @@ describe('React Yeoman Generators', function() {
assert.fileContent(tests, '@interface TestAppIOSTests : XCTestCase'); assert.fileContent(tests, '@interface TestAppIOSTests : XCTestCase');
assert.fileContent(tests, '@implementation TestAppIOSTests'); assert.fileContent(tests, '@implementation TestAppIOSTests');
assert.noFileContent(tests, 'SampleApp'); assert.noFileContent(tests, '<%= name %>');
}); });
it('replaces vars in project.pbxproj', function() { it('replaces vars in project.pbxproj', function() {
@ -243,7 +243,7 @@ describe('React Yeoman Generators', function() {
assert.fileContent(pbxproj, 'TestAppIOS.app'); assert.fileContent(pbxproj, 'TestAppIOS.app');
assert.fileContent(pbxproj, 'TestAppIOSTests.xctest'); assert.fileContent(pbxproj, 'TestAppIOSTests.xctest');
assert.noFileContent(pbxproj, 'SampleApp'); assert.noFileContent(pbxproj, '<%= name %>');
}); });
it('replaces vars in xcscheme', function() { it('replaces vars in xcscheme', function() {
@ -254,7 +254,7 @@ describe('React Yeoman Generators', function() {
assert.fileContent(xcscheme, '"TestAppIOSTests.xctest"'); assert.fileContent(xcscheme, '"TestAppIOSTests.xctest"');
assert.fileContent(xcscheme, '"TestAppIOSTests"'); assert.fileContent(xcscheme, '"TestAppIOSTests"');
assert.noFileContent(xcscheme, 'SampleApp'); assert.noFileContent(xcscheme, '<%= name %>');
}); });
}); });
}); });

View File

@ -13,7 +13,7 @@ TEMP=$(mktemp -d /tmp/react-native-XXXXXXXX)
export REACT_PACKAGER_LOG="$TEMP/server.log" export REACT_PACKAGER_LOG="$TEMP/server.log"
# To make sure we actually installed the local version # To make sure we actually installed the local version
# of react-native, we will create a temp file inside SampleApp # of react-native, we will create a temp file inside the template
# and check that it exists after `react-native init` # and check that it exists after `react-native init`
MARKER=$(mktemp $ROOT/local-cli/generator-ios/templates/main/XXXXXXXX) MARKER=$(mktemp $ROOT/local-cli/generator-ios/templates/main/XXXXXXXX)