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
     //    public String tabLabel; TODO when tabs are supported move to TabParams
14
     //    public String tabLabel; TODO when tabs are supported move to TabParams
15
     //    public Drawable tabIcon;
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
     public String screenInstanceId;
18
     public String screenInstanceId;
19
     public String navigatorEventId;
19
     public String navigatorEventId;
20
     public Bundle navigationParams;
20
     public Bundle navigationParams;

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

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