1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105
| import React, { Component } from 'react'; import { StyleSheet, Text, View, TouchableOpacity, Image } from 'react-native'; import FirstPage from './FirstPage'; import SecondPage from './SecondPage'; import {connect} from 'react-redux'; import Snnn from './Snnn' import { StackNavigator, addNavigationHelpers, TabNavigator, } from 'react-navigation';
import {addListener} from '../store'; class NavigatorPages extends Component{ constructor(props){ super(props); } render(){ return( <SimpleAppNavigator navigation={addNavigationHelpers({ dispatch: this.props.dispatch, state: this.props.nav, addListener })}
/> ) } }
const Tab = TabNavigator({ page1: { screen: FirstPage, navigationOptions: ({ navigation }) => ({ tabBarLabel: '苹果233', tabBarIcon: ({ focused, tintColor }) => ( <Image source={focused ? require('../../image/one_selected.png') : require('../../image/one.png')} style={{ width: 25, height: 25 }} /> ) }), }, page2: { screen: SecondPage, navigationOptions: ({ navigation }) => ({ tabBarLabel: '安卓', tabBarIcon: ({ focused, tintColor }) => ( <Image source={focused ? require('../../image/two_selected.png') : require('../../image/two.png') } style={{ width: 25, height: 25 }} /> ) }), },
},{ initialRouteName: 'page1', swipeEnabled: true, animationEnabled: true, tabBarPosition:'bottom', lazy: false, tabBarOptions: { showIcon: true, activeTintColor: '#979797', inactiveTintColor: '#979797', style: { backgroundColor: '#ffffff' }, } });
export const SimpleAppNavigator = StackNavigator({ Tab: { screen: Tab, }, page1 : { screen: FirstPage, }, page2 : { screen: SecondPage }, Snnn : { screen: Snnn
} });
const mapStateToProps = (store)=>({ nav : store.TabNavigatorReducer, });
export default connect(mapStateToProps)(NavigatorPages);
|