Skip to content

Commit

Permalink
Compatible with 0.26 + example updated
Browse files Browse the repository at this point in the history
  • Loading branch information
Théo mathieu committed May 25, 2016
1 parent 8b821df commit bb9657b
Show file tree
Hide file tree
Showing 22 changed files with 185 additions and 153 deletions.
6 changes: 6 additions & 0 deletions example/RNApp/.buckconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

[android]
target = Google Inc.:Google APIs:23

[maven_repositories]
central = https://repo1.maven.org/maven2
36 changes: 30 additions & 6 deletions example/RNApp/.flowconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
6 changes: 6 additions & 0 deletions example/RNApp/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,9 @@ local.properties
#
node_modules/
npm-debug.log

# BUCK
buck-out/
\.buckd/
android/app/libs
android/keystores/debug.keystore
66 changes: 66 additions & 0 deletions example/RNApp/android/app/BUCK
Original file line number Diff line number Diff line change
@@ -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',
],
)
11 changes: 9 additions & 2 deletions example/RNApp/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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'
}
4 changes: 0 additions & 4 deletions example/RNApp/android/app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,3 @@
-dontwarn java.nio.file.*
-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
-dontwarn okio.**

# stetho

-dontwarn com.facebook.stetho.**
5 changes: 3 additions & 2 deletions example/RNApp/app/components/button.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React, {
Component,

import React, { Component } from 'react';
import {
StyleSheet,
Text,
View,
Expand Down
32 changes: 24 additions & 8 deletions example/RNApp/app/index.js
Original file line number Diff line number Diff line change
@@ -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() {
Expand All @@ -12,15 +21,22 @@ export default class RNApp extends Component {

render() {
return (
<ExNavigator
initialRoute={Router.getList()}
style={styles.container}
sceneStyle={styles.sceneStyle}
/>
<Router getSceneStyle={()=>styles.sceneStyle}>
<Scene key="root">
<Scene key="routelist" component={RouteList} title="Home"/>

<Scene key="getMeteorConnection" component={Connection} title="Meteor Connection"/>
<Scene key="getAccounts" component={Accounts} title="Accounts"/>
<Scene key="getMeteorListView" component={MeteorListView} title="Meteor List View"/>
<Scene key="getMeteorComplexListView" component={MeteorComplexListView} title="Meteor Complex List View"/>
<Scene key="getEditItem" component={EditItem} title="Edit Item"/>
</Scene>
</Router>
)
}
}


const styles = StyleSheet.create({
container: {
flex: 1
Expand Down
84 changes: 0 additions & 84 deletions example/RNApp/app/router.js

This file was deleted.

3 changes: 2 additions & 1 deletion example/RNApp/app/routes/accounts.js
Original file line number Diff line number Diff line change
@@ -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';

Expand Down
6 changes: 4 additions & 2 deletions example/RNApp/app/routes/connection.js
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -22,7 +24,7 @@ class Connection extends Component {

render() {
const { status } = this.data;

return (
<View style={styles.container}>
<Text style={styles.text}>
Expand Down
3 changes: 2 additions & 1 deletion example/RNApp/app/routes/editItem.js
Original file line number Diff line number Diff line change
@@ -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';

Expand Down
7 changes: 4 additions & 3 deletions example/RNApp/app/routes/meteorComplexListView.js
Original file line number Diff line number Diff line change
@@ -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';

Expand Down Expand Up @@ -32,8 +33,8 @@ class MeteorComplexListViewComponent extends Component {
</View>
)
}


return (
<View style={styles.container}>
<MeteorComplexListView
Expand Down
5 changes: 3 additions & 2 deletions example/RNApp/app/routes/meteorListView.js
Original file line number Diff line number Diff line change
@@ -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, MeteorListView } from 'react-native-meteor';
import Button from '../components/button';

Expand Down Expand Up @@ -31,7 +32,7 @@ class MeteorListViewComponent extends Component {
</View>
)
}

return (
<View style={styles.container}>
<View style={styles.buttonContainer}>
Expand Down
Loading

0 comments on commit bb9657b

Please sign in to comment.