From 5a5f810994cdfc190a04f1178ad5cb58e0d78061 Mon Sep 17 00:00:00 2001 From: tboba Date: Thu, 11 Jul 2024 15:31:14 +0200 Subject: [PATCH 1/8] Add first approach of setting view controllers --- ios/RNSScreenStack.mm | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ios/RNSScreenStack.mm b/ios/RNSScreenStack.mm index 15a7cfe1fb..89d4e2068c 100644 --- a/ios/RNSScreenStack.mm +++ b/ios/RNSScreenStack.mm @@ -626,7 +626,13 @@ - (void)setPushViewControllers:(NSArray *)controllers NSMutableArray *newControllers = [NSMutableArray arrayWithArray:controllers]; [newControllers removeLastObject]; +#ifdef RCT_NEW_ARCH_ENABLED + if (newControllers.count <= _controller.viewControllers.count) { + [_controller setViewControllers:newControllers animated:NO]; + } +#else [_controller setViewControllers:newControllers animated:NO]; +#endif // RTC_NEW_ARCH_ENABLED [_controller pushViewController:top animated:YES]; } else { // don't really know what this case could be, but may need to handle it From 2de7646a908855c4723c2ac8443c20d81f25702a Mon Sep 17 00:00:00 2001 From: tboba Date: Tue, 16 Jul 2024 17:06:06 +0200 Subject: [PATCH 2/8] Add mountingTransactionDidMount method --- apps/src/tests/Test2235.tsx | 85 +++++++++++++++++++++++++++++++++++++ apps/src/tests/index.ts | 1 + ios/RNSScreenStack.mm | 33 ++++++++------ 3 files changed, 107 insertions(+), 12 deletions(-) create mode 100644 apps/src/tests/Test2235.tsx diff --git a/apps/src/tests/Test2235.tsx b/apps/src/tests/Test2235.tsx new file mode 100644 index 0000000000..6632aeb645 --- /dev/null +++ b/apps/src/tests/Test2235.tsx @@ -0,0 +1,85 @@ +import React from 'react'; +import { View, StyleSheet } from 'react-native'; +import { + createNativeStackNavigator, + NativeStackNavigationProp, +} from '@react-navigation/native-stack'; +import { Button } from '../shared'; +import { NavigationContainer } from '@react-navigation/native'; + +type StackParamList = { + Main: undefined; + Detail: undefined; + Detail2: undefined; +}; + +interface MainScreenProps { + navigation: NativeStackNavigationProp; +} + +const MainScreen = ({ navigation }: MainScreenProps): React.JSX.Element => ( + +