Skip to content

Commit 62aaada

Browse files
author
Simar
authored
Revert "Convert the app to Exponent, update to react-native 0.31"
1 parent dc7ac19 commit 62aaada

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+2127
-148
lines changed

.babelrc

-12
This file was deleted.

.gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# OSX
22
#
33
.DS_Store
4-
.exponent/**/*
54

65
# Xcode
76
#

App/Components/RefreshableListView/index.js

+4-6
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,15 @@
2828
* loadMoreText={'Load More...'}/>
2929
*
3030
*/
31-
import React from 'react';
31+
var React = require('react-native');
3232

33-
import {
33+
var {
3434
StyleSheet,
3535
Text,
3636
View,
3737
TouchableOpacity,
3838
Platform
39-
} from 'react-native';
39+
} = React;
4040

4141
var GiftedListView = require('react-native-gifted-listview');
4242

@@ -64,8 +64,6 @@ module.exports = React.createClass({
6464
paginationAllLoadedView={this.renderPaginationAllLoadedView}
6565
paginationWaitingView={this.renderPaginationWaitingView}
6666
headerView={this.renderHeaderView}
67-
enableEmptySections
68-
withSections={false}
6967
PullToRefreshViewAndroidProps={{
7068
colors: ['#F6F6EF'],
7169
progressBackgroundColor: '#FF6600',
@@ -129,4 +127,4 @@ var styles = StyleSheet.create({
129127
fontSize: 15,
130128
color: 'gray',
131129
}
132-
});
130+
});

App/Components/TabBar/customTabBar.android.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
'use strict';
22

3-
import React from 'react';
4-
import {
3+
var React = require('react-native');
4+
var {
55
StyleSheet,
66
Text,
77
View,
88
TouchableOpacity,
99
Animated,
1010
StatusBar,
11-
} from 'react-native';
11+
} = React;
1212

13-
import { FontAwesome as Icon } from '@exponent/vector-icons';
13+
var Icon = require('react-native-vector-icons/FontAwesome');
1414

1515
var styles = StyleSheet.create({
1616
tab: {

App/Components/TabBar/index.js

+46-30
Original file line numberDiff line numberDiff line change
@@ -22,47 +22,63 @@
2222
* }]}
2323
* selectedTab={0}/>
2424
*/
25-
import React from 'react';
25+
var React = require('react-native');
2626

27-
import {
28-
View,
27+
var {
28+
View,
2929
TabBarIOS,
3030
StyleSheet,
3131
Platform
32-
} from 'react-native';
32+
} = React;
3333

34-
import TabNavigator from 'react-native-tab-navigator';
3534
var ScrollableTabView = require('react-native-scrollable-tab-view');
3635
var CustomTabBar = require('./customTabBar.android.js');
3736

38-
import { FontAwesome as Icon } from '@exponent/vector-icons';
37+
var Icon = require('react-native-vector-icons/FontAwesome');
3938

4039
module.exports = React.createClass({
41-
getInitialState: function(){
42-
return {
43-
structure: this.props.structure,
44-
selectedTab: this.props.selectedTab,
45-
iconSize: this.props.iconSize ? this.props.iconSize : 30,
46-
activeTintColor: this.props.activeTintColor ? this.props.activeTintColor : null
47-
};
48-
},
40+
getInitialState: function(){
41+
return {
42+
structure: this.props.structure,
43+
selectedTab: this.props.selectedTab,
44+
iconSize: this.props.iconSize ? this.props.iconSize : 30,
45+
activeTintColor: this.props.activeTintColor ? this.props.activeTintColor : null
46+
};
47+
},
4948
render: function(){
50-
return (
51-
<TabNavigator>
52-
{this.state.structure.map((tabProps, tabIndex) =>
53-
<TabNavigator.Item
54-
selected={tabIndex == this.state.selectedTab}
55-
title={tabProps.title}
56-
key={tabIndex}
57-
selectedTitleStyle={{color: '#ff6600'}}
58-
renderIcon={() => <Icon name={tabProps.iconName} size={25} color="#888" />}
59-
renderSelectedIcon={() => <Icon name={tabProps.iconName} size={25} color="#ff6600" />}
60-
onPress={() => { this.setState({selectedTab: tabIndex}); }}>
61-
{tabProps.renderContent()}
62-
</TabNavigator.Item>
63-
)}
64-
</TabNavigator>
65-
);
49+
if (Platform.OS == 'android'){
50+
return(
51+
<ScrollableTabView renderTabBar={() => <CustomTabBar />}
52+
onChangeTab={(o)=>{}}
53+
tabBarPosition={'bottom'}
54+
initialPage={this.state.selectedTab}>
55+
{this.state.structure.map((tabProps, tabIndex) =>
56+
<View style={{flex:1}}
57+
tabLabel={tabProps.title+'!$#'
58+
+tabProps.iconName+'!$#'
59+
+this.state.iconSize}
60+
key={tabIndex}>
61+
{tabProps.renderContent()}
62+
</View>
63+
)}
64+
</ScrollableTabView>
65+
);
66+
}
67+
return(
68+
<TabBarIOS tintColor={this.state.activeTintColor}
69+
translucent={true}>
70+
{this.state.structure.map((tabProps, tabIndex) =>
71+
<Icon.TabBarItem title={tabProps.title}
72+
iconName={tabProps.iconName}
73+
iconSize={this.state.iconSize}
74+
selected={tabIndex == this.state.selectedTab}
75+
onPress={() => {this.setState({selectedTab: tabIndex});}}
76+
key={tabIndex}>
77+
{tabProps.renderContent()}
78+
</Icon.TabBarItem>
79+
)}
80+
</TabBarIOS>
81+
);
6682
}
6783
});
6884

App/Views/Dashboard/index.android.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
'use strict';
22

3-
import React from 'react';
3+
var React = require('react-native');
44

5-
import {
5+
var {
66
StyleSheet,
77
Text,
88
View,
99
TouchableHighlight
10-
} from 'react-native';
10+
} = React;
1111

1212
var ToolbarAndroid = require('ToolbarAndroid');
1313

@@ -208,4 +208,4 @@ var styles = StyleSheet.create({
208208
height: 1,
209209
backgroundColor: '#CCCCCC'
210210
}
211-
});
211+
});

