diff --git a/Example/.idea/workspace.xml b/Example/.idea/workspace.xml index 1be3499ae..993eaae5e 100644 --- a/Example/.idea/workspace.xml +++ b/Example/.idea/workspace.xml @@ -2,11 +2,6 @@ - - - - - @@ -38,20 +33,10 @@ - - - - - - - - - - - + @@ -71,7 +56,7 @@ - + @@ -83,7 +68,9 @@ - + + + @@ -108,10 +95,20 @@ - + + + + + + + + + + + - + @@ -121,7 +118,7 @@ - + @@ -200,8 +197,6 @@ - - @@ -220,42 +215,6 @@ - - - - - - - - - - - - - - - - - - - - + + @@ -366,7 +327,7 @@ - + @@ -374,7 +335,7 @@ - + @@ -634,14 +595,6 @@ - - - - - - - - @@ -743,7 +696,7 @@ - + @@ -751,7 +704,7 @@ - + @@ -759,7 +712,7 @@ - + @@ -769,7 +722,9 @@ - + + + @@ -783,11 +738,19 @@ - + + + + + + + + + \ No newline at end of file diff --git a/actions.js b/actions.js index 3d2fda60b..5b572f824 100644 --- a/actions.js +++ b/actions.js @@ -1,9 +1,39 @@ 'use strict'; var alt = require('./alt'); +function filterParam(data){ + if (!data){ + return; + } + var proto = (data||{}).constructor.name; + // avoid passing React Native parameters + if (proto != 'Object'){ + data = {}; + } + if (data.data){ + data.data = filterParam(data.data); + } + return data; +} + class Actions { - constructor(){ - this.generateActions('push', 'pop','dismiss','reset','init','custom'); + push(data){ + this.dispatch(filterParam(data)); + } + pop(data){ + this.dispatch(filterParam(data)); + } + dismiss(data){ + this.dispatch(filterParam(data)); + } + reset(data){ + this.dispatch(filterParam(data)); + } + init(data){ + this.dispatch(filterParam(data)); + } + custom(data){ + this.dispatch(filterParam(data)); } } diff --git a/index.js b/index.js index 37c485f26..954539771 100644 --- a/index.js +++ b/index.js @@ -78,7 +78,9 @@ class Router extends React.Component { //console.log("Added action: " + name); if (!(RouterActions[name])) { RouterActions[name] = alt.createAction(name, function(data){ - RouterActions.custom({name, props: child.props, data:data})}); + var props = self.extend({}, self.props); + props = self.extend(props, child.props); + RouterActions.custom({name, props, data})}); } } }); @@ -190,11 +192,6 @@ class Router extends React.Component { } getRoute(route, data) { - var proto = (data||{}).constructor.name; - // avoid passing React Native parameters - if (proto != 'Object'){ - data = {}; - } var schema = this.schemas[route.schema || 'default'] || {}; var sceneConfig = route.sceneConfig || schema.sceneConfig || Animations.None; var NavBar = route.navBar || schema.navBar; diff --git a/package.json b/package.json index 48ee02958..07fde45d9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-native-router-flux", - "version": "0.2.1", + "version": "0.2.2", "description": "React Native Router using Flux architecture", "main": "index.js", "scripts": { @@ -24,9 +24,9 @@ "alt": "^0.17.1" }, "gitHead": "ac054cfda0894ba1db6c4901ebdddc83b3b2d083", - "_id": "react-native-router-flux@0.1.8", - "_shasum": "0e4671550c307ce7ea940eb4ff624e217bcc5225", - "_from": "react-native-router-flux@0.1.8", + "_id": "react-native-router-flux@0.2.1", + "_shasum": "6b9eff8bfc2ec266b09822b24da78b61c705274e", + "_from": "react-native-router-flux@>=0.2.0 <0.3.0", "_npmVersion": "2.13.2", "_nodeVersion": "2.5.0", "_npmUser": {