From bb9657be0fc8b1650ef6b1dcc6ea4c97669e5039 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?The=CC=81o=20mathieu?= Date: Wed, 25 May 2016 12:50:07 -0400 Subject: [PATCH] Compatible with 0.26 + example updated --- example/RNApp/.buckconfig | 6 ++ example/RNApp/.flowconfig | 36 ++++++-- example/RNApp/.gitignore | 6 ++ example/RNApp/android/app/BUCK | 66 +++++++++++++++ example/RNApp/android/app/build.gradle | 11 ++- example/RNApp/android/app/proguard-rules.pro | 4 - example/RNApp/app/components/button.js | 5 +- example/RNApp/app/index.js | 32 +++++-- example/RNApp/app/router.js | 84 ------------------- example/RNApp/app/routes/accounts.js | 3 +- example/RNApp/app/routes/connection.js | 6 +- example/RNApp/app/routes/editItem.js | 3 +- .../RNApp/app/routes/meteorComplexListView.js | 7 +- example/RNApp/app/routes/meteorListView.js | 5 +- example/RNApp/app/routes/routeList.js | 9 +- .../RNApp/ios/RNApp.xcodeproj/project.pbxproj | 18 ++-- example/RNApp/ios/RNAppTests/RNAppTests.m | 2 +- example/RNApp/package.json | 9 +- package.json | 2 +- .../FSCollectionImagesPreloader.js | 9 +- src/components/ComplexListView.js | 7 +- src/components/ListView.js | 8 +- 22 files changed, 185 insertions(+), 153 deletions(-) create mode 100644 example/RNApp/.buckconfig create mode 100644 example/RNApp/android/app/BUCK delete mode 100644 example/RNApp/app/router.js diff --git a/example/RNApp/.buckconfig b/example/RNApp/.buckconfig new file mode 100644 index 0000000..934256c --- /dev/null +++ b/example/RNApp/.buckconfig @@ -0,0 +1,6 @@ + +[android] + target = Google Inc.:Google APIs:23 + +[maven_repositories] + central = https://repo1.maven.org/maven2 diff --git a/example/RNApp/.flowconfig b/example/RNApp/.flowconfig index fd62e40..8e838d9 100644 --- a/example/RNApp/.flowconfig +++ b/example/RNApp/.flowconfig @@ -15,8 +15,6 @@ # Ignore react and fbjs where there are overlaps, but don't ignore # anything that react-native relies on .*/node_modules/fbjs/lib/Map.js -.*/node_modules/fbjs/lib/fetch.js -.*/node_modules/fbjs/lib/ExecutionEnvironment.js .*/node_modules/fbjs/lib/ErrorUtils.js # Flow has a built-in definition for the 'react' module which we prefer to use @@ -42,10 +40,36 @@ # Ignore Website .*/website/.* +# Ignore generators +.*/local-cli/generator.* + +# Ignore BUCK generated folders +.*\.buckd/ + +.*/node_modules/is-my-json-valid/test/.*\.json +.*/node_modules/iconv-lite/encodings/tables/.*\.json +.*/node_modules/y18n/test/.*\.json +.*/node_modules/spdx-license-ids/spdx-license-ids.json +.*/node_modules/spdx-exceptions/index.json +.*/node_modules/resolve/test/subdirs/node_modules/a/b/c/x.json +.*/node_modules/resolve/lib/core.json +.*/node_modules/jsonparse/samplejson/.*\.json +.*/node_modules/json5/test/.*\.json +.*/node_modules/ua-parser-js/test/.*\.json +.*/node_modules/builtin-modules/builtin-modules.json +.*/node_modules/binary-extensions/binary-extensions.json +.*/node_modules/url-regex/tlds.json +.*/node_modules/joi/.*\.json +.*/node_modules/isemail/.*\.json +.*/node_modules/tr46/.*\.json + + [include] [libs] node_modules/react-native/Libraries/react-native/react-native-interface.js +node_modules/react-native/flow +flow/ [options] module.system=haste @@ -56,15 +80,15 @@ esproposal.class_instance_fields=enable munge_underscores=true module.name_mapper='^image![a-zA-Z0-9$_-]+$' -> 'GlobalImageStub' -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\)$' -> 'RelativeImageStub' +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' suppress_type=$FlowIssue suppress_type=$FlowFixMe suppress_type=$FixMe -suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(2[0-1]\\|1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\) -suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(2[0-1]\\|1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+ +suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(2[0-4]\\|1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\) +suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(2[0-4]\\|1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+ suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy [version] -0.21.0 +0.24.0 diff --git a/example/RNApp/.gitignore b/example/RNApp/.gitignore index 94fc867..42c9490 100644 --- a/example/RNApp/.gitignore +++ b/example/RNApp/.gitignore @@ -32,3 +32,9 @@ local.properties # node_modules/ npm-debug.log + +# BUCK +buck-out/ +\.buckd/ +android/app/libs +android/keystores/debug.keystore diff --git a/example/RNApp/android/app/BUCK b/example/RNApp/android/app/BUCK new file mode 100644 index 0000000..fe45609 --- /dev/null +++ b/example/RNApp/android/app/BUCK @@ -0,0 +1,66 @@ +import re + +# To learn about Buck see [Docs](https://buckbuild.com/). +# To run your application with Buck: +# - install Buck +# - `npm start` - to start the packager +# - `cd android` +# - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US` +# - `./gradlew :app:copyDownloadableDepsToLibs` - make all Gradle compile dependencies available to Buck +# - `buck install -r android/app` - compile, install and run application +# + +lib_deps = [] +for jarfile in glob(['libs/*.jar']): + name = 'jars__' + re.sub(r'^.*/([^/]+)\.jar$', r'\1', jarfile) + lib_deps.append(':' + name) + prebuilt_jar( + name = name, + binary_jar = jarfile, + ) + +for aarfile in glob(['libs/*.aar']): + name = 'aars__' + re.sub(r'^.*/([^/]+)\.aar$', r'\1', aarfile) + lib_deps.append(':' + name) + android_prebuilt_aar( + name = name, + aar = aarfile, + ) + +android_library( + name = 'all-libs', + exported_deps = lib_deps +) + +android_library( + name = 'app-code', + srcs = glob([ + 'src/main/java/**/*.java', + ]), + deps = [ + ':all-libs', + ':build_config', + ':res', + ], +) + +android_build_config( + name = 'build_config', + package = 'com.rnapp', +) + +android_resource( + name = 'res', + res = 'src/main/res', + package = 'com.rnapp', +) + +android_binary( + name = 'app', + package_type = 'debug', + manifest = 'src/main/AndroidManifest.xml', + keystore = '//android/keystores:debug', + deps = [ + ':app-code', + ], +) diff --git a/example/RNApp/android/app/build.gradle b/example/RNApp/android/app/build.gradle index 1389ff4..a9ec133 100644 --- a/example/RNApp/android/app/build.gradle +++ b/example/RNApp/android/app/build.gradle @@ -9,7 +9,7 @@ import com.android.build.OutputFile * cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the * bundle directly from the development server. Below you can see all the possible configurations * and their defaults. If you decide to add a configuration block, make sure to add it before the - * `apply from: "react.gradle"` line. + * `apply from: "../../node_modules/react-native/react.gradle"` line. * * project.ext.react = [ * // the name of the generated asset file containing your JS bundle @@ -59,7 +59,7 @@ import com.android.build.OutputFile * ] */ -apply from: "react.gradle" +apply from: "../../node_modules/react-native/react.gradle" /** * Set this to true to create two separate APKs instead of one: @@ -124,3 +124,10 @@ dependencies { compile "com.android.support:appcompat-v7:23.0.1" compile "com.facebook.react:react-native:+" // From node_modules } + +// Run this once to be able to run the application with BUCK +// puts all compile dependencies into folder libs for BUCK to use +task copyDownloadableDepsToLibs(type: Copy) { + from configurations.compile + into 'libs' +} diff --git a/example/RNApp/android/app/proguard-rules.pro b/example/RNApp/android/app/proguard-rules.pro index 7d72e46..347a13c 100644 --- a/example/RNApp/android/app/proguard-rules.pro +++ b/example/RNApp/android/app/proguard-rules.pro @@ -61,7 +61,3 @@ -dontwarn java.nio.file.* -dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement -dontwarn okio.** - -# stetho - --dontwarn com.facebook.stetho.** diff --git a/example/RNApp/app/components/button.js b/example/RNApp/app/components/button.js index c9335c0..5e28cac 100644 --- a/example/RNApp/app/components/button.js +++ b/example/RNApp/app/components/button.js @@ -1,5 +1,6 @@ -import React, { - Component, + +import React, { Component } from 'react'; +import { StyleSheet, Text, View, diff --git a/example/RNApp/app/index.js b/example/RNApp/app/index.js index 7dee95f..b64ee12 100644 --- a/example/RNApp/app/index.js +++ b/example/RNApp/app/index.js @@ -1,9 +1,18 @@ -import React, { Component, StyleSheet } from 'react-native'; +import React, { Component } from 'react'; +import { StyleSheet } from 'react-native'; import Meteor, { connectMeteor } from 'react-native-meteor'; -import ExNavigator from '@exponent/react-native-navigator'; -import Router from './router'; +import {Scene, Router} from 'react-native-router-flux'; + +//import Router from './router'; import connect from './connect'; +import RouteList from './routes/routeList'; +import Connection from './routes/connection'; +import Accounts from './routes/accounts'; +import MeteorListView from './routes/meteorListView'; +import MeteorComplexListView from './routes/meteorComplexListView'; +import EditItem from './routes/editItem'; + @connectMeteor export default class RNApp extends Component { componentWillMount() { @@ -12,15 +21,22 @@ export default class RNApp extends Component { render() { return ( - + styles.sceneStyle}> + + + + + + + + + + ) } } + const styles = StyleSheet.create({ container: { flex: 1 diff --git a/example/RNApp/app/router.js b/example/RNApp/app/router.js deleted file mode 100644 index 0085b62..0000000 --- a/example/RNApp/app/router.js +++ /dev/null @@ -1,84 +0,0 @@ -import React from 'react-native'; - -import RouteList from './routes/routeList'; -import Connection from './routes/connection'; -import Accounts from './routes/accounts'; -import MeteorListView from './routes/meteorListView'; -import MeteorComplexListView from './routes/meteorComplexListView'; -import EditItem from './routes/editItem'; - -const Router = { - getList() { - return { - renderScene(nav) { - return - }, - - getTitle() { - return 'Home'; - } - } - }, - - getMeteorConnection() { - return { - renderScene(nav) { - return - }, - - getTitle() { - return 'Meteor Connection'; - } - } - }, - - getAccounts() { - return { - renderScene(nav) { - return - }, - - getTitle() { - return 'Accounts'; - } - } - }, - - getMeteorListView() { - return { - renderScene(nav) { - return - }, - - getTitle() { - return 'Meteor List View'; - } - } - }, - - getMeteorComplexListView() { - return { - renderScene(nav) { - return ; - }, - - getTitle() { - return 'Meteor Complex List View'; - } - } - }, - - getEditItem() { - return { - renderScene(nav) { - return ; - }, - - getTitle() { - return 'Edit Item'; - } - } - } -}; - -export default Router; diff --git a/example/RNApp/app/routes/accounts.js b/example/RNApp/app/routes/accounts.js index db58269..2bc9271 100644 --- a/example/RNApp/app/routes/accounts.js +++ b/example/RNApp/app/routes/accounts.js @@ -1,4 +1,5 @@ -import React, { View, Text, Component, StyleSheet, TextInput, Dimensions } from 'react-native'; +import React, { Component } from 'react'; +import { View, Text, StyleSheet, TextInput, Dimensions } from 'react-native'; import Meteor, { connectMeteor, Accounts } from 'react-native-meteor'; import Button from '../components/button'; diff --git a/example/RNApp/app/routes/connection.js b/example/RNApp/app/routes/connection.js index fec912c..63a8128 100644 --- a/example/RNApp/app/routes/connection.js +++ b/example/RNApp/app/routes/connection.js @@ -1,4 +1,6 @@ -import React, { View, Text, Component, StyleSheet } from 'react-native'; + +import React, { Component } from 'react'; +import { View, Text, StyleSheet } from 'react-native'; import Meteor, { connectMeteor } from 'react-native-meteor'; import Button from '../components/button'; @@ -22,7 +24,7 @@ class Connection extends Component { render() { const { status } = this.data; - + return ( diff --git a/example/RNApp/app/routes/editItem.js b/example/RNApp/app/routes/editItem.js index 5e9020b..8caa707 100644 --- a/example/RNApp/app/routes/editItem.js +++ b/example/RNApp/app/routes/editItem.js @@ -1,4 +1,5 @@ -import React, { View, Text, Component, StyleSheet, TextInput, Dimensions } from 'react-native'; +import React, { Component } from 'react'; +import { View, Text, StyleSheet, TextInput, Dimensions } from 'react-native'; import Meteor, { connectMeteor } from 'react-native-meteor'; import Button from '../components/button'; diff --git a/example/RNApp/app/routes/meteorComplexListView.js b/example/RNApp/app/routes/meteorComplexListView.js index d672935..ab715ed 100644 --- a/example/RNApp/app/routes/meteorComplexListView.js +++ b/example/RNApp/app/routes/meteorComplexListView.js @@ -1,4 +1,5 @@ -import React, { View, Text, Component, StyleSheet, TouchableOpacity } from 'react-native'; +import React, { Component } from 'react'; +import { View, Text, StyleSheet, TouchableOpacity } from 'react-native'; import Meteor, { connectMeteor, MeteorComplexListView } from 'react-native-meteor'; import Button from '../components/button'; @@ -32,8 +33,8 @@ class MeteorComplexListViewComponent extends Component { ) } - - + + return ( ) } - + return ( diff --git a/example/RNApp/app/routes/routeList.js b/example/RNApp/app/routes/routeList.js index 21dbe08..279577c 100644 --- a/example/RNApp/app/routes/routeList.js +++ b/example/RNApp/app/routes/routeList.js @@ -1,5 +1,7 @@ -import React, { View, Text, Component, ListView, StyleSheet, TouchableOpacity } from 'react-native'; -import Router from '../router'; + +import React, { Component } from 'react'; +import { View, Text, ListView, StyleSheet, TouchableOpacity } from 'react-native'; +import { Actions } from 'react-native-router-flux'; const ROUTE_LIST = [ { name: 'Meteor Connection', route: 'getMeteorConnection' }, @@ -20,8 +22,7 @@ class RouteList extends Component { } onPress(row) { - const { navigator } = this.props; - navigator.push(Router[row.route]()); + Actions[row.route](); } renderRow(row) { diff --git a/example/RNApp/ios/RNApp.xcodeproj/project.pbxproj b/example/RNApp/ios/RNApp.xcodeproj/project.pbxproj index 12ac523..c257cef 100644 --- a/example/RNApp/ios/RNApp.xcodeproj/project.pbxproj +++ b/example/RNApp/ios/RNApp.xcodeproj/project.pbxproj @@ -575,10 +575,6 @@ isa = XCBuildConfiguration; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; - FRAMEWORK_SEARCH_PATHS = ( - "$(SDKROOT)/Developer/Library/Frameworks", - "$(inherited)", - ); GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", "$(inherited)", @@ -596,10 +592,6 @@ buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; COPY_PHASE_STRIP = NO; - FRAMEWORK_SEARCH_PATHS = ( - "$(SDKROOT)/Developer/Library/Frameworks", - "$(inherited)", - ); INFOPLIST_FILE = RNAppTests/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 8.2; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; @@ -620,7 +612,10 @@ ); INFOPLIST_FILE = "RNApp/Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - OTHER_LDFLAGS = "-ObjC"; + OTHER_LDFLAGS = ( + "-ObjC", + "-lc++", + ); PRODUCT_NAME = RNApp; }; name = Debug; @@ -636,7 +631,10 @@ ); INFOPLIST_FILE = "RNApp/Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - OTHER_LDFLAGS = "-ObjC"; + OTHER_LDFLAGS = ( + "-ObjC", + "-lc++", + ); PRODUCT_NAME = RNApp; }; name = Release; diff --git a/example/RNApp/ios/RNAppTests/RNAppTests.m b/example/RNApp/ios/RNAppTests/RNAppTests.m index e9aab55..6020eea 100644 --- a/example/RNApp/ios/RNAppTests/RNAppTests.m +++ b/example/RNApp/ios/RNAppTests/RNAppTests.m @@ -13,7 +13,7 @@ #import "RCTLog.h" #import "RCTRootView.h" -#define TIMEOUT_SECONDS 240 +#define TIMEOUT_SECONDS 600 #define TEXT_TO_LOOK_FOR @"Welcome to React Native!" @interface RNAppTests : XCTestCase diff --git a/example/RNApp/package.json b/example/RNApp/package.json index 67ff268..4339cf4 100644 --- a/example/RNApp/package.json +++ b/example/RNApp/package.json @@ -7,14 +7,15 @@ "ios": "open ios/RNApp.xcodeproj" }, "dependencies": { - "@exponent/react-native-navigator": "^0.4.2", - "react": "^0.14.7", - "react-native": "^0.22.0", + "react": "15.0.2", + "react-native": "^0.26.2", "react-native-meteor": "file:../..", + "react-native-router-flux": "^3.26.3", "react-native-tabs": "^1.0.5" }, "devDependencies": { "babel-plugin-transform-decorators-legacy": "^1.3.4", - "babel-preset-react-native": "^1.5.3" + "babel-preset-react-native": "^1.5.3", + "rnpm-plugin-upgrade": "^0.26.0" } } diff --git a/package.json b/package.json index 2b18349..9e14f6f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-native-meteor", - "version": "1.0.0-rc3", + "version": "1.0.0-rc4", "description": "Full Meteor Client for React Native", "main": "src/Meteor.js", "scripts": { diff --git a/src/CollectionFS/FSCollectionImagesPreloader.js b/src/CollectionFS/FSCollectionImagesPreloader.js index fb4e0ff..741eec1 100644 --- a/src/CollectionFS/FSCollectionImagesPreloader.js +++ b/src/CollectionFS/FSCollectionImagesPreloader.js @@ -1,12 +1,7 @@ 'use strict'; -import React, { - Component, - PropTypes, - View, - Image, - StyleSheet -} from 'react-native'; +import React, { Component, PropTypes } from 'react'; +import { View, Image, StyleSheet } from 'react-native'; import Data from '../Data'; diff --git a/src/components/ComplexListView.js b/src/components/ComplexListView.js index 1a88112..d615538 100644 --- a/src/components/ComplexListView.js +++ b/src/components/ComplexListView.js @@ -1,10 +1,7 @@ 'use strict'; -import React, { - Component, - PropTypes, - ListView -} from 'react-native'; +import React, { Component, PropTypes } from 'react'; +import { ListView } from 'react-native'; import Data from '../Data'; diff --git a/src/components/ListView.js b/src/components/ListView.js index 12c2bb0..60b2cec 100644 --- a/src/components/ListView.js +++ b/src/components/ListView.js @@ -1,11 +1,7 @@ 'use strict'; -import React, { - Component, - PropTypes, - ListView -} from 'react-native'; - +import React, { Component, PropTypes } from 'react'; +import { ListView } from 'react-native'; import Data from '../Data';