最近着手开发的一个兼容iOS、Android的TabBar。还在不断开发中!

地址:https://github.com/future-cha...

欢迎fork,欢迎star。 :p

自己捣鼓了个E文的readme,没啥难度凑合可看。

react-native-tabs

React Native platform-independent tabs. Originally forked form https://github.com/aksonov/re...

Why I need to use it?

I'm developing an app which needs to run on both iOS and Android with bottom tabs. Obviously React Native does not provide Android one, and the forked one can not work as I need.

So I develop one based on the forked one.

How it works?

I'm trying to make this tab works just like the React Native TabBarIOS. Similar API will cost you less time to integrate it.

Example

Example makes selected icon color red and change the state of example view. To switch to other views you may use react-native-router-flux component or own navigation controller

How to use

import React from 'react';import {  AppRegistry,  StyleSheet,  Text,  View,  Image} from "react-native";import Tabs from './Lib/TabCore';// import Tabs from './lib/test';// type State = {//   page: string// };export default class Example extends React.Component {  state: {    selectedTab: string  };  constructor(props: any) {    super(props);    this.state = {      selectedTab: 'first'    };  }  render() {    var self = this;    return (       this.setState({ page: el.props.name }) }        pressOpacity={1}>         {            this.setState({selectedTab: 'first'});          }}>                      TAB 1                          {/* Second */}         {            this.setState({selectedTab: 'second'});          }}>                      TAB 2                           {            this.setState({selectedTab: 'third'});          }}>                      TAB 3                           {            this.setState({selectedTab: 'forth'});          }}>                      TAB 4                          {/*                     First         */}          );  }}var styles = StyleSheet.create({  container: {    flex: 1,    justifyContent: 'center',    alignItems: 'center',    backgroundColor: '#F5FCFF',  },  welcome: {    fontSize: 20,    textAlign: 'center',    margin: 10,  },  instructions: {    textAlign: 'center',    color: '#333333',    marginBottom: 5,  },});AppRegistry.registerComponent('Example', () => Example);

更多相关文章

  1. 万字长文带你了解最常用的开源 Squid 代理服务器
  2. 安卓[android] 通过Uri获取File文件
  3. android所有需要的Demo地址
  4. Talking about Android(安卓)process
  5. Service API changes starting with Android(安卓)2.0
  6. Android(安卓)如何动态的控制Toast的显示与隐藏
  7. Android(安卓)Native程序crash的一些定位方法简介
  8. Android(安卓)adb网络连接Offline和 adb断开连接
  9. Android(安卓)ViewDragHelper实现QQ侧滑边栏

随机推荐

  1. android 升级包检测并更新实现
  2. Android(安卓)API 实验记录 (三)
  3. Android中Adapter中edittext,checkbox记住
  4. Android 调用系统相机拍照保存以及调用系
  5. Android中DownLoadManager的使用
  6. 学习笔记----Android的对话框
  7. tabactivty中加入地图
  8. Android 分割线
  9. BlackBerry SIP VOIP softPhone, open so
  10. 分享Android入门学习资料