Skip to content

Commit 3965093

Browse files
committed
show network activity (and a few other platform)
1 parent 7c7b63b commit 3965093

File tree

6 files changed

+62
-8
lines changed

6 files changed

+62
-8
lines changed

App/Platform/Alert.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
var React = require('react-native');
2+
var {
3+
AlertIOS
4+
} = React;
5+
6+
var Alert = {
7+
alert: function(title, message, buttons, type) {
8+
AlertIOS.alert(title, message, buttons, type);
9+
}
10+
};
11+
12+
module.exports = Alert;

App/Platform/Linking.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
var React = require('react-native');
2+
var {
3+
LinkingIOS
4+
} = React;
5+
6+
var Linking = {
7+
openURL: function(url) {
8+
console.log("Linking.openURL: " + url);
9+
LinkingIOS.openURL(url);
10+
}
11+
};
12+
13+
module.exports = Linking;

App/Platform/StatusBar.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
var React = require('react-native');
2+
var {
3+
StatusBarIOS
4+
} = React;
5+
6+
var StatusBar = {
7+
setNetworkActive: function(active) {
8+
StatusBarIOS.setNetworkActivityIndicatorVisible(active);
9+
}
10+
};
11+
12+
module.exports = StatusBar;

App/Root/Launcher.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
var AppConstants = require('../Constants/AppConstants');
22
var Router = require('../Navigation/Router');
33

4+
var StatusBar = require('../Platform/StatusBar');
5+
var Linking = require('../Platform/Linking');
6+
47
var Launcher = {
58
launch: function(root, action) {
69
switch(action.actionType) {
@@ -15,6 +18,19 @@ var Launcher = {
1518
root.setState({routeStack: parsed});
1619
}
1720
break;
21+
case AppConstants.NETWORK_ACTIVITY:
22+
StatusBar.setNetworkActive(action.isActive);
23+
break;
24+
case AppConstants.OPEN_URL:
25+
var url = action.url;
26+
Linking.openURL(url)
27+
break;
28+
case AppConstants.RELOAD_PATH:
29+
// TODO
30+
//root.setState({loading: true}, function() {
31+
// root.setState({loading: false});
32+
//});
33+
break;
1834
default:
1935
break;
2036
}

App/Screens/Dashboard/Dashboard.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ var Dashboard = React.createClass({
2424

2525
var styles = StyleSheet.create({
2626
container: {
27-
27+
flex: 1
2828
}
2929
});
3030

App/Screens/Dashboard/PostListItem.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,12 @@ var Text = require('../../Components/Text');
1212
var PostListItem = React.createClass({
1313
render: function() {
1414
return (
15-
<View style={styles.container}>
16-
<Text style={styles.content}>
17-
{this.props.post.data.content}
18-
</Text>
15+
<View>
16+
<View style={styles.container}>
17+
<Text style={styles.content}>
18+
{this.props.post.data.content}
19+
</Text>
20+
</View>
1921
<View style={cssVar('listFullLine')} />
2022
</View>
2123
);
@@ -27,11 +29,10 @@ var styles = StyleSheet.create({
2729
backgroundColor: 'white',
2830
flex: 1,
2931
flexDirection: 'row',
30-
alignItems: 'center',
31-
padding:20
32+
padding: 25
3233
},
3334
content: {
34-
fontSize: 18,
35+
fontSize: 16,
3536
}
3637
});
3738

0 commit comments

Comments
 (0)