Skip to content

Commit d39b7e1

Browse files
authored
Skip UINavigationItemSearchBarPlacementIntegrated when not available in OS (#8211)
1 parent b3e0ea9 commit d39b7e1

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

ios/UIViewController+RNNOptions.mm

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ - (void)setSearchBarWithOptions:(NSString *)placeholder
5252
if (@available(iOS 13.0, *)) {
5353
search.searchBar.searchTextField.backgroundColor = backgroundColor;
5454
}
55-
55+
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 260000
5656
if (@available(iOS 26.0, *)) {
5757
if (placement == SearchBarPlacementIntegrated) {
5858
if (focus) {
@@ -64,6 +64,7 @@ - (void)setSearchBarWithOptions:(NSString *)placeholder
6464
self.navigationItem.preferredSearchBarPlacement = UINavigationItemSearchBarPlacementStacked;
6565
}
6666
}
67+
#endif
6768

6869
self.navigationItem.searchController = search;
6970
[self.navigationItem setHidesSearchBarWhenScrolling:hideOnScroll];
@@ -79,6 +80,7 @@ - (void)setSearchBarWithOptions:(NSString *)placeholder
7980
});
8081
}
8182
} else {
83+
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 260000
8284
// Update placement on existing searchController (iOS 26+)
8385
if (@available(iOS 26.0, *)) {
8486
if (placement == SearchBarPlacementIntegrated) {
@@ -91,6 +93,7 @@ - (void)setSearchBarWithOptions:(NSString *)placeholder
9193
self.navigationItem.preferredSearchBarPlacement = UINavigationItemSearchBarPlacementStacked;
9294
}
9395
}
96+
#endif
9497
}
9598
}
9699

0 commit comments

Comments
 (0)