gpt4 book ai didi

javascript - 如何修复您应该只在 IOS 的应用程序中显式渲染一个导航器

转载 作者:行者123 更新时间:2023-11-29 05:55:29 25 4
gpt4 key购买 nike

我在 RN 项目中使用“react-navigation”和react-native-router-flux在android上一切正常但在IOS上有警告

You should only render one navigator explicitly in your app, and other navigators should be rendered by including them in that navigator. Full details at: https://reactnavigation.org/docs/common-mistakes.html#explicitly-rendering-more-than-one-navigator - node_modules/expo/build/environment/logging.js:25:23 in warn - node_modules/@react-navigation/native/src/createAppContainer.js:198:12 in componentDidMount$ - node_modules/@babel/runtime/node_modules/regenerator-runtime/runtime.js:62:44 in tryCatch - node_modules/@babel/runtime/node_modules/regenerator-runtime/runtime.js:288:30 in invoke - node_modules/@babel/runtime/node_modules/regenerator-runtime/runtime.js:62:44 in tryCatch - node_modules/@babel/runtime/node_modules/regenerator-runtime/runtime.js:152:28 in invoke - node_modules/@babel/runtime/node_modules/regenerator-runtime/runtime.js:187:17 in

这是我的 App.js

...

 return (
<Provider store={store}>
<RouterWithRedux>
<Router>
<Stack key="root" hideNavBar={true}>
<Scene
key="loginScreen"
hideNavBar
component={requireAuthNOT(LoginScreen)}
title="Please Sign in"
/>
<Scene
key="ticketsListScreen"
component={requireAuth(TicketsListScreen)}
animation="fade"
title="Home"
hideNavBar={true}
/>
<Scene
key="ticketDetail"
component={requireAuth(LoginDetail)}
animation="fade"
hideNavBar={true}
/>
</Stack>
</Router>
</RouterWithRedux>
</Provider>
);

...

登录屏幕.js

import React, { Component } from "react"; 
import Logo from "../components/Auth/Logo";
import Form from "../components/Auth/Form";
import Wallpaper from "../components/Auth/Wallpaper";
import ButtonSubmit from "../components/Auth/ButtonSubmit";
import SignupSection from "../components/Auth/SignupSection";

export default class LoginScreen extends Component {
render() {
return (
<Wallpaper>
<Logo />
<Form />
<SignupSection />
<ButtonSubmit />
</Wallpaper>
);
}
}

TicketsListScreen.js

import React, { Component } from "react";
import Navigator from "./Navigator";

export default class ScreenTest extends Component {
render() {
return <Navigator />;
}
}

导航器.js

import React, { Component } from "react";
import TicketsListScreen from "./TicketsListScreen";
import VehicleScreen from "../VehicleScreen/VehicleScreen";
import SideBar from "../../components/Navigator/SideBar";
import SignOut from "../../screens/LogoutScreen";
import { createDrawerNavigator, createAppContainer } from "react-navigation";
const TicketScreenRouter = createDrawerNavigator(
{
Home: { screen: TicketsListScreen },
Tickets: { screen: TicketsListScreen },
"Vehicle Inspections": { screen: VehicleScreen },
"Sign Out": { screen: SignOut }
},
{
contentComponent: props => <SideBar {...props} />
},
{
initialRouteName: "Home"
}
);
export default createAppContainer(TicketScreenRouter);

我不确定是什么问题。我已阅读https://reactnavigation.org/docs/common-mistakes.html#explicitly-rendering-more-than-one-navigator

但这对我没有帮助

谢谢,最诚挚的问候

最佳答案

这是app.js

return (
<Provider store={store}>
<RouterWithRedux>
<Scene key="root" hideNavBar={true}>
<Scene
key="loginScreen"
hideNavBar
component={requireAuthNOT(LoginScreen)}
title="Please Sign in"
/>
<Drawer
open={false}
type="overlay"
key="drawer"
contentComponent={SideBar}>
<Scene
key="VehicleInsections"
component={requireAuth(VehicleScreen)}
animation="fade"
title="Vehicle"
hideNavBar={true}
/>
</Scene>
</RouterWithRedux>
</Provider>
);
}

目前这对我来说也很有效谢谢https://stackoverflow.com/users/9799857/firu再次。

关于javascript - 如何修复您应该只在 IOS 的应用程序中显式渲染一个导航器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55214449/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com