Skip to content

Commit

Permalink
stack in tab navigation
Browse files Browse the repository at this point in the history
  • Loading branch information
flycatki committed Mar 31, 2017
1 parent 2323717 commit 51aee0c
Show file tree
Hide file tree
Showing 15 changed files with 70 additions and 22 deletions.
12 changes: 7 additions & 5 deletions app/components/header/header.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
View,
Text,
StyleSheet,
Dimensions,
TouchableNativeFeedback,
} from 'react-native';

import Icon from 'react-native-vector-icons/Ionicons';
Expand All @@ -25,10 +25,12 @@ export default class Header extends Component {
return (
<View style={styles.container}>
<View style={styles.headerWrapper}>
<View style={styles.locationContainer}>
<Text style={styles.locationText}>大连</Text>
<Icon name="md-arrow-dropdown" size={20} color="#fff" style={{marginLeft: 3}} />
</View>
<TouchableNativeFeedback onPress={() => this.props.navigation.navigate('City')}>
<View style={styles.locationContainer}>
<Text style={styles.locationText}>大连</Text>
<Icon name="md-arrow-dropdown" size={20} color="#fff" style={{marginLeft: 3}} />
</View>
</TouchableNativeFeedback>
<View style={styles.searchContainer}>
<Icon name="ios-search-outline" size={20} color="#666" />
<Text style={styles.searchText}>挑好房,上安居客</Text>
Expand Down
20 changes: 18 additions & 2 deletions app/components/wrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,31 @@ import {
TabNavigator,
} from 'react-navigation';

import HomePage from '../pages/Home';
import HomeTab from '../pages/Home';
import ChatPage from '../pages/Chat';
import RecommendPage from '../pages/Recommend';
import MyPage from '../pages/My';

import Ionicons from 'react-native-vector-icons/Ionicons';

const Wrapper = TabNavigator({
Home: {
screen: HomePage,
screen: HomeTab,
path: '',
navigationOptions: {
tabBar: {
icon: ({ tintColor, focused }) => (
<Ionicons
name={focused ? 'ios-home' : 'ios-home-outline'}
size={26}
style={{ color: tintColor }}
/>
)
},
header: {
visible: false,
},
},
},
Chat: {
screen: ChatPage,
Expand Down
Binary file added app/images/h_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/images/h_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/images/h_3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/images/h_4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/images/h_5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/images/h_6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/images/h_7.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/images/h_8.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/images/hengda1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/images/huafu1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/images/youhui.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions app/pages/City.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/**
* Created by jiangyh on 17-3-30.
*/
import React, { Component } from 'react';

import {
View,
Text
} from 'react-native';

export default class CityPage extends Component {
constructor(props) {
super(props);
}

render () {
return (
<View>
<Text>city page</Text>
</View>
)
}
}
37 changes: 22 additions & 15 deletions app/pages/Home.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,39 +11,46 @@ import {
} from 'react-native';

import Header from '../components/header/header';
import CityPage from '../pages/City';

import Ionicons from 'react-native-vector-icons/Ionicons';
import { StackNavigator, } from 'react-navigation';

export default class HomePage extends Component {
class HomePage extends Component {
constructor(props) {
super(props);
}

static navigationOptions = {
tabBar: {
icon: ({ tintColor, focused }) => (
<Ionicons
name={focused ? 'ios-home' : 'ios-home-outline'}
size={26}
style={{ color: tintColor }}
/>
)
}
};

render() {
return (
<View style={{flex: 1}}>
<ScrollView style={styles.scrollView}>
<View style={styles.container}>
<Header/>
<Header navigation={this.props.navigation}/>
</View>
</ScrollView>
</View>
)
}
};

const HomeTab = StackNavigator({
Home: {
screen: HomePage,
path: '/',
navigationOptions: {
header: {
visible: false,
}
}
},
City: {
path: 'city',
screen: CityPage,
}
});

export default HomeTab;

const styles = StyleSheet.create({
container: {
flex: 1,
Expand Down

0 comments on commit 51aee0c

Please sign in to comment.