         guard !isAnimatingSearchBarState else {
             return false
         }
-        setSearchVisible(true, animated: shouldAnimateSearchBar)
+        if shouldSetSearchVisible {
+            setSearchVisible(true, animated: shouldAnimateSearchBar)
+        }
         return true
     }
 

        
        if didClickSearchButton {
            didClickSearchButton = false
        } else {
            setSearchVisible(false, animated: shouldAnimateSearchBar)
        }
        

    
    override func viewDidLoad() {
        super.viewDidLoad()
        navigationBar.displayType = displayType
        title = CommonStrings.searchTitle
        if !areRecentSearchesEnabled, shouldSetTitleViewWhenRecentSearchesAreDisabled {
            navigationItem.titleView = UIView()
        }
        navigationBar.isTitleShrinkingEnabled = true
