Skip to content

Commit 7d41086

Browse files
authored
chore(iOS, Stack v4): Enable iosPreventReattachmentOfDismissedScreens by default (#3652)
## Description It probably should be merged after expo-router cutoff for RNScreens version. This PR is enabling the fix which was earlier hidden behind FF ## Changes - iosPreventReattachmentOfDismissedScreens is now set to `true` by default ## Before & after - visual documentation N/A - nothing should change, for visual documentation please see: #3584 ## Test plan Performed regression testing on Test2559. ## Checklist - [ ] Included code example that can be used to test this change. - [ ] Updated / created local changelog entries in relevant test files. - [ ] For visual changes, included screenshots / GIFs / recordings documenting the change. - [ ] For API changes, updated relevant public types. - [ ] Ensured that CI passes
1 parent 0893e0d commit 7d41086

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

FabricExample/App.tsx

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
import App from '../apps';
22
import { featureFlags } from 'react-native-screens';
33

4-
featureFlags.experiment.synchronousScreenUpdatesEnabled = false
5-
featureFlags.experiment.synchronousHeaderConfigUpdatesEnabled = false
6-
featureFlags.experiment.synchronousHeaderSubviewUpdatesEnabled = false
7-
featureFlags.experiment.androidResetScreenShadowStateOnOrientationChangeEnabled = true
8-
// TODO: @t0maboro - remove ts-ignore after release
9-
// @ts-ignore - will be present since react-native-screens 4.21.0
10-
featureFlags.experiment.iosPreventReattachmentOfDismissedScreens = false
4+
featureFlags.experiment.synchronousScreenUpdatesEnabled = false;
5+
featureFlags.experiment.synchronousHeaderConfigUpdatesEnabled = false;
6+
featureFlags.experiment.synchronousHeaderSubviewUpdatesEnabled = false;
7+
featureFlags.experiment.androidResetScreenShadowStateOnOrientationChangeEnabled =
8+
true;
119

1210
export default App;

android/src/paper/java/com/facebook/react/viewmanagers/RNSScreenStackManagerDelegate.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public RNSScreenStackManagerDelegate(U viewManager) {
2424
public void setProperty(T view, String propName, @Nullable Object value) {
2525
switch (propName) {
2626
case "iosPreventReattachmentOfDismissedScreens":
27-
mViewManager.setIosPreventReattachmentOfDismissedScreens(view, value == null ? false : (boolean) value);
27+
mViewManager.setIosPreventReattachmentOfDismissedScreens(view, value == null ? true : (boolean) value);
2828
break;
2929
default:
3030
super.setProperty(view, propName, value);

ios/RNSScreenStack.mm

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,7 @@ - (void)initCommonProps
259259
_controller = [RNSNavigationController new];
260260
_controller.delegate = self;
261261
_sinkEventsPanGestureRecognizer = [[UIPanGestureRecognizer alloc] init];
262+
_iosPreventReattachmentOfDismissedScreens = YES;
262263
#if !TARGET_OS_TV && !TARGET_OS_VISION
263264
[self setupGestureHandlers];
264265
#endif
@@ -1560,6 +1561,7 @@ @implementation RNSScreenStackManager {
15601561
RCT_EXPORT_MODULE()
15611562

15621563
RCT_EXPORT_VIEW_PROPERTY(onFinishTransitioning, RCTDirectEventBlock);
1564+
RCT_EXPORT_VIEW_PROPERTY(iosPreventReattachmentOfDismissedScreens, BOOL);
15631565

15641566
#ifdef RCT_NEW_ARCH_ENABLED
15651567
#else

src/fabric/ScreenStackNativeComponent.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import type { CodegenTypes as CT, ViewProps } from 'react-native';
77
type FinishTransitioningEvent = Readonly<{}>;
88

99
export interface NativeProps extends ViewProps {
10-
iosPreventReattachmentOfDismissedScreens?: CT.WithDefault<boolean, false>;
10+
iosPreventReattachmentOfDismissedScreens?: CT.WithDefault<boolean, true>;
1111

1212
onFinishTransitioning?: CT.DirectEventHandler<FinishTransitioningEvent>;
1313
}

src/flags.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const RNS_SYNCHRONOUS_HEADER_CONFIG_STATE_UPDATES_DEFAULT = false;
44
const RNS_SYNCHRONOUS_HEADER_SUBVIEW_STATE_UPDATES_DEFAULT = false;
55
const RNS_ANDROID_RESET_SCREEN_SHADOW_STATE_ON_ORIENTATION_CHANGE_DEFAULT =
66
true;
7-
const RNS_IOS_PREVENT_REATTACHMENT_OF_DISMISSED_SCREENS = false;
7+
const RNS_IOS_PREVENT_REATTACHMENT_OF_DISMISSED_SCREENS = true;
88

99
// TODO: Migrate freeze here
1010

0 commit comments

Comments
 (0)