react-native-router-flux 下部導航

來源:互聯網
上載者:User

標籤:initial   create   react   bsp   this   ima   duration   home   gis   

github url:https://github.com/aksonov/react-native-router-flux

API: https://github.com/aksonov/react-native-router-flux/blob/master/docs/API_CONFIGURATION.md

react-native-router-flux使用樣本:

/** * Sample React Native App * https://github.com/facebook/react-native */‘use strict‘;import {    AppRegistry,    View,    Text,    StyleSheet,    Image,} from "react-native";import React, { Component } from "react";import {  Navigation,  Scene,  Router} from ‘react-native-router-flux‘;import Index from ‘./page/index‘;import Me from ‘./page/me‘;import Info from ‘./page/info‘;import Type from ‘./page/type‘;import Car from ‘./page/shopCar‘;import Register from ‘./page/register‘;import Userinfo from ‘./page/userinfo‘;import Icon from ‘react-native-vector-icons/FontAwesome‘;class TabBar extends Component{  constructor(props){    super(props);    this.data={      index:{        title:"首頁",        icon:"home",      },      type:{        title:"分類",        icon:"th-large",      },      car:{        title:"購物車",        icon:"shopping-cart",      },      me:{        title:"我的",        icon:"user",      }    }  }  render(){    let param=this.data[this.props.sceneKey];    let activeStyle=this.props.selected?{color:"#3399FF"}:{};    return <View>      <Icon name={param.icon} color={activeStyle.color} size={25}/>      <Text style={[activeStyle,styles.tabbarItem]}>{param.title}</Text>    </View>  }}class App extends Component {    constructor(props){      super(props);    }    render() {      const iconSize=30;      return (        <Router>
      {/*下部導航開始*/} <Scene key="tabbar" name="tabbar" duration={0} tabs={true} style={styles.tabbarContainer} initial={true}> <Scene key="index" duration={0} component={Index} title="首頁" icon={TabBar} /> <Scene key="type" duration={0} component={Type} title="分類" icon={TabBar} /> <Scene key="car" duration={0} component={Car} title="購物車" icon={TabBar} /> <Scene key="me" duration={0} component={Me} hideNavBar={true} title="我的" icon={TabBar} /> </Scene>
      {/*下部導航結束*/} <Scene key="info" duration={0} hideNavBar={true} component={Info} title="詳情"></Scene> <Scene key="register" duration={0} hideNavBar={true} component={Register} title="註冊"></Scene> <Scene key="userinfo" duration={0} component={Userinfo} title="使用者詳情"></Scene> </Router> ) }}var styles=StyleSheet.create({ tabbarContainer:{ flex:1, backgroundColor:"#f6f6f6", }, tabbarItem:{ alignItems:"center", justifyContent:"center", textAlign:"center", marginLeft:-3 }})AppRegistry.registerComponent(‘reactApp‘, () => App);

 

react-native-router-flux 下部導航

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.