App/Views/Dashboard/index.ios.js

+12-14
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@
11
'use strict';
22

3-
import React from 'react';
3+
var React = require('react-native');
44

5-
import {
6-
ActionSheetIOS,
5+
var {
76
StyleSheet,
87
Text,
98
View,
10-
StatusBar,
11-
TouchableHighlight,
12-
} from 'react-native';
9+
TouchableHighlight
10+
} = React;
1311

1412
var api = require("../../Network/api.js");
13+
1514
var Post = require("../Post/index.ios.js");
15+
1616
var TabBar = require("../../Components/TabBar");
1717
var RefreshableListView = require("../../Components/RefreshableListView");
18+
var ActivityView = require("react-native-activity-view");
1819

1920
module.exports = React.createClass({
2021
getInitialState: function(){
@@ -25,8 +26,6 @@ module.exports = React.createClass({
2526
},
2627
render: function(){
2728
return(
28-
<View style={{flex: 1}}>
29-
<StatusBar barStyle="default" />
3029
<TabBar structure={[{
3130
title: 'Ask HN',
3231
iconName: 'comment',
@@ -80,7 +79,6 @@ module.exports = React.createClass({
8079
selectedTab={2}
8180
activeTintColor={'#ff8533'}
8281
iconSize={25}/>
83-
</View>
8482
);
8583
},
8684
renderListViewRow: function(row, pushNavBarTitle){
@@ -149,11 +147,10 @@ module.exports = React.createClass({
149147
backButtonTitle: 'Back',
150148
rightButtonTitle: 'Share',
151149
onRightButtonPress: () => {
152-
ActionSheetIOS.showShareActionSheetWithOptions({
153-
subject: row.title,
154-
message: row.title,
155-
url: row.url,
156-
}, () => {}, () => {});
150+
ActivityView.show({
151+
text: row.title,
152+
url: row.url
153+
});
157154
},
158155
});
159156
}
@@ -189,6 +186,7 @@ var styles = StyleSheet.create({
189186
color: 'gray',
190187
},
191188
listview: {
189+
marginBottom:49
192190
},
193191
separator: {
194192
height: 1,

App/Views/Post/Elements/Comment/index.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import React from 'react';
1+
var React = require('react-native');
22

3-
import {
3+
var {
44
StyleSheet,
55
Text,
66
View,
77
TouchableHighlight
8-
} from 'react-native';
8+
} = React;
99

1010
var api = require("../../../../Network/api.js");
1111

@@ -172,4 +172,4 @@ var styles = StyleSheet.create({
172172
color: '#FF6600',
173173
textAlign: 'right',
174174
}
175-
});
175+
});

App/Views/Post/index.android.js

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1-
import React from 'react';
1+
'use strict';
22

3-
import {
3+
var React = require('react-native');
4+
5+
var {
46
StyleSheet,
57
Text,
68
View,
79
TouchableHighlight
8-
} from 'react-native';
10+
} = React;
911

1012
var ToolbarAndroid = require('ToolbarAndroid');
1113

App/Views/Post/index.ios.js

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1-
import React from 'react';
1+
'use strict';
22

3-
import {
3+
var React = require('react-native');
4+
5+
var {
46
StyleSheet,
57
Text,
68
View,
79
TouchableHighlight,
810
WebView
9-
} from 'react-native';
11+
} = React;
1012

1113
var api = require("../../Network/api.js");
1214

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
[**Support me with a Follow**](https://github.com/iSimar/followers)
22

3-
# HackerNews-React-Native
3+
# HackerNews-React-Native
44

55
[Hacker News](https://news.ycombinator.com/) reader for iOS and Android, made with [React-Native](https://github.com/facebook/react-native).
66

7-
## DEMO
7+
##DEMO
88
[![App Store Button](http://imgur.com/y8PTxr9.png "App Store Button")](https://itunes.apple.com/ca/app/hacker-news-reader-react-native/id1067161633?mt=8)
99
[![Play Store Button](http://imgur.com/utWa1co.png "Play Store Button")](https://play.google.com/store/apps/details?id=com.hackernews)
1010

0 commit comments

Comments
 (0)