File tree 1 file changed +11
-4
lines changed
android/src/main/java/com/reactnativepagerview
1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -69,12 +69,19 @@ object PagerViewViewManagerImpl {
69
69
fun removeViewAt (parent : NestedScrollableHost , index : Int ) {
70
70
val pager = getViewPager(parent)
71
71
val adapter = pager.adapter as ViewPagerAdapter ?
72
+
73
+ val child = adapter?.getChildAt(index)
74
+
75
+ if (child != null && child.parent != null ) {
76
+ (child.parent as ? ViewGroup )?.removeView(child)
77
+ }
78
+
72
79
adapter?.removeChildAt(index)
73
80
74
- // Required so ViewPager actually animates the removed view right away (otherwise
75
- // a white screen is shown until the next user interaction).
76
- // https://github.com/facebook/react-native/issues/17968#issuecomment-697136929
77
- refreshViewChildrenLayout(pager)
81
+ pager.post {
82
+ pager.invalidate()
83
+ pager.requestLayout()
84
+ }
78
85
}
79
86
80
87
fun needsCustomLayoutForChildren (): Boolean {
You can’t perform that action at this time.
0 commit comments