Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In "Help" page witgh presentation set value to "transparentModal", I want push one new Page of name "Profile", How shuld i do? #1262

Open
zichengbohan opened this issue Jul 6, 2023 · 0 comments

Comments

@zichengbohan
Copy link

import * as React from 'react';
import { Button, View, Text } from 'react-native';
import { NavigationContainer } from '@react-navigation/native';
import { createNativeStackNavigator } from '@react-navigation/native-stack';

function Home({ navigation }) {
return (
<View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
Home Screen
<Button onPress={() => navigation.navigate('Help')} title="Go to Help" />
<Button
onPress={() => navigation.navigate('Profile')}
title="Go to Profile"
/>

);
}

function Help({ navigation }) {
return (
<View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
Help Screen
<Button onPress={() => navigation.push('Profile')} title="Go to Home2" />
<Button onPress={() => navigation.navigate('Invite')} title="Invite" />

);
}

function EmptyScreen() {
return ;
}

const Stack = createNativeStackNavigator();

function App() {
const isLoggedIn = true;

return (

<Stack.Navigator>
{isLoggedIn ? (
// Screens for logged in users
<Stack.Group>
<Stack.Screen name="Home" component={Home} />
<Stack.Screen name="Profile" component={EmptyScreen} />
</Stack.Group>
) : (
// Auth screens
<Stack.Group screenOptions={{ headerShown: false }}>
<Stack.Screen name="SignIn" component={EmptyScreen} />
<Stack.Screen name="SignUp" component={EmptyScreen} />
</Stack.Group>
)}
{/* Common modal screens */}
<Stack.Group screenOptions={{ presentation: 'transparentModal' }}>
<Stack.Screen name="Help" component={Help} />
<Stack.Screen name="Invite" component={EmptyScreen} />
</Stack.Group>
</Stack.Navigator>

);
}

export default App;

In "Help" page, I want push one new Page of name "Profile", How shuld i do?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant