Skip to content

Commit 693e611

Browse files
author
Pavlo Aksonov
committed
fix bug showed empty screen after js minification
1 parent 4a6f5d3 commit 693e611

File tree

7 files changed

+82
-341
lines changed

7 files changed

+82
-341
lines changed

Example/.idea/workspace.xml

Lines changed: 49 additions & 309 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Example/iOS/main.jsbundle

Lines changed: 7 additions & 7 deletions
Large diffs are not rendered by default.

Example/index.ios.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ var Example = React.createClass({
2323
<Schema name="default" sceneConfig={Animations.FlatFloatFromRight} navBar={NavBar} />
2424
<Schema name="withoutAnimation" navBar={NavBar} />
2525

26-
<Route name="launch" component={Launch} initial={true} hideNavBar={false} title="Launch"/>
26+
<Route name="launch" component={Launch} initial={true} hideNavBar={true} title="Launch"/>
2727
<Route name="register" component={Register} title="Register" />
2828
<Route name="login" component={Login} schema="modal"/>
2929
<Route name="register2" component={Register} schema="withoutAnimation" />
30-
<Route name="login" component={Login} schema="modal"/>
30+
<Route name="error" component={Error} schema="popup"/>
3131
</Router>
3232
);
3333
}

Example/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@
99
"react-native": "^0.9.0",
1010
"react-native-button": "^1.2.1",
1111
"react-native-navbar": "^0.8.0",
12-
"react-native-router-flux": "^0.0.8"
12+
"react-native-router-flux": "^0.1.0"
1313
}
1414
}

index.js

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,26 +9,27 @@ var FetchStore = require('./FetchStore');
99
var Animations = require('./Animations');
1010

1111
// schema class represents schema for routes and it is processed inside Router component
12-
class Schema extends React.Component {
12+
var Schema = React.createClass({
1313
render(){
1414
return null;
1515
}
16-
}
16+
});
1717

1818
// schema class represents fetch call
19-
class API extends React.Component {
19+
var API = React.createClass({
2020
render(){
2121
return null;
2222
}
23-
}
23+
});
2424

2525
// route class processed inside Router component
26-
class Route extends React.Component {
26+
var Route = React.createClass({
2727
render(){
2828
return null;
2929
}
3030

31-
}
31+
});
32+
3233
class Router extends React.Component {
3334
constructor(props){
3435
super(props);
@@ -57,15 +58,15 @@ class Router extends React.Component {
5758
if (route.schema=='popup'){
5859
this.setState({modal: React.createElement(route.component, {data: page.data})});
5960
} else {
60-
console.log("PUSH");
61+
//console.log("PUSH");
6162
this.refs.nav.push(this.getRoute(route, page.data))
6263
}
6364
}
6465
if (page.mode=='pop'){
6566
var num = page.num || 1;
6667
var routes = this.refs.nav.getCurrentRoutes();
67-
console.log("ROUTES LENGTH:" + routes.length);
68-
console.log("POP DATA:"+JSON.stringify(page.data));
68+
//console.log("ROUTES LENGTH:" + routes.length);
69+
//console.log("POP DATA:"+JSON.stringify(page.data));
6970
// pop only existing routes!
7071
if (num < routes.length) {
7172
this.refs.nav.popToRoute(routes[routes.length - 1 - num]);
@@ -88,48 +89,48 @@ class Router extends React.Component {
8889

8990
// iterate schemas
9091
React.Children.forEach(this.props.children, function (child, index){
91-
if (child.type.name == 'Schema') {
92+
if (child.type.displayName == 'Schema') {
9293
var name = child.props.name;
9394
self.schemas[name] = child.props;
9495
}
9596
});
9697

9798
// iterate routes
9899
React.Children.forEach(this.props.children, function (child, index){
99-
if (child.type.name == 'Route') {
100+
if (child.type.displayName == 'Route') {
100101
var name = child.props.name;
101102
self.routes[name] = child.props;
102103
if (child.props.initial || !initial || name==self.props.initial) {
103104
initial = child.props;
104105
self.setState({initialRoute: child.props});
105106
}
106107
if (!(RouterActions[name])) {
107-
RouterActions[name] = function (data) {
108+
RouterActions[name] = alt.createAction(name, function (data) {
108109
if (typeof(data)!='object'){
109110
data={data:data};
110111
}
111112
var args = {name: name, data:data};
112113
RouterActions.push(args);
113-
}
114+
});
114115
}
115116
}
116117
});
117118

118119

119120
// iterate fetches
120121
React.Children.forEach(this.props.children, function (child, index){
121-
if (child.type.name == 'API') {
122+
if (child.type.displayName == 'API') {
122123
var name = child.props.name;
123124
self.apis[name] = child.props;
124125

125126
// generate sugar actions like 'login'
126127
if (!(RouterActions[name])) {
127-
RouterActions[name] = function (data) {
128+
RouterActions[name] = alt.createAction(name, function (data) {
128129
if (typeof(data)!='object'){
129130
data={data:data};
130131
}
131132
FetchActions.fetch(name, data);
132-
}
133+
});
133134
}
134135
}
135136
});

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-router-flux",
3-
"version": "0.0.9",
3+
"version": "0.1.0",
44
"description": "React Native Router using Flux architecture",
55
"main": "index.js",
66
"scripts": {
@@ -27,7 +27,7 @@
2727
"readme": "# react-native-router-flux\nReact Native Router using Flux architecture\n",
2828
"readmeFilename": "README.md",
2929
"gitHead": "ac054cfda0894ba1db6c4901ebdddc83b3b2d083",
30-
"_id": "[email protected].8",
31-
"_shasum": "72baceefed84d1a164408279b611bad7b2ff3b57",
32-
"_from": "react-native-router-flux@>=0.0.8 <0.0.9"
30+
"_id": "[email protected].9",
31+
"_shasum": "285d944d3f3b6059148a0962cd00210d85e3fe76",
32+
"_from": "react-native-router-flux@>=0.0.9 <0.0.10"
3333
}

store.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ class RouterStore {
2222
}
2323

2424
onPush(data){
25-
console.log("Push ("+JSON.stringify(data)+")");
25+
// console.log("Push ("+JSON.stringify(data)+")");
2626
data.mode = 'push';
2727
this.setState(data);
2828
}
2929

3030
onPop(data){
31-
console.log("Pop");
31+
// console.log("Pop");
3232
if (!data){
3333
data = {};
3434
}

0 commit comments

Comments
 (0)