Modal Stacking with IOS #1976
-
Hi I would like to achieve the same result with native ios |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hi @moribaleta, thanks for submitting the discussion! Screen.Recording.2023-11-23.at.11.13.35.movIs this what you thought about? Or maybe you had nested view in modal on your mind? import { NavigationContainer } from '@react-navigation/native';
import {
createNativeStackNavigator,
NativeStackNavigationProp,
} from '@react-navigation/native-stack';
import { Button, Text, View } from 'react-native';
import React from 'react';
const Stack = createNativeStackNavigator();
type StackParamList = {
Home: undefined;
Modal1: undefined;
Modal2: undefined;
};
interface MainScreenProps {
navigation: NativeStackNavigationProp<StackParamList>;
}
const Home = ({ navigation }: MainScreenProps) => (
<View>
<Button
onPress={() => navigation.navigate('Modal1')}
title="Click me to open modal!"
/>
</View>
);
const ModalOne = ({ navigation }: MainScreenProps) => (
// You can also use hook useNavigation() to navigate between screens
// const navigation = useNavigation();
<View>
<Button
onPress={() => navigation.navigate('Modal2')}
title="Click me to open second modal!"
/>
</View>
);
const ModalTwo = () => (
<View
style={{
width: '100%',
alignItems: 'center',
}}>
<Text style={{ fontSize: 32 }}>Yay!</Text>
</View>
);
const TestY = () => {
return (
<NavigationContainer>
<Stack.Navigator>
<Stack.Screen name="Home" component={Home} />
<Stack.Screen
name="Modal1"
component={ModalOne}
options={{ presentation: 'modal' }}
/>
<Stack.Screen
name="Modal2"
component={ModalTwo}
options={{ presentation: 'modal' }}
/>
</Stack.Navigator>
</NavigationContainer>
);
};
export default TestY; |
Beta Was this translation helpful? Give feedback.
Hi @moribaleta, thanks for submitting the discussion!
If I understand you correctly, you can easily achieve that by navigating from one modal to another.
Screen.Recording.2023-11-23.at.11.13.35.mov
Is this what you thought about? Or maybe you had nested view in modal on your mind?
You can find the code for the reproduction below: