Skip to content

Commit 4b7072a

Browse files
kmichalikkclaude
andauthored
feat(iOS): Enable synchronous header config shadow state updates by default (#3932)
## Description This PR changes the default value for `synchronousHeaderConfigUpdatesEnabled` flag to true. ## Changes Updated flag default, native and JS defaults ## Before & after - visual documentation N/A ## Test plan See #3282 ## Checklist - [ ] Included code example that can be used to test this change. - [ ] For visual changes, included screenshots / GIFs / recordings documenting the change. - [ ] For API changes, updated relevant public types. - [ ] Ensured that CI passes --------- Co-authored-by: Claude Opus 4.6 (1M context) <[email protected]>
1 parent 8c4273a commit 4b7072a

4 files changed

Lines changed: 30 additions & 33 deletions

File tree

FabricExample/App.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import App from '../apps';
22
import { featureFlags } from 'react-native-screens';
33

44
featureFlags.experiment.synchronousScreenUpdatesEnabled = false;
5-
featureFlags.experiment.synchronousHeaderConfigUpdatesEnabled = false;
5+
featureFlags.experiment.synchronousHeaderConfigUpdatesEnabled = true;
66
featureFlags.experiment.synchronousHeaderSubviewUpdatesEnabled = false;
77
featureFlags.experiment.androidResetScreenShadowStateOnOrientationChangeEnabled =
88
true;

ios/RNSScreenStackHeaderConfig.mm

Lines changed: 27 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ - (void)initProps
8282
_reactSubviews = [NSMutableArray new];
8383
_backTitleVisible = YES;
8484
_blurEffect = RNSBlurEffectStyleNone;
85+
_synchronousShadowStateUpdatesEnabled = YES;
8586
}
8687

8788
RNS_IGNORE_SUPER_CALL_BEGIN
@@ -281,11 +282,10 @@ - (UIImage *)loadBackButtonImageInViewController:(UIViewController *)vc
281282
// in the image attribute not being updated. We manually set frame to the size of an image
282283
// in order to trigger proper reload that'd update the image attribute.
283284
RCTImageSource *imageSource = [RNSScreenStackHeaderConfig imageSourceFromImageView:imageView];
284-
[imageView reactSetFrame:CGRectMake(
285-
imageView.frame.origin.x,
286-
imageView.frame.origin.y,
287-
imageSource.size.width,
288-
imageSource.size.height)];
285+
[imageView reactSetFrame:CGRectMake(imageView.frame.origin.x,
286+
imageView.frame.origin.y,
287+
imageSource.size.width,
288+
imageSource.size.height)];
289289
}
290290

291291
UIImage *image = imageView.image;
@@ -847,13 +847,12 @@ - (void)mountChildComponentView:(UIView<RCTComponentViewProtocol> *)childCompone
847847
return;
848848
}
849849

850-
RCTAssert(
851-
childComponentView.superview == nil,
852-
@"Attempt to mount already mounted component view. (parent: %@, child: %@, index: %@, existing parent: %@)",
853-
self,
854-
childComponentView,
855-
@(index),
856-
@([childComponentView.superview tag]));
850+
RCTAssert(childComponentView.superview == nil,
851+
@"Attempt to mount already mounted component view. (parent: %@, child: %@, index: %@, existing parent: %@)",
852+
self,
853+
childComponentView,
854+
@(index),
855+
@([childComponentView.superview tag]));
857856

858857
// [_reactSubviews insertObject:(RNSScreenStackHeaderSubview *)childComponentView atIndex:index];
859858
[self insertReactSubview:(RNSScreenStackHeaderSubview *)childComponentView atIndex:index];
@@ -1130,23 +1129,21 @@ @implementation RNSScreenStackHeaderConfigManager
11301129

11311130
@implementation RCTConvert (RNSScreenStackHeader)
11321131

1133-
RCT_ENUM_CONVERTER(
1134-
UISemanticContentAttribute,
1135-
(@{
1136-
@"ltr" : @(UISemanticContentAttributeForceLeftToRight),
1137-
@"rtl" : @(UISemanticContentAttributeForceRightToLeft),
1138-
}),
1139-
UISemanticContentAttributeUnspecified,
1140-
integerValue)
1141-
1142-
RCT_ENUM_CONVERTER(
1143-
UINavigationItemBackButtonDisplayMode,
1144-
(@{
1145-
@"default" : @(UINavigationItemBackButtonDisplayModeDefault),
1146-
@"generic" : @(UINavigationItemBackButtonDisplayModeGeneric),
1147-
@"minimal" : @(UINavigationItemBackButtonDisplayModeMinimal),
1148-
}),
1149-
UINavigationItemBackButtonDisplayModeDefault,
1150-
integerValue)
1132+
RCT_ENUM_CONVERTER(UISemanticContentAttribute,
1133+
(@{
1134+
@"ltr" : @(UISemanticContentAttributeForceLeftToRight),
1135+
@"rtl" : @(UISemanticContentAttributeForceRightToLeft),
1136+
}),
1137+
UISemanticContentAttributeUnspecified,
1138+
integerValue)
1139+
1140+
RCT_ENUM_CONVERTER(UINavigationItemBackButtonDisplayMode,
1141+
(@{
1142+
@"default" : @(UINavigationItemBackButtonDisplayModeDefault),
1143+
@"generic" : @(UINavigationItemBackButtonDisplayModeGeneric),
1144+
@"minimal" : @(UINavigationItemBackButtonDisplayModeMinimal),
1145+
}),
1146+
UINavigationItemBackButtonDisplayModeDefault,
1147+
integerValue)
11511148

11521149
@end

src/fabric/ScreenStackHeaderConfigNativeComponent.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ export interface NativeProps extends ViewProps {
8080
onPressHeaderBarButtonMenuItem?:
8181
| CT.DirectEventHandler<OnPressHeaderBarButtonMenuItemEvent>
8282
| undefined;
83-
synchronousShadowStateUpdatesEnabled?: CT.WithDefault<boolean, false>;
83+
synchronousShadowStateUpdatesEnabled?: CT.WithDefault<boolean, true>;
8484

8585
// Experimental
8686
userInterfaceStyle?: CT.WithDefault<UserInterfaceStyle, 'unspecified'>;

src/flags.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const RNS_SYNCHRONOUS_SCREEN_STATE_UPDATES_DEFAULT = false;
2-
const RNS_SYNCHRONOUS_HEADER_CONFIG_STATE_UPDATES_DEFAULT = false;
2+
const RNS_SYNCHRONOUS_HEADER_CONFIG_STATE_UPDATES_DEFAULT = true;
33
const RNS_SYNCHRONOUS_HEADER_SUBVIEW_STATE_UPDATES_DEFAULT = false;
44
const RNS_ANDROID_LEGACY_TOP_INSET_BEHAVIOR_DEFAULT = false;
55
const RNS_ANDROID_RESET_SCREEN_SHADOW_STATE_ON_ORIENTATION_CHANGE_DEFAULT =

0 commit comments

Comments
 (0)