From 5f9f061f3135ebfa8863c44c2448105221df9c27 Mon Sep 17 00:00:00 2001 From: Janic Duplessis Date: Mon, 29 Jul 2024 07:58:53 -0400 Subject: [PATCH] fix(iOS): update HeaderConfig view controller after unmounting subviews (#2230) ## Description When using a header left view and then removing it the default back button doesn't reappear on new arch. This is because we do not call `updateViewControllerIfNeeded` when removing views. ## Changes Call `updateViewControllerIfNeeded` in `unmountChildComponentView`. ## Test code and steps to reproduce In the FabricExample HeaderOptions example: - Open Header item setting - Choose left - Choose right - See the back button is gone. image image image When toggling state the default back button doesn't reappear. ## Checklist - [x] Included code example that can be used to test this change - [x] Ensured that CI passes --- ios/RNSScreenStackHeaderConfig.mm | 1 + 1 file changed, 1 insertion(+) diff --git a/ios/RNSScreenStackHeaderConfig.mm b/ios/RNSScreenStackHeaderConfig.mm index ac0c006fbd..de7f368403 100644 --- a/ios/RNSScreenStackHeaderConfig.mm +++ b/ios/RNSScreenStackHeaderConfig.mm @@ -762,6 +762,7 @@ - (void)unmountChildComponentView:(UIView *)childCompo [self replaceNavigationBarViewsWithSnapshotOfSubview:(RNSScreenStackHeaderSubview *)childComponentView]; [_reactSubviews removeObject:(RNSScreenStackHeaderSubview *)childComponentView]; [childComponentView removeFromSuperview]; + [self updateViewControllerIfNeeded]; } - (void)replaceNavigationBarViewsWithSnapshotOfSubview:(RNSScreenStackHeaderSubview *)childComponentView