我安装了react-navigation,并使Switch Navigator可以工作,但是我无法使Tab Navigator正常工作。编译时,出现以下错误:
警告:纯JavaScript React中不建议使用isMounted(...) 类。相反,请确保清理订阅和待处理 componentWillUnmount中的请求以防止内存泄漏。
然后,当我消除错误时,我得到了一个空白屏幕。我的编译器未检测到任何语法错误。
import React, { Component } from "react";
import { View, StyleSheet } from "react-native";
import { MainFeed, Login, Camera, Profile } from "./components/screens";
import { SwitchNavigator, TabNavigator } from "react-navigation";
const Tabs = TabNavigator({
feed: MainFeed,
camera: Camera,
profile: Profile
});
const MainStack = SwitchNavigator({
login: Login,
main: Tabs
});
class InstaClone extends Component {
render(){
return <MainStack/>;
}
}
export default InstaClone;