- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试为我的 react native 应用程序创建一个底部导航器。对于某些页面,我尝试在单击按钮时创建嵌套页面。但我正在尝试使用 react 导航。我被这个问题困扰了一个多月了,我正试图在毕业之前启动我的学校应用程序。
import { AppRegistry, Text, View, StatusBar } from "react-native";
import Icon from "react-native-vector-icons/FontAwesome";
import SplashScreen from "react-native-splash-screen";
import { createMaterialBottomTabNavigator } from "react-navigation-material-bottom-tabs";
import { createStackNavigator, createAppContainer } from "react-navigation";
import Home from "./app/components/home.js";
import Announcements from "./app/components/announcements.js";
import Contact from "./app/components/contact.js";
import BackgroundImage from "./app/components/BackgroundImage.js";
import Materials from "./app/components/Materials.js";
class HomeScreen extends Component {
componentDidMount() {
SplashScreen.hide();
}
render() {
return (
<BackgroundImage>
<StatusBar hidden={true} />
<Home />
</BackgroundImage>
);
}
}
class AnnouncementScreen extends Component {
render() {
return (
<Announcements>
<StatusBar hidden={true} />
</Announcements>
);
}
}
class MaterialScreen extends Component {
render() {
return <Materials />;
}
}
class ContactScreen extends Component {
render() {
return <Contact />;
}
}
class StackPage extends Component {
render() {
return <Text>Hi</Text>;
}
}
const Stack = {
Admin: {
screen: StackPage
}
};
const HomeStack = createStackNavigator({
Home: {
screen: HomeScreen,
navigationOptions: {
title: "Home",
tabBarLabel: <Text style={{ color: "white" }}>Home</Text>,
barStyle: { backgroundColor: "#281b39" },
tabBarIcon: <Icon size={24} name="home" style={{ color: "white" }} />
}
},
...Stack
});
const AppNavigator = createMaterialBottomTabNavigator(
{
Home: { screen: HomeStack },
Announcement: {
screen: AnnouncementScreen,
navigationOptions: {
title: "Announcement",
tabBarLabel: <Text style={{ color: "white" }}>Announcements</Text>,
barStyle: { backgroundColor: "#0e141d" },
tabBarIcon: (
<Icon size={24} name="bullhorn" style={{ color: "white" }} />
)
}
},
Material: {
screen: MaterialScreen,
navigationOptions: {
title: "Materials",
tabBarLabel: <Text style={{ color: "white" }}>Materials</Text>,
barStyle: { backgroundColor: "#0D4D4B" },
tabBarIcon: (
<Icon size={24} name="calendar" style={{ color: "white" }} />
)
}
},
Contact: {
screen: ContactScreen,
navigationOptions: {
title: "Contact",
tabBarLabel: <Text style={{ color: "white" }}>Contact</Text>,
barStyle: { backgroundColor: "#524365" },
tabBarIcon: (
<Icon size={24} name="comments" style={{ color: "white" }} />
)
}
}
},
{
shifting: true,
labeled: true
},
);
export default createAppContainer(AppNavigator);
但遇到以下错误。
Error: This navigator has both navigation and container props, so it is unclear if it should own its own state. Remove props: "rootTag" if the navigator should get its state from the navigation prop. If the navigator should maintain its own state, do not pass a navigation prop.
最佳答案
import React from "react";
import { Image } from "react-native-elements";
import stringsoflanguages from "../containers/stringsoflanguages";
import {
createBottomTabNavigator,
createSwitchNavigator,
createAppContainer,
createStackNavigator
} from "react-navigation";
import LoginScreen from "../containers/LoginScreen";
import AuthLoadingScreen from "../containers/AuthLoadingScreen";
import RequestCategory from "../containers/RequestCategory";
import PendingCategory from "../containers/PendingCategory";
import OtherCategory from "../containers/OtherCategory";
import Addresscategory from "../containers/Addresscategory";
import AddressList from "../containers/AddressList";
import AllAttendance from "../containers/AllAttendance";
import AllDocument from "../containers/AllDocument";
import AllMeeting from "../containers/AllMeeting";
import AllOutMeeting from "../containers/AllOutMeeting";
import Assessment from "../containers/Assessment";
import BasicInformation from "../containers/BasicInformation";
import CategoryList from "../containers/CategoryList";
import Complaint from "../containers/Complaint";
import DailyWork from "../containers/DailyWork";
import Education from "../containers/Education";
import EmailList from "../containers/EmailList";
import MessageCenter from "../containers/MessageCenter";
import FinanceExpense from "../containers/FinanceExpense";
import FundExpense from "../containers/FundExpense";
import FundIncome from "../containers/FundIncome";
import FundMaintaince from "../containers/FundMaintaince";
import Home from "../containers/Home";
import LibraryExpense from "../containers/LibraryExpense";
import LibraryIncome from "../containers/LibraryIncome";
import MeetingApply from "../containers/MeetingApply";
import MeetingRoom from "../containers/MeetingRoom";
import MyAttendance from "../containers/MyAttendance";
import MyDocument from "../containers/MyDocument";
import MyOuting from "../containers/MyOuting";
import ProfileAddress from "../containers/ProfileAddress";
import RecyclerDocument from "../containers/RecyclerDocument";
import Repair from "../containers/Repair";
import ResearchData from "../containers/ResearchData";
import Reward from "../containers/Reward";
import SearchProject from "../containers/SearchProject";
import Training from "../containers/Training";
import User from "../containers/User";
import WorkExperience from "../containers/WorkExperience";
import PersonalInformationcategory from "../containers/PersonalInformationcategory";
import DailyWorkcategory from "../containers/DailyWorkcategory";
import MeetingRoomcategory from "../containers/MeetingRoomcategory";
import Conferencemanagmnetcategory from "../containers/Conferencemanagementcategory";
import OutingMeetingcategory from "../containers/OutingMeetingcategory";
import Financialrevenuecategory from "../containers/Financialrevenuecategory";
import Libraryrevenuecategory from "../containers/Libraryrevenuecategory";
import Escrowrevenuecategory from "../containers/Escrowrevenuecategory";
import BookAssets from "../containers/BookAssets";
import EquipmentAssets from "../containers/EquipmentAssets";
import UserProfile from "../containers/UserProfile";
import PersonalAssets from "../containers/PersonalAssets";
import MessageChat from "../containers/MessgeChat";
import BasicInformationDetails from "../containers/BasicInformationDetails";
import EducationDetails from "../containers/EducationDetails";
import TrainingDetails from "../containers/TrainingDetails";
import RewardDetails from "../containers/RewardDetails";
import AssessmentDetails from "../containers/AssessmentDetails";
import ResearchresultDetails from "../containers/ResearchresultDetails";
import ResearchprojectDetails from "../containers/ResearchprojectDetails";
import Backlog from "../containers/Backlog";
import ProfileEquipment from "../containers/ProfileEquipment";
import ProfileDocument from "../containers/ProfileDocument";
import Addressgroupinfo from "../containers/Addressgroupinfo";
import AddressUser from "../containers/AddressUser";
import BookAssetsList from "../containers/BookAssetsList";
import BookAssetsDetails from "../containers/BookAssetDetails";
import EquipmentDetails from "../containers/EquipmentDetails";
import PersonalAssetsDetails from "../containers/PersonalAssetsDetails";
import WorkExperienceDetails from "../containers/WorkExperienceDetails";
import AllMeetingDetails from "../containers/AllMeetingDetails";
import MeetingApplyDetails from "../containers/MeetingApplyDetails";
import FinancialExpenseDetails from "../containers/FinancialExpenseDetails";
import MaintainceFundDetails from "../containers/MaintainceFundDetails";
import LibraryExpenseDetails from "../containers/LibraryExpenseDetails";
import LibraryIncomeDetails from "../containers/LibraryIncomeDetails";
import FundIncomeDetails from "../containers/FundIncomeDetails";
import FundExpenseDetails from "../containers/FundExpenseDetails";
import CallForDetails from "../containers/CallForDetails";
import ComplaintDetails from "../containers/ComplaintDetails";
import BookAssetsEdit from "../containers/BookAssetsEdit";
import EquipmentEdit from "../containers/EquipmentEdit";
import PersonalAssetsEdit from "../containers/PersonalAssetsEdit";
import BookDetails from "../containers/BookDetails";
import DialogPage from "../containers/DialogPage";
import Example from "../containers/Example";
import AllApprovalDetails from "../containers/AllApprovalDetails";
import PendingApprovalDetails from "../containers/PendingApprovalDetails";
import OtherApprovalDetails from "../containers/OtherApprovalDetails";
import RequestApprovalDetails from "../containers/RequestApprovalDetails";
import ProfileEquipmentDetails from "../containers/ProfileEquipmentDetails";
import DocumentUpload from "../containers/DocumentUpload";
import ContactDetails from "../containers/ContactDetails";
import BookDetailsAdd from "../containers/BookDetailsAdd";
import PersonalAssetsAdd from "../containers/PersonalAssetsAdd";
import EquipmentAdd from "../containers/EquipmentAdd";
import BookListAdd from "../containers/BookListAdd";
import MeetingRoomDetails from "../containers/MeetingRoomDetails";
import SubmitMeeting from "../containers/SubmitMeeting";
const TabNavigator = createBottomTabNavigator(
{
EmailList: {
screen: createStackNavigator({
EmailList: {
screen: EmailList,
navigationOptions: {
header: null
}
},
MessageChat: {
screen: MessageChat,
navigationOptions: {
header: null
}
},
DocumentUpload: {
screen: DocumentUpload,
navigationOptions: {
header: null
}
}
}),
navigationOptions: {
tabBarLabel: stringsoflanguages.chats,
tabBarIcon: ({ tintColor }) => (
<Image
style={{ tintColor, width: 22, height: 18 }}
source={require("../assets/common_slicing/ic_chat.png")}
/>
)
}
},
Home: {
screen: createStackNavigator({
Home: {
screen: Home,
navigationOptions: {
header: null
}
},
SubmitMeeting: {
screen: SubmitMeeting,
navigationOptions: {
header: null
}
},
RequestApprovalDetails: {
screen: RequestApprovalDetails,
navigationOptions: {
header: null
}
},
PersonalAssetsAdd: {
screen: PersonalAssetsAdd,
navigationOptions: {
header: null
}
},
EquipmentAdd: {
screen: EquipmentAdd,
navigationOptions: {
header: null
}
},
BookListAdd: {
screen: BookListAdd,
navigationOptions: {
header: null
}
},
OtherApprovalDetails: {
screen: OtherApprovalDetails,
navigationOptions: {
header: null
}
},
PendingApprovalDetails: {
screen: PendingApprovalDetails,
navigationOptions: {
header: null
}
},
MeetingRoomcategory: {
screen: MeetingRoomcategory,
navigationOptions: {
header: null
}
},
Example: {
screen: Example,
navigationOptions: {
header: null
}
},
DialogPage: {
screen: DialogPage,
navigationOptions: {
header: null
}
},
Escrowrevenuecategory: {
screen: Escrowrevenuecategory,
navigationOptions: {
header: null
}
},
BookDetails: {
screen: BookDetails,
navigationOptions: {
header: null
}
},
ComplaintDetails: {
screen: ComplaintDetails,
navigationOptions: {
header: null
}
},
FinancialExpenseDetails: {
screen: FinancialExpenseDetails,
navigationOptions: {
header: null
}
},
MaintainceFundDetails: {
screen: MaintainceFundDetails,
navigationOptions: {
header: null
}
},
AllApprovalDetails: {
screen: AllApprovalDetails,
navigationOptions: {
header: null
}
},
LibraryExpenseDetails: {
screen: LibraryExpenseDetails,
navigationOptions: {
header: null
}
},
LibraryIncomeDetails: {
screen: LibraryIncomeDetails,
navigationOptions: {
header: null
}
},
FundIncomeDetails: {
screen: FundIncomeDetails,
navigationOptions: {
header: null
}
},
CallForDetails: {
screen: CallForDetails,
navigationOptions: {
header: null
}
},
FundExpenseDetails: {
screen: FundExpenseDetails,
navigationOptions: {
header: null
}
},
Financialrevenuecategory: {
screen: Financialrevenuecategory,
navigationOptions: {
header: null
}
},
PersonalAssetsEdit: {
screen: PersonalAssetsEdit,
navigationOptions: {
header: null
}
},
EquipmentEdit: {
screen: EquipmentEdit,
navigationOptions: {
header: null
}
},
Libraryrevenuecategory: {
screen: Libraryrevenuecategory,
navigationOptions: {
header: null
}
},
OutingMeetingcategory: {
screen: OutingMeetingcategory,
navigationOptions: {
header: null
}
},
Conferencemanagmnetcategory: {
screen: Conferencemanagmnetcategory,
navigationOptions: {
header: null
}
},
LibraryExpense: {
screen: LibraryExpense,
navigationOptions: {
header: null
}
},
Training: {
screen: Training,
navigationOptions: {
header: null
}
},
RecyclerDocument: {
screen: RecyclerDocument,
navigationOptions: {
header: null
}
},
MeetingApply: {
screen: MeetingApply,
navigationOptions: {
header: null
}
},
MeetingApplyDetails: {
screen: MeetingApplyDetails,
navigationOptions: {
header: null
}
},
MeetingRoomDetails: {
screen: MeetingRoomDetails,
navigationOptions: {
header: null
}
},
DailyWorkcategory: {
screen: DailyWorkcategory,
navigationOptions: {
header: null
}
},
MyOuting: {
screen: MyOuting,
navigationOptions: {
header: null
}
},
MyDocument: {
screen: MyDocument,
navigationOptions: {
header: null
}
},
MyAttendance: {
screen: MyAttendance,
navigationOptions: {
header: null
}
},
MeetingRoom: {
screen: MeetingRoom,
navigationOptions: {
header: null
}
},
LibraryIncome: {
screen: LibraryIncome,
navigationOptions: {
header: null
}
},
BasicInformation: {
screen: BasicInformation,
navigationOptions: {
header: null
}
},
BasicInformationDetails: {
screen: BasicInformationDetails,
navigationOptions: {
header: null
}
},
WorkExperienceDetails: {
screen: WorkExperienceDetails,
navigationOptions: {
header: null
}
},
TrainingDetails: {
screen: TrainingDetails,
navigationOptions: {
header: null
}
},
EducationDetails: {
screen: EducationDetails,
navigationOptions: {
header: null
}
},
RewardDetails: {
screen: RewardDetails,
navigationOptions: {
header: null
}
},
AssessmentDetails: {
screen: AssessmentDetails,
navigationOptions: {
header: null
}
},
ResearchresultDetails: {
screen: ResearchresultDetails,
navigationOptions: {
header: null
}
},
ResearchprojectDetails: {
screen: ResearchprojectDetails,
navigationOptions: {
header: null
}
},
FundMaintaince: {
screen: FundMaintaince,
navigationOptions: {
header: null
}
},
Education: {
screen: Education,
navigationOptions: {
header: null
}
},
DailyWork: {
screen: DailyWork,
navigationOptions: {
header: null
}
},
FundExpense: {
screen: FundExpense,
navigationOptions: {
header: null
}
},
FundIncome: {
screen: FundIncome,
navigationOptions: {
header: null
}
},
FinanceExpense: {
screen: FinanceExpense,
navigationOptions: {
header: null
}
},
AllAttendance: {
screen: AllAttendance,
navigationOptions: {
header: null
}
},
AllDocument: {
screen: AllDocument,
navigationOptions: {
header: null
}
},
AllMeeting: {
screen: AllMeeting,
navigationOptions: {
header: null
}
},
AllMeetingDetails: {
screen: AllMeetingDetails,
navigationOptions: {
header: null
}
},
AllOutMeeting: {
screen: AllOutMeeting,
navigationOptions: {
header: null
}
},
Assessment: {
screen: Assessment,
navigationOptions: {
header: null
}
},
Addresscategory: {
screen: Addresscategory,
navigationOptions: {
header: null
}
},
WorkExperience: {
screen: WorkExperience,
navigationOptions: {
header: null
}
},
RequestCategory: {
screen: RequestCategory,
navigationOptions: {
header: null
}
},
PendingCategory: {
screen: PendingCategory,
navigationOptions: {
header: null
}
},
OtherCategory: {
screen: OtherCategory,
navigationOptions: {
header: null
}
},
Repair: {
screen: Repair,
navigationOptions: {
header: null
}
},
Reward: {
screen: Reward,
navigationOptions: {
header: null
}
},
SearchProject: {
screen: SearchProject,
navigationOptions: {
header: null
}
},
ResearchData: {
screen: ResearchData,
navigationOptions: {
header: null
}
},
Complaint: {
screen: Complaint,
navigationOptions: {
header: null
}
},
BookAssets: {
screen: BookAssets,
navigationOptions: {
header: null
}
},
BookAssetsList: {
screen: BookAssetsList,
navigationOptions: {
header: null
}
},
BookAssetsEdit: {
screen: BookAssetsEdit,
navigationOptions: {
header: null
}
},
BookAssetsDetails: {
screen: BookAssetsDetails,
navigationOptions: {
header: null
}
},
EquipmentAssets: {
screen: EquipmentAssets,
navigationOptions: {
header: null
}
},
EquipmentDetails: {
screen: EquipmentDetails,
navigationOptions: {
header: null
}
},
PersonalAssets: {
screen: PersonalAssets,
navigationOptions: {
header: null
}
},
PersonalAssetsDetails: {
screen: PersonalAssetsDetails,
navigationOptions: {
header: null
}
},
PersonalInformationcategory: {
screen: PersonalInformationcategory,
navigationOptions: {
header: null
}
},
BookDetailsAdd: {
screen: BookDetailsAdd,
navigationOptions: {
header: null
}
}
}),
navigationOptions: {
tabBarLabel: stringsoflanguages.Home,
tabBarIcon: ({ tintColor }) => (
<Image
style={{ tintColor, width: 22, height: 18 }}
source={require("../assets/common_slicing/ic_home.png")}
/>
)
}
},
MessageCenter: {
screen: MessageCenter,
navigationOptions: {
title: "",
tabBarIcon: (
<Image
style={{ top: 10, width: 55, height: 60 }}
source={require("../assets/common_slicing/add_btn.png")}
/>
)
}
},
Address: {
screen: createStackNavigator({
CategoryList: {
screen: CategoryList,
navigationOptions: {
header: null
}
},
ContactDetails: {
screen: ContactDetails,
navigationOptions: {
header: null
}
},
// AddressSearchPage : {
// screen : AddressSearchPage,
// navigationOptions : {
// header : null
// }
// },
AddressList: {
screen: AddressList,
navigationOptions: {
header: null
}
},
ProfileAddress: {
screen: ProfileAddress,
navigationOptions: {
header: null
}
},
Addressgroupinfo: {
screen: Addressgroupinfo,
navigationOptions: {
header: null
}
},
AddressUser: {
screen: AddressUser,
navigationOptions: {
header: null
}
}
}),
navigationOptions: {
tabBarLabel: stringsoflanguages.AddressBook,
tabBarIcon: ({ tintColor }) => (
<Image
style={{ tintColor, width: 22, height: 18 }}
source={require("../assets/common_slicing/ic_address_book.png")}
/>
)
}
},
User: {
screen: createStackNavigator({
User: {
screen: User,
navigationOptions: {
header: null
}
},
UserProfile: {
screen: UserProfile,
navigationOptions: {
header: null
}
},
ProfileEquipmentDetails: {
screen: ProfileEquipmentDetails,
navigationOptions: {
header: null
}
},
Backlog: {
screen: Backlog,
navigationOptions: {
header: null
}
},
ProfileDocument: {
screen: ProfileDocument,
navigationOptions: {
header: null
}
},
ProfileEquipment: {
screen: ProfileEquipment,
navigationOptions: {
header: null
}
}
}),
navigationOptions: {
tabBarLabel: stringsoflanguages.profilepage,
tabBarIcon: ({ tintColor }) => (
<Image
style={{ tintColor, width: 22, height: 22 }}
source={require("../assets/common_slicing/ic_profile.png")}
/>
)
}
}
},
{
swipeEnabled: true,
tabBarOptions: {
activeTintColor: "tomato",
inactiveTintColor: "gray",
labelStyle: {
fontFamily: "Raleway-Regular",
textAlign: "center",
bottom: 10,
fontSize: 9
},
style: {
height: 70
}
}
}
);
const AuthStack = createStackNavigator({
Login: LoginScreen
});
const appRoutes = createSwitchNavigator(
{
AuthLoading: AuthLoadingScreen,
App: TabNavigator,
Auth: AuthStack
},
{
initialRouteName: "AuthLoading"
}
);
export const Router = createAppContainer(appRoutes);
export default Router;
关于javascript - react 堆栈导航,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56200117/
问题是,当用户回复彼此的帖子时,我必须这样做: margin-left:40px; 对于 1 级深度 react margin-left:80px; 对于 2 层深等 但是我想让 react div
我试图弄清楚如何将 React Router 与 React VR 连接起来。 首先,我应该使用 react-router dom/native ?目前尚不清楚,因为 React VR 构建在 Rea
我是 React 或一般编码背景的新手。我不确定这些陈述之间有什么区别 import * as react from 'react' 和 import react from 'react' 提前致谢!
我正在使用最新的稳定版本的 react、react-native、react-test-renderer、react-dom。 然而,react-native 依赖于 react@16.0.0-alp
是否 react 原生 应用程序开发可以通过软件架构实现,例如 MVC、MVP、MVVM ? 谢谢你。 最佳答案 是的。 React Native 只是你提到的那些软件设计模式中的“V”。如果你考虑其
您好我正在尝试在我的导航器右按钮中绑定(bind)一个功能, 但它给出了错误。 这是我的代码: import React, { Component } from 'react'; import Ico
我使用react native创建了一个应用程序,我正在尝试生成apk。在http://facebook.github.io/react-native/docs/signed-apk-android.
1 [我尝试将分页的 z-index 更改为 0,但没有成功] 这是我的codesandbox的链接:请检查最后一个选择下拉列表,它位于分页后面。 https://codesandbox.io/s/j
我注意到 React 可以这样导入: import * as React from 'react'; ...或者像这样: import React from 'react'; 第一个导入 react
我是 react-native 的新手。我正在使用 React Native Paper 为所有屏幕提供主题。我也在使用 react 导航堆栈导航器和抽屉导航器。首先,对于导航,论文主题在导航组件中不
我有一个使用 Ignite CLI 创建的 React Native 应用程序.我正在尝试将 TabNavigator 与 React Navigation 结合使用,但我似乎无法弄清楚如何将数据从一
我正在尝试在我的 React 应用程序中进行快照测试。我已经在使用 react-testing-library 进行一般的单元测试。然而,对于快照测试,我在网上看到了不同的方法,要么使用 react-
我正在使用 react-native 构建跨平台 native 应用程序,并使用 react-navigation 在屏幕之间导航和使用 redux 管理导航状态。当我嵌套导航器时会出现问题。 例如,
由于分页和 React Native Navigation,我面临着一种复杂的问题。 单击具有类别列表的抽屉,它们都将转到屏幕 问题陈述: 当我随机点击类别时,一切正常。但是,在分页过程中遇到问题。假
这是我的抽屉导航: const DashboardStack = StackNavigator({ Dashboard: { screen: Dashboard
尝试构建 react-native android 应用程序但出现以下错误 info Running jetifier to migrate libraries to AndroidX. You ca
我目前正在一个应用程序中实现 React Router v.4,我也在其中使用 Webpack 进行捆绑。在我的 webpack 配置中,我将 React、ReactDOM 和 React-route
我正在使用 React.children 渲染一些带有 react router 的子路由(对于某个主路由下的所有子路由。 这对我来说一直很好,但是我之前正在解构传递给 children 的 Prop
当我运行 React 应用程序时,它显示 export 'React'(导入为 'React')在 'react' 中找不到。所有页面错误 see image here . 最佳答案 根据图像中的错误
当我使用这个例子在我的应用程序上实现 Image-slider 时,我遇到了这个错误。 import React,{Component} from 'react' import {View,T
我是一名优秀的程序员,十分优秀!