Browse Source

not creating or destroying view in the viewPager until we have lifecycle events

Rotem M 8 years ago
parent
commit
a8cf580bff

+ 1
- 1
android/app/src/main/java/com/reactnativenavigation/params/ScreenParams.java View File

@@ -14,7 +14,7 @@ public class ScreenParams {
14 14
     //    public String tabLabel; TODO when tabs are supported move to TabParams
15 15
     //    public Drawable tabIcon;
16 16
 
17
-    // TODO navigationParams should be a terminated. destroyed. annihilated. disintegrated. banished from existence.
17
+    // TODO navigationParams should be a terminated. destroyed. annihilated. disintegrated. banished from existence. + abolished, eradicated, exterminated...
18 18
     public String screenInstanceId;
19 19
     public String navigatorEventId;
20 20
     public Bundle navigationParams;

+ 3
- 1
android/app/src/main/java/com/reactnativenavigation/screens/TabbedScreen.java View File

@@ -8,6 +8,7 @@ import android.support.v4.view.ViewPager;
8 8
 import android.view.View;
9 9
 import android.view.ViewGroup;
10 10
 
11
+import com.reactnativenavigation.NavigationApplication;
11 12
 import com.reactnativenavigation.params.ScreenParams;
12 13
 import com.reactnativenavigation.params.TopTabParams;
13 14
 import com.reactnativenavigation.views.ContentView;
@@ -32,6 +33,7 @@ public class TabbedScreen extends Screen {
32 33
         TabLayout tabLayout = topBar.initTabs();
33 34
         contentViews = new ArrayList<>();
34 35
         viewPager = new ViewPager(getContext());
36
+        viewPager.setOffscreenPageLimit(99);
35 37
         addView(viewPager);
36 38
 
37 39
         for (TopTabParams topTabParam : screenParams.topTabParams) {
@@ -93,7 +95,7 @@ public class TabbedScreen extends Screen {
93 95
 
94 96
         @Override
95 97
         public void destroyItem(ViewGroup container, int position, Object view) {
96
-            container.removeView((View) view);
98
+
97 99
         }
98 100
 
99 101
         @Override