diff --git a/Examples/Movies/Movies/AppDelegate.m b/Examples/Movies/Movies/AppDelegate.m index 3cfd1dfa2..4d322023f 100644 --- a/Examples/Movies/Movies/AppDelegate.m +++ b/Examples/Movies/Movies/AppDelegate.m @@ -44,7 +44,7 @@ * Load from pre-bundled file on disk. To re-generate the static bundle, `cd` * to your Xcode project folder in the terminal, and run * - * $ curl 'http://localhost:8081/Examples/Movies/MoviesApp.ios.includeRequire.runModule.bundle' -o main.jsbundle + * $ curl 'http://localhost:8081/Examples/Movies/MoviesApp.includeRequire.runModule.bundle' -o main.jsbundle * * then add the `main.jsbundle` file to your project and uncomment this line: */ diff --git a/Examples/SampleApp/android/app/src/main/java/MainActivity.java b/Examples/SampleApp/android/app/src/main/java/MainActivity.java new file mode 100644 index 000000000..a1b42145d --- /dev/null +++ b/Examples/SampleApp/android/app/src/main/java/MainActivity.java @@ -0,0 +1 @@ +// Temp dummy Java file, shouldn't be exported to github, will be deleted. \ No newline at end of file diff --git a/Examples/UIExplorer/ScrollViewSimpleExample.js b/Examples/UIExplorer/ScrollViewSimpleExample.js index af7d6863b..c9bbe7407 100644 --- a/Examples/UIExplorer/ScrollViewSimpleExample.js +++ b/Examples/UIExplorer/ScrollViewSimpleExample.js @@ -30,7 +30,6 @@ var ScrollViewSimpleExample = React.createClass({ title: '', description: 'Component that enables scrolling through child components.' }, - makeItems: function(nItems: number, styles): Array { var items = []; for (var i = 0; i < nItems; i++) { diff --git a/Examples/UIExplorer/SwitchAndroidExample.android.js b/Examples/UIExplorer/SwitchAndroidExample.android.js index ef58c5a36..6b703bc2f 100644 --- a/Examples/UIExplorer/SwitchAndroidExample.android.js +++ b/Examples/UIExplorer/SwitchAndroidExample.android.js @@ -1,15 +1,5 @@ /** - * The examples provided by Facebook are for non-commercial testing and - * evaluation purposes only. - * - * Facebook reserves all rights not expressly granted. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL - * FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * Copyright 2004-present Facebook. All Rights Reserved. */ 'use strict'; @@ -23,7 +13,7 @@ var UIExplorerPage = require('UIExplorerPage'); var SwitchAndroidExample = React.createClass({ statics: { title: '', - description: 'Standard Android two-state toggle component' + description: 'Standard Android two-state toggle component.' }, getInitialState : function() { diff --git a/Examples/UIExplorer/ToastAndroidExample.android.js b/Examples/UIExplorer/ToastAndroidExample.android.js index 0e9964766..05943cd27 100644 --- a/Examples/UIExplorer/ToastAndroidExample.android.js +++ b/Examples/UIExplorer/ToastAndroidExample.android.js @@ -13,6 +13,7 @@ * * @flow */ + 'use strict'; var React = require('react-native'); @@ -30,7 +31,7 @@ var ToastExample = React.createClass({ statics: { title: 'Toast Example', - description: 'Toast Example', + description: 'Example that demostrates the use of an Android Toast to provide feedback.', }, getInitialState: function() { diff --git a/Examples/UIExplorer/XHRExample.android.js b/Examples/UIExplorer/XHRExample.android.js index b0069794e..92344e72d 100644 --- a/Examples/UIExplorer/XHRExample.android.js +++ b/Examples/UIExplorer/XHRExample.android.js @@ -262,7 +262,8 @@ class FormUploader extends React.Component { exports.framework = 'React'; exports.title = 'XMLHttpRequest'; -exports.description = 'XMLHttpRequest'; +exports.description = 'Example that demostrates upload and download requests ' + + 'using XMLHttpRequest.'; exports.examples = [{ title: 'File Download', render() { diff --git a/Libraries/Components/Touchable/TouchableOpacity.js b/Libraries/Components/Touchable/TouchableOpacity.js index 17b6cbeaf..eddf2ff83 100644 --- a/Libraries/Components/Touchable/TouchableOpacity.js +++ b/Libraries/Components/Touchable/TouchableOpacity.js @@ -45,9 +45,6 @@ type Event = Object; * ); * }, * ``` - * > **NOTE**: TouchableOpacity supports only one child - * > - * > If you wish to have to have several child components, wrap them in a View. */ var TouchableOpacity = React.createClass({ diff --git a/Libraries/Storage/AsyncStorage.ios.js b/Libraries/Storage/AsyncStorage.ios.js index 167a8791b..ed028db4b 100644 --- a/Libraries/Storage/AsyncStorage.ios.js +++ b/Libraries/Storage/AsyncStorage.ios.js @@ -183,7 +183,7 @@ var AsyncStorage = { /** * multiSet and multiMerge take arrays of key-value array pairs that match - * the output of multiGet. Returns a `Promise` object. + * the output of multiGet, e.g. Returns a `Promise` object. * * multiSet([['k1', 'val1'], ['k2', 'val2']], cb); */ diff --git a/Libraries/vendor/react/browser/eventPlugins/PanResponder.js b/Libraries/vendor/react/browser/eventPlugins/PanResponder.js index bf3ed46c1..ed93f88f6 100644 --- a/Libraries/vendor/react/browser/eventPlugins/PanResponder.js +++ b/Libraries/vendor/react/browser/eventPlugins/PanResponder.js @@ -45,7 +45,7 @@ var currentCentroidY = TouchHistoryMath.currentCentroidY; * * ``` * componentWillMount: function() { - * this._panResponder = PanResponder.create({ + * this._panGesture = PanResponder.create({ * // Ask to be the responder: * onStartShouldSetPanResponder: (evt, gestureState) => true, * onStartShouldSetPanResponderCapture: (evt, gestureState) => true, diff --git a/React.podspec b/React.podspec index b3004d015..4b762c858 100644 --- a/React.podspec +++ b/React.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "React" - s.version = "0.11.0-rc" + s.version = "0.8.0" s.summary = "Build high quality mobile apps using React." s.description = <<-DESC React Native apps are built using the React JS diff --git a/ReactAndroid/build.gradle b/ReactAndroid/build.gradle index 97c77d10d..c2d549025 100644 --- a/ReactAndroid/build.gradle +++ b/ReactAndroid/build.gradle @@ -1,246 +1 @@ -// Copyright 2015-present Facebook. All Rights Reserved. - -apply plugin: 'com.android.library' -apply plugin: 'maven' - -apply plugin: 'de.undercouch.download' - -import de.undercouch.gradle.tasks.download.Download -import org.apache.tools.ant.taskdefs.condition.Os -import org.apache.tools.ant.filters.ReplaceTokens - -// We download various C++ open-source dependencies into downloads. -// We then copy both downloaded code and our custom makefiles and headers into third-party-ndk -// After that we build native code from src/main/jni with module path pointing at third-party-ndk - -def downloadsDir = new File("$buildDir/downloads") -def thirdPartyNdkDir = new File("$buildDir/third-party-ndk") - -task createNativeDepsDirectories { - downloadsDir.mkdirs() - thirdPartyNdkDir.mkdirs() -} - -task downloadBoost(dependsOn: createNativeDepsDirectories, type: Download) { - // Use ZIP version as it's faster this way to selectively extract some parts of the archive - src 'https://downloads.sourceforge.net/project/boost/boost/1.57.0/boost_1_57_0.zip' - onlyIfNewer true - overwrite false - dest new File(downloadsDir, 'boost_1_57_0.zip') -} - -task prepareBoost(dependsOn: downloadBoost, type: Copy) { - from zipTree(downloadBoost.dest) - from 'src/main/jni/third-party/boost/Android.mk' - include 'boost_1_57_0/boost/**/*.hpp', 'Android.mk' - into "$thirdPartyNdkDir/boost" -} - -task downloadDoubleConversion(dependsOn: createNativeDepsDirectories, type: Download) { - src 'https://github.com/google/double-conversion/archive/v1.1.1.tar.gz' - onlyIfNewer true - overwrite false - dest new File(downloadsDir, 'double-conversion-1.1.1.tar.gz') -} - -task prepareDoubleConversion(dependsOn: downloadDoubleConversion, type: Copy) { - from tarTree(downloadDoubleConversion.dest) - from 'src/main/jni/third-party/double-conversion/Android.mk' - include 'double-conversion-1.1.1/src/**/*', 'Android.mk' - filesMatching('*/src/**/*', {fname -> fname.path = "double-conversion/${fname.name}"}) - includeEmptyDirs = false - into "$thirdPartyNdkDir/double-conversion" -} - -task downloadFolly(dependsOn: createNativeDepsDirectories, type: Download) { - src 'https://github.com/facebook/folly/archive/v0.50.0.tar.gz' - onlyIfNewer true - overwrite false - dest new File(downloadsDir, 'folly-0.50.0.tar.gz'); -} - -task prepareFolly(dependsOn: downloadFolly, type: Copy) { - from tarTree(downloadFolly.dest) - from 'src/main/jni/third-party/folly/Android.mk' - include 'folly-0.50.0/folly/**/*', 'Android.mk' - eachFile {fname -> fname.path = (fname.path - "folly-0.50.0/")} - includeEmptyDirs = false - into "$thirdPartyNdkDir/folly" -} - -task downloadGlog(dependsOn: createNativeDepsDirectories, type: Download) { - src 'https://github.com/google/glog/archive/v0.3.3.tar.gz' - onlyIfNewer true - overwrite false - dest new File(downloadsDir, 'glog-0.3.3.tar.gz') -} - -// Prepare glog sources to be compiled, this task will perform steps that normally shoudl've been -// executed by automake. This way we can avoid dependencies on make/automake -task prepareGlog(dependsOn: downloadGlog, type: Copy) { - from tarTree(downloadGlog.dest) - from 'src/main/jni/third-party/glog/' - include 'glog-0.3.3/src/**/*', 'Android.mk', 'config.h' - includeEmptyDirs = false - filesMatching('**/*.h.in') { - filter(ReplaceTokens, tokens: [ - ac_cv_have_unistd_h: '1', - ac_cv_have_stdint_h: '1', - ac_cv_have_systypes_h: '1', - ac_cv_have_inttypes_h: '1', - ac_cv_have_libgflags: '0', - ac_google_start_namespace: 'namespace google {', - ac_cv_have_uint16_t: '1', - ac_cv_have_u_int16_t: '1', - ac_cv_have___uint16: '0', - ac_google_end_namespace: '}', - ac_cv_have___builtin_expect: '1', - ac_google_namespace: 'google', - ac_cv___attribute___noinline: '__attribute__ ((noinline))', - ac_cv___attribute___noreturn: '__attribute__ ((noreturn))', - ac_cv___attribute___printf_4_5: '__attribute__((__format__ (__printf__, 4, 5)))' - ]) - it.path = (it.name - '.in') - } - into "$thirdPartyNdkDir/glog" -} - -task downloadJSCHeaders(type: Download) { - def jscAPIBaseURL = 'https://svn.webkit.org/repository/webkit/!svn/bc/174650/trunk/Source/JavaScriptCore/API/' - def jscHeaderFiles = ['JSBase.h', 'JSContextRef.h', 'JSObjectRef.h', 'JSRetainPtr.h', 'JSStringRef.h', 'JSValueRef.h', 'WebKitAvailability.h'] - def output = new File(downloadsDir, 'jsc') - output.mkdirs() - src(jscHeaderFiles.collect { headerName -> "$jscAPIBaseURL$headerName" }) - onlyIfNewer true - overwrite false - dest output -} - -// Create Android.mk library module based on so files from mvn + include headers fetched from webkit.org -task prepareJSC(dependsOn: downloadJSCHeaders) << { - copy { - from zipTree(configurations.compile.fileCollection { dep -> dep.name == 'android-jsc' }.singleFile) - from {downloadJSCHeaders.dest} - from 'src/main/jni/third-party/jsc/Android.mk' - include 'jni/**/*.so', '*.h', 'Android.mk' - filesMatching('*.h', { fname -> fname.path = "JavaScriptCore/${fname.path}"}) - into "$thirdPartyNdkDir/jsc"; - } -} - -def getNdkBuildName() { - if (Os.isFamily(Os.FAMILY_WINDOWS)) { - return "ndk-build.cmd" - } else { - return "ndk-build" - } -} - -def findNdkBuildFullPath() { - // we allow to provide full path to ndk-build tool - if (hasProperty('ndk.command')) { - return property('ndk.command') - } - // or just a path to the containing directory - if (hasProperty('ndk.path')) { - def ndkDir = property('ndk.path') - return new File(ndkDir, getNdkBuildName()).getAbsolutePath() - } - if (System.getenv('ANDROID_NDK') != null) { - def ndkDir = System.getenv('ANDROID_NDK') - return new File(ndkDir, getNdkBuildName()).getAbsolutePath() - } - def ndkDir = android.hasProperty('plugin') ? android.plugin.ndkFolder : - plugins.getPlugin('com.android.library').sdkHandler.getNdkFolder() - if (ndkDir) { - return new File(ndkDir, getNdkBuildName()).getAbsolutePath() - } - return null -} - -def getNdkBuildFullPath() { - def ndkBuildFullPath = findNdkBuildFullPath() - if (ndkBuildFullPath == null || !new File(ndkBuildFullPath).canExecute()) { - throw new GradleScriptException( - "ndk-build binary cannot be found, check if you've set " + - "\$ANDROID_NDK environment variable correctly or if ndk.dir is " + - "setup in local.properties", - null) - } - return ndkBuildFullPath -} - -task buildReactNdkLib(dependsOn: [prepareJSC, prepareBoost, prepareDoubleConversion, prepareFolly, prepareGlog], type: Exec) { - inputs.file('src/main/jni/react') - outputs.dir("$buildDir/react-ndk/all") - commandLine getNdkBuildFullPath(), - 'NDK_PROJECT_PATH=null', - "NDK_APPLICATION_MK=$projectDir/src/main/jni/Application.mk", - 'NDK_OUT=' + temporaryDir, - "NDK_LIBS_OUT=$buildDir/react-ndk/all", - "THIRD_PARTY_NDK_DIR=$buildDir/third-party-ndk", - '-C', file('src/main/jni/react/jni').absolutePath, - '--jobs', Runtime.runtime.availableProcessors() -} - -task cleanReactNdkLib(type: Exec) { - commandLine getNdkBuildFullPath(), - '-C', file('src/main/jni/react/jni').absolutePath, - 'clean' -} - -task packageReactNdkLibs(dependsOn: buildReactNdkLib, type: Copy) { - from "$buildDir/react-ndk/all" - exclude '**/libjsc.so' - into "$buildDir/react-ndk/exported" -} - -android { - compileSdkVersion 22 - buildToolsVersion "22.0.1" - - defaultConfig { - minSdkVersion 16 - targetSdkVersion 22 - versionCode 1 - versionName "1.0" - - ndk { - moduleName "reactnativejni" - } - - buildConfigField 'boolean', 'IS_INTERNAL_BUILD', 'false' - } - - sourceSets.main { - jni.srcDirs = [] - jniLibs.srcDir "$buildDir/react-ndk/exported" - res.srcDirs = ['src/main/res/devsupport', 'src/main/res/shell'] - } - - tasks.withType(JavaCompile) { - compileTask -> compileTask.dependsOn packageReactNdkLibs - } - - clean.dependsOn cleanReactNdkLib - - lintOptions { - abortOnError false - } -} - -dependencies { - compile fileTree(dir: 'libs', include: ['*.jar']) - compile 'com.android.support:appcompat-v7:22.2.0' - compile 'com.facebook.fresco:fresco:0.6.1' - compile 'com.facebook.fresco:imagepipeline-okhttp:0.6.1' - compile 'com.fasterxml.jackson.core:jackson-core:2.2.3' - compile 'com.google.code.findbugs:jsr305:3.0.0' - compile 'com.squareup.okhttp:okhttp:2.4.0' - compile 'com.squareup.okhttp:okhttp-ws:2.4.0' - compile 'com.squareup.okio:okio:1.5.0' - compile 'org.webkit:android-jsc:r174650' -} - -apply from: 'release.gradle' - +// Temp dummy Gradle file, shouldn't be exported to github, will be deleted. \ No newline at end of file diff --git a/ReactAndroid/settings.gradle b/ReactAndroid/settings.gradle new file mode 100644 index 000000000..c2d549025 --- /dev/null +++ b/ReactAndroid/settings.gradle @@ -0,0 +1 @@ +// Temp dummy Gradle file, shouldn't be exported to github, will be deleted. \ No newline at end of file diff --git a/ReactAndroid/src/main/java/Dummy.java b/ReactAndroid/src/main/java/Dummy.java new file mode 100644 index 000000000..a1b42145d --- /dev/null +++ b/ReactAndroid/src/main/java/Dummy.java @@ -0,0 +1 @@ +// Temp dummy Java file, shouldn't be exported to github, will be deleted. \ No newline at end of file diff --git a/jestSupport/env.js b/jestSupport/env.js index 0bb465e0b..160f26766 100644 --- a/jestSupport/env.js +++ b/jestSupport/env.js @@ -8,7 +8,7 @@ */ 'use strict'; -window.__DEV__ = true; -window.Env = {}; - -require.requireActual('./setupEnvPolyfills'); +global.__DEV__ = true; +global.setImmediate = global.setImmediate || function(fn) { + return setTimeout(fn, 0); +}; diff --git a/jestSupport/preprocessor.js b/jestSupport/preprocessor.js new file mode 100644 index 000000000..8198a6824 --- /dev/null +++ b/jestSupport/preprocessor.js @@ -0,0 +1,17 @@ +/** + * Copyright (c) 2015-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + */ +'use strict'; + +var transformer = require('../packager/transformer.js'); + +module.exports = { + process(src, file) { + return transformer.transform(src, file).code; + } +}; diff --git a/package.json b/package.json index 747039a83..1f905bc13 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-native", - "version": "0.11.0-rc", + "version": "0.8.0", "description": "A framework for building native apps using React", "license": "BSD-3-Clause", "repository": { diff --git a/packager/README.md b/packager/README.md index 0b6762baf..c3fae4806 100644 --- a/packager/README.md +++ b/packager/README.md @@ -19,8 +19,8 @@ namely the node module format. We want to even go further, and let you choose your own packager and asset pipeline or even integrate into your existing infrastructure. -React Native users need not understand how the packager works. -However, this documentation might be useful for advanced users and +React Native users need not to understand how the packager work, +however, this documentation might be useful for advanced users and people who want to fix bugs or add features to the packager (patches welcome!). diff --git a/packager/react-packager/src/Bundler/__tests__/Bundler-test.js b/packager/react-packager/src/Bundler/__tests__/Bundler-test.js index 60e21c072..fb205d8ac 100644 --- a/packager/react-packager/src/Bundler/__tests__/Bundler-test.js +++ b/packager/react-packager/src/Bundler/__tests__/Bundler-test.js @@ -13,8 +13,7 @@ jest .dontMock('underscore') .dontMock('../../lib/ModuleTransport') .setMock('uglify-js') - .dontMock('../') - .setMock('chalk', { dim: function(s) { return s; } }); + .dontMock('../'); jest.mock('fs');