'How can i show another framents with bottom navigation view

My task now is have active bottom navigation view and toolbar which has buttons when first of buttons open new fragment and second which return to initial fragment.

i had base fragmentlayout and bottom navigation view. I found way change fragment without bottom navigation view with supportFragmentManager. But after replace() my bottom navigation view stops work. How can i fix this?

if you didnt understand i attach photos tool bar buttons opens and returns fragments without bottom navigation view

Now my main activity look like

override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        binding = ActivityMainBinding.inflate(layoutInflater)
        setContentView(binding.root)

        val viewModel = ViewModelProvider(this).get(MainViewModel::class.java)

        val navHostFragment = supportFragmentManager.findFragmentById(binding.fragmentContainerView.id)
                as NavHostFragment

        binding.bnvBase.setupWithNavController(navHostFragment.navController)

         binding.toolbar.ivBack.setOnClickListener {
             supportFragmentManager.commit {
                 replace(R.id.fragmentContainerView, PokemonCardsFragment())
                 setReorderingAllowed(true)
                 addToBackStack(null)
             }
         }

         binding.toolbar.searchButton.setOnClickListener {
             supportFragmentManager.commit {
                 replace(R.id.fragmentContainerView, SearchPokemonCardsFragment(
                     binding.toolbar.searchSrcText.text.toString()
                 ))
                 setReorderingAllowed(true)
                 addToBackStack(null)
             }
         }
    }


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source