File tree Expand file tree Collapse file tree
ReactAndroid/src/main/java/com/facebook/react/views/viewpager Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -36,24 +36,11 @@ private class Adapter extends PagerAdapter {
3636 void addView (View child , int index ) {
3737 mViews .add (index , child );
3838 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 ());
4839 }
4940
5041 void removeViewAt (int index ) {
5142 mViews .remove (index );
5243 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 ());
5744 }
5845
5946 /**
@@ -102,6 +89,7 @@ public int getItemPosition(Object object) {
10289 public Object instantiateItem (ViewGroup container , int position ) {
10390 View view = mViews .get (position );
10491 container .addView (view , 0 , generateDefaultLayoutParams ());
92+ post (measureAndLayout );
10593 return view ;
10694 }
10795
You can’t perform that action at this time.
0 commit comments