File tree Expand file tree Collapse file tree 1 file changed +1
-13
lines changed
android/src/main/java/com/reactnativecommunity/viewpager Expand file tree Collapse file tree 1 file changed +1
-13
lines changed Original file line number Diff line number Diff line change @@ -36,24 +36,11 @@ private class Adapter extends PagerAdapter {
36
36
void addView (View child , int index ) {
37
37
mViews .add (index , child );
38
38
notifyDataSetChanged ();
39
- // This will prevent view pager from detaching views for pages that are not currently selected
40
- // We need to do that since {@link ViewPager} relies on layout passes to position those views
41
- // in a right way (also thanks to {@link ReactViewPagerManager#needsCustomLayoutForChildren}
42
- // returning {@code true}). Currently we only call {@link View#measure} and
43
- // {@link View#layout} after yoga step.
44
-
45
- // TODO(7323049): Remove this workaround once we figure out a way to re-layout some views on
46
- // request
47
- setOffscreenPageLimit (mViews .size ());
48
39
}
49
40
50
41
void removeViewAt (int index ) {
51
42
mViews .remove (index );
52
43
notifyDataSetChanged ();
53
-
54
- // TODO(7323049): Remove this workaround once we figure out a way to re-layout some views on
55
- // request
56
- setOffscreenPageLimit (mViews .size ());
57
44
}
58
45
59
46
/**
@@ -102,6 +89,7 @@ public int getItemPosition(Object object) {
102
89
public Object instantiateItem (ViewGroup container , int position ) {
103
90
View view = mViews .get (position );
104
91
container .addView (view , 0 , generateDefaultLayoutParams ());
92
+ post (measureAndLayout );
105
93
return view ;
106
94
}
107
95
You can’t perform that action at this time.
0 commit comments