我正在尝试实现这种结构:
- Landing page
- Login button
- Search button
当我单击登录时,它会带我到页面没问题:
但是,如果我单击搜索按钮,它将显示以下内容:
只有在createStackView中有一个标题时,登录页面的外观才如此。
点击搜索按钮的内容应该是包含搜索目标文本的页面。
这是我的代码:
import React, { Component } from "react";
import { StyleSheet, Text, View } from "react-native";
import { createStackNavigator, createSwitchNavigator } from "react-navigation";
import Landing from "./src/components/Landing";
import Login from "./src/components/Login";
import SearchLanding from "./src/components/Landing";
import SearchByText from "./src/components/SearchByText";
import SearchByScan from "./src/components/SearchByScan";
const AppStack = createSwitchNavigator({
Landing: { screen: Landing },
Login: { screen: Login },
Search: {
screen: createStackNavigator({
SearchLanding: { screen: SearchLanding },
SearchByText: { screen: SearchByText },
SearchByScan: { screen: SearchByScan }
})
}
});
class App extends Component {
render() {
return <AppStack />;
}
}
export default App;