Fragment return 0 bounds

Summary: In a previous diff the Bounds was made mandatory and the fragment bounds was set to be the same as the underlying view. this caused the offset to be doubled since the underlying view would also apply that offset. Since fragments dont contribute to layout and are purely for lifecycle we can set it to 0 and handle it on the desktop

Reviewed By: lblasa

Differential Revision: D41304500

fbshipit-source-id: 39591b3ef0c746bd7a4ec8d61fed623cc7c94944
This commit is contained in:
Luke De Feo
2022-11-16 10:38:23 -08:00
committed by Facebook GitHub Bot
parent 1d920efe10
commit f6060d0046
2 changed files with 2 additions and 4 deletions

View File

@@ -27,8 +27,7 @@ class FragmentFrameworkDescriptor(val register: DescriptorRegister) :
return node.javaClass.simpleName
}
override fun onGetBounds(node: android.app.Fragment): Bounds? =
node.view?.let { register.descriptorForClassUnsafe(it.javaClass).getBounds(it) }
override fun onGetBounds(node: android.app.Fragment): Bounds? = Bounds(0, 0, 0, 0)
override fun onGetChildren(node: android.app.Fragment): List<Any> =
node.view?.let { view -> listOf(view) } ?: listOf()

View File

@@ -26,8 +26,7 @@ class FragmentSupportDescriptor(val register: DescriptorRegister) :
return node.javaClass.simpleName
}
override fun onGetBounds(node: Fragment): Bounds? =
node.view?.let { register.descriptorForClassUnsafe(it.javaClass).getBounds(it) }
override fun onGetBounds(node: Fragment): Bounds = Bounds(0, 0, 0, 0)
override fun onGetChildren(node: androidx.fragment.app.Fragment): List<Any> =
node.view?.let { view -> listOf(view) } ?: listOf()