Skip to content

Commit

Permalink
fix to work with latest RN
Browse files Browse the repository at this point in the history
  • Loading branch information
Pavlo Aksonov authored and Pavlo Aksonov committed Sep 29, 2015
1 parent 5083a10 commit 25545cd
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 86 deletions.
111 changes: 37 additions & 74 deletions Example/.idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 32 additions & 2 deletions actions.js
Original file line number Diff line number Diff line change
@@ -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));
}
}

Expand Down
9 changes: 3 additions & 6 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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})});
}
}
});
Expand Down Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand All @@ -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": {
Expand Down

0 comments on commit 25545cd

Please sign in to comment.