yarn add react-navigation //安装路由插件
//在util包下新建文件ToTabNav.js
import React, { Component } from "react";
import { createTabNavigator } from "react-navigation";
import List from "../util/List"; //加上list引用
import { createTabNavigator } from "react-navigation"; //加引用
//切换条组件
const Good = () => {
return <List tab="good" />;
};
const Share = () => {
return <List tab="share" />;
};
//切换条修改标题
const ToTabNav = createTabNavigator({
Good: {
screen: Good,
navigationOptions: {
title: "精华"
}
},
Share: {
screen: Share,
navigationOptions: {
title: "分享"
}
}
}
});
export default ToTabNav;
//新建文件夹 建文件List rnc修改名字
//在ToTabNav.js 加List引用
import List from "../util/List";
网友评论