Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(mobile): keep iOS home header stable #8467

Mergedjuliusmarmingemerged 2 commits intomain fromrefs/pull/8467/headmerged by juliusmarminge View on GitHub

Showing 2 changed files with 75 additions and 28 deletions.

x
0 of 2 viewed, 2 left
75 additions and 28 deletionspatches/react-native-screens@4.25.2.patchModified7 lines can hide code
View file
@@ -226,7 +226,45 @@
// appearance does not apply to the tvOS so we need to use lagacy customization
#if TARGET_OS_TV
-@@ -637,10 +675,458 @@ + (void)updateViewController:(UIViewController *)vc
+@@ -550,31 +588,25 @@ + (void)updateViewController:(UIViewController *)vc
+ navitem.titleView = nil;
+- navitem.leftBarButtonItems = nil;
+- navitem.rightBarButtonItems = nil;
+-
++
+ #if !TARGET_OS_TV
+ // We want to set navitem.searchController to nil only if we are sure
+ // that we are removing the search bar from the header.
+ bool searchBarPresent = false;
+ #endif /* !TARGET_OS_TV */
+-
++
++ NSMutableArray<UIBarButtonItem *> *subviewLeftItems = [NSMutableArray array];
++ NSMutableArray<UIBarButtonItem *> *subviewRightItems = [NSMutableArray array];
+ for (RNSScreenStackHeaderSubview *subview in config.reactSubviews) {
+ // This code should be kept in sync on Fabric with analogous switch statement in
+ // `- [RNSScreenStackHeaderConfig replaceNavigationBarViewsWithSnapshotOfSubview:]` method.
+ switch (subview.type) {
+ case RNSScreenStackHeaderSubviewTypeLeft: {
+- NSArray<UIBarButtonItem *> *currentItems = navitem.leftBarButtonItems ?: @[];
+- NSMutableArray<UIBarButtonItem *> *mutableItems = [currentItems mutableCopy];
+- [mutableItems addObject:[subview getUIBarButtonItem]];
+- navitem.leftBarButtonItems = mutableItems;
++ [subviewLeftItems addObject:[subview getUIBarButtonItem]];