Override bounds for view pager
Summary: For view pager we just want to draw the content in the center Reviewed By: lblasa Differential Revision: D40478266 fbshipit-source-id: 4fac7e897a0569fed59ef5810ba15300ebe87b5d
This commit is contained in:
committed by
Facebook GitHub Bot
parent
62167bb69c
commit
7c3e28272b
@@ -21,6 +21,7 @@ import android.view.ViewGroup
|
||||
import android.widget.FrameLayout
|
||||
import android.widget.LinearLayout
|
||||
import androidx.core.widget.NestedScrollView
|
||||
import androidx.viewpager.widget.ViewPager
|
||||
import com.facebook.flipper.plugins.uidebugger.common.*
|
||||
import com.facebook.flipper.plugins.uidebugger.common.BitmapPool
|
||||
import com.facebook.flipper.plugins.uidebugger.common.EnumMapping
|
||||
@@ -35,13 +36,18 @@ object ViewDescriptor : ChainedDescriptor<View>() {
|
||||
|
||||
override fun onGetBounds(node: View): Bounds {
|
||||
|
||||
if (node.parent is ViewPager) {
|
||||
// override
|
||||
return Bounds(0, 0, node.width, node.height)
|
||||
}
|
||||
|
||||
var offsetX = 0
|
||||
var offsetY = 0
|
||||
if (node.parent is NestedScrollView) {
|
||||
/**
|
||||
* when a node is a child of nested scroll view android does not adjust the left/ top as the
|
||||
* view scrolls. This seems to be unique to nested scroll view so we have this trick to find
|
||||
* its
|
||||
* its actual position.
|
||||
*/
|
||||
val localVisible = Rect()
|
||||
node.getLocalVisibleRect(localVisible)
|
||||
|
||||
Reference in New Issue
Block a user