我正在尝试进行应用导航,底部带有标签,页眉带有一些按钮。
我目前的设置如下:
AppNavigator.Js,其中具有用于登录和注册的SwitchNavigation。然后是Mainapp的StackNavgation,里面是TabNavigator。
#include <type_traits>
namespace is_iterable_impl
{
template<class T>
using check_specs = std::void_t<
std::enable_if_t<std::is_same_v<
decltype(begin(std::declval<T>())), // has begin()
decltype(end(std::declval<T>())) // has end()
>>, // ... begin() and end() are the same type ...
decltype(*begin(std::declval<T>())) // ... which can be dereferenced
>;
template<class T, class = void>
struct is_iterable
: std::false_type
{};
template<class T>
struct is_iterable<T, check_specs<T>>
: std::true_type
{};
}
template<class T>
using is_iterable = is_iterable_impl::is_iterable<T>;
template<class T>
constexpr bool is_iterable_v = is_iterable<T>::value;
MainTabNavigator.js在这里,我有选项卡,每个选项卡都是一个StackNavigator。
const AppStack = createStackNavigator({
Main: MainTabNavigator,
Profile: ProfileScreen,
UserSettings: SettingsScreen,
Abo: AboScreen,
})
AppStack.navigationOptions = {
headerRight: (
<Button
onPress={() => alert('This is a button!')}
title="Info"
color="#fff"
/>
),
}
{/* Navigation all the routes added here */}
export default createSwitchNavigator({
Loading: AuthLoadingScreen,
Welcome: WelcomeScreen,
App: AppStack,
Login: LoginScreen,
SignUp: SignUpScreen,
ForgotPassword: ForgotPasswordScreen,
});
我最终关注了Two Headers and cant add Icon to Header
如何禁用第二个标题,以及如何向标题添加按钮以向其中添加一些导航?