title: ViewPager2 within Fragment does not display Fragments
body: <p>I'm having an issue with setting up ViewPager2 within a Fragment. I've done everything correctly as far as I can tell, but the Fragments I want to display in the hosting fragment do not display at all. Here is my adapter:</p>
  <pre><code>class RepsViewPagerAdapter(supportFragmentManager: FragmentManager, lifecycle: Lifecycle):
      FragmentStateAdapter(supportFragmentManager,lifecycle) {
  
      private val fragments = arrayListOf(NationalRepsFragment(),StateRepsFragment(),CityRepsFragment())
      val titles = arrayListOf(&quot;National&quot;,&quot;State&quot;,&quot;City&quot;)
  
      override fun getItemCount(): Int {
          return fragments.size
      }
  
      override fun createFragment(position: Int): Fragment {
          Log.i(&quot;MYTAG&quot;,fragments[position].toString())
          return fragments[position]
      }
  </code></pre>
  <p>I set up the ViewPager2 in a method in <code>onViewCreated()</code> that looks like this:</p>
  <pre><code>private fun setUpTabs() {
          val adapter = RepsViewPagerAdapter(childFragmentManager,lifecycle)
          pager.adapter = adapter
          TabLayoutMediator(tabs, pager, object : TabLayoutMediator.TabConfigurationStrategy {
              override fun onConfigureTab(tab: TabLayout.Tab, position: Int) {
                  tab.text = adapter.titles[position]
              }
          }).attach()
      }
  </code></pre>
  <p>Things I have tried include:</p>
  <ul>
  <li><p>Changing <code>FragmentManager</code> of the adapter to <code>supportFragmentManger</code> and <code>parentFragmentManager</code></p>
  </li>
  <li><p>Changing the constructor parameters of <code>FragmentStateAdaper</code> to <code>FragmentActivity</code> and creating an instance in host Fragment with <code>requireActivity()</code></p>
  </li>
  <li><p>Providing instances of the Fragments I want to display in the hosting Fragment</p>
  </li>
  <li><p>Logging the result of <code>fragments[position]</code> when <code>createFragment()</code> is called. This confirmed that <code>createFragment</code> is being called when the tabs are clicked</p>
  </li>
  </ul>
  <p><a href="https://i.stack.imgur.com/9yDI2.png" rel="nofollow noreferrer">Picture of host Fragment with tabs not displaying child Fragments (REPS FRAGMENT is the host layout)</a></p>