Skip to content
This repository was archived by the owner on Nov 12, 2019. It is now read-only.

Commit 27591a9

Browse files
committed
more page
1 parent 5b9f7fb commit 27591a9

File tree

6 files changed

+73
-25
lines changed

6 files changed

+73
-25
lines changed

js/assets/test.jpg

29.2 KB
Loading

js/components/NavigationBar.js

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -28,23 +28,25 @@ export default class NavigationBar extends Component{
2828
render(){
2929
const {title, leftBtnIcon, leftBtnPress, rightBtnIcon, rightBtnPress, isBackBtnOnLeft} = this.props;
3030
return (
31-
<View style={styles.toolbar}>
32-
<View style={styles.fixedCell}>
33-
{leftBtnIcon ?
34-
<IconButton icon={leftBtnIcon} onPress={leftBtnPress} isBackBtnOnLeft={isBackBtnOnLeft}/>
35-
:
36-
null
37-
}
38-
</View>
39-
<View style={styles.centerCell}>
40-
<Text style={styles.title}>{title}</Text>
41-
</View>
42-
<View style={styles.fixedCell}>
43-
{rightBtnIcon ?
44-
<IconButton icon={rightBtnIcon} onPress={rightBtnPress}/>
45-
:
46-
null
47-
}
31+
<View style={styles.container}>
32+
<View style={styles.toolbar}>
33+
<View style={styles.fixedCell}>
34+
{leftBtnIcon ?
35+
<IconButton icon={leftBtnIcon} onPress={leftBtnPress} isBackBtnOnLeft={isBackBtnOnLeft}/>
36+
:
37+
null
38+
}
39+
</View>
40+
<View style={styles.centerCell}>
41+
<Text style={styles.title}>{title}</Text>
42+
</View>
43+
<View style={styles.fixedCell}>
44+
{rightBtnIcon ?
45+
<IconButton icon={rightBtnIcon} onPress={rightBtnPress}/>
46+
:
47+
null
48+
}
49+
</View>
4850
</View>
4951
</View>
5052
);
@@ -91,14 +93,18 @@ class IconButton extends Component{
9193
}
9294

9395
const styles = StyleSheet.create({
96+
container: { //in order to display the shadow on home tab
97+
height: theme.toolbar.height + px2dp(4),
98+
width: theme.screenWidth
99+
},
94100
toolbar: {
95101
height: theme.toolbar.height,
96102
backgroundColor: theme.toolbar.barColor,
97103
flexDirection: 'row',
98104
paddingTop: Platform.OS === 'android' ? 0 : px2dp(6),
99-
elevation: 8,
105+
elevation: 3,
100106
shadowColor: 'rgb(0,0,0)',
101-
shadowOffset: {height: 5, width: 1},
107+
shadowOffset: {height: 3, width: 1},
102108
shadowOpacity: 0.25,
103109
shadowRadius: 3
104110
},

js/containers/HomeTab/index.js

Lines changed: 45 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,55 @@
44
'use strict';
55

66
import React, {Component} from 'react';
7-
import {Text} from 'react-native';
7+
import {StyleSheet, View, Text, ScrollView, Image} from 'react-native';
8+
import ParallaxScrollView from 'react-native-parallax-scroll-view';
9+
import theme from '../../constants/theme';
10+
import NavigationBar from '../../components/NavigationBar';
811

912
export default class HomeFragment extends Component{
13+
constructor(props){
14+
super(props);
15+
this.state = {
16+
opacity: 1,
17+
18+
};
19+
}
1020

1121
render(){
1222
return(
13-
<Text>dsdsds</Text>
23+
<View style={styles.container}>
24+
<View style={[styles.toolbar, {opacity: this.state.opacity}]}>
25+
<NavigationBar title="今日Gank"/>
26+
</View>
27+
<ScrollView
28+
onScroll={this._onScroll.bind(this)}>
29+
<Image source={require('../../assets/test.jpg')} resizeMode="cover" style={{height: 300, width: theme.screenWidth}}/>
30+
<View style={styles.scrollContents}>
31+
32+
</View>
33+
</ScrollView>
34+
</View>
1435
);
1536
}
16-
}
37+
38+
_onScroll(){
39+
40+
}
41+
42+
}
43+
44+
const styles = StyleSheet.create({
45+
container: {
46+
flex: 1
47+
},
48+
toolbar: {
49+
position: 'absolute',
50+
width: theme.screenWidth,
51+
left: 0,
52+
top: 0,
53+
elevation: 8
54+
},
55+
scrollContents: {
56+
height: theme.screenHeight,
57+
}
58+
});

js/containers/MainPage.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class BottomTabBar extends Component{
2727
constructor(props){
2828
super(props);
2929
this.state = {
30-
selectedTab: 'me'
30+
selectedTab: 'home'
3131
};
3232
this.tabNames = ['首页', '发现', '收藏', '更多'];
3333
}

js/containers/MoreTab/index.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,10 @@ const styles = StyleSheet.create({
5757
},
5858
intro: {
5959
height: 100,
60-
marginTop: px2dp(18),
6160
backgroundColor: '#fff'
6261
},
6362
block: {
64-
marginTop: px2dp(13),
63+
marginTop: px2dp(12),
6564
borderBottomColor: theme.segment.color,
6665
borderBottomWidth: theme.segment.width,
6766
borderTopColor: theme.segment.color,

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"dependencies": {
1010
"react": "15.3.2",
1111
"react-native": "0.37.0",
12+
"react-native-parallax-scroll-view": "^0.19.0",
1213
"react-native-scrollable-tab-view": "^0.6.0",
1314
"react-native-tab-navigator": "^0.3.3",
1415
"react-native-vector-icons": "^3.0.0",

0 commit comments

Comments
 (0)