Browse Source

Top tabs android2 (#2346)

* Restructure TopTabsLayout

* Refactor Containers

* Consolidate view creators. For some reason we had double abstraction layer and had creators invoking creators
* Rename ContainerView to ContainerLayout

* fix test
Guy Carmeli 6 years ago
parent
commit
c50f7752e8
No account linked to committer's email address
20 changed files with 147 additions and 83 deletions
  1. 9
    13
      lib/android/app/src/main/java/com/reactnativenavigation/parse/LayoutFactory.java
  2. 3
    3
      lib/android/app/src/main/java/com/reactnativenavigation/presentation/OptionsPresenter.java
  3. 3
    3
      lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/ContainerViewController.java
  4. 0
    25
      lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/toptabs/TopTabController.java
  5. 7
    1
      lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/toptabs/TopTabsController.java
  6. 2
    0
      lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/toptabs/TopTabsViewPager.java
  7. 7
    0
      lib/android/app/src/main/java/com/reactnativenavigation/views/Container.java
  8. 4
    3
      lib/android/app/src/main/java/com/reactnativenavigation/views/ContainerLayout.java
  9. 7
    4
      lib/android/app/src/main/java/com/reactnativenavigation/views/ContainerViewCreator.java
  10. 0
    4
      lib/android/app/src/main/java/com/reactnativenavigation/views/TopTab.java
  11. 9
    5
      lib/android/app/src/main/java/com/reactnativenavigation/views/TopTabCreator.java
  12. 30
    0
      lib/android/app/src/main/java/com/reactnativenavigation/views/TopTabsLayout.java
  13. 1
    2
      lib/android/app/src/test/java/com/reactnativenavigation/mocks/SimpleContainerViewController.java
  14. 9
    4
      lib/android/app/src/test/java/com/reactnativenavigation/mocks/TestContainerLayout.java
  15. 1
    1
      lib/android/app/src/test/java/com/reactnativenavigation/mocks/TestContainerViewCreator.java
  16. 2
    2
      lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/ContainerViewControllerTest.java
  17. 8
    10
      lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/OptionsApplyingTest.java
  18. 40
    0
      playground/src/containers/TopTabScreen.js
  19. 3
    3
      playground/src/containers/WelcomeScreen.js
  20. 2
    0
      playground/src/containers/index.js

+ 9
- 13
lib/android/app/src/main/java/com/reactnativenavigation/parse/LayoutFactory.java View File

@@ -10,7 +10,6 @@ import com.reactnativenavigation.viewcontrollers.SideMenuController;
10 10
 import com.reactnativenavigation.viewcontrollers.StackController;
11 11
 import com.reactnativenavigation.viewcontrollers.ViewController;
12 12
 import com.reactnativenavigation.viewcontrollers.overlay.DialogViewController;
13
-import com.reactnativenavigation.viewcontrollers.toptabs.TopTabController;
14 13
 import com.reactnativenavigation.viewcontrollers.toptabs.TopTabsController;
15 14
 import com.reactnativenavigation.views.ContainerViewCreator;
16 15
 import com.reactnativenavigation.views.TopTabCreator;
@@ -33,7 +32,7 @@ public class LayoutFactory {
33 32
 	public ViewController create(final LayoutNode node) {
34 33
 		switch (node.type) {
35 34
 			case Container:
36
-				return createContainer(node);
35
+				return createContainer(node, new ContainerViewCreator(reactInstanceManager));
37 36
 			case ContainerStack:
38 37
 				return createContainerStack(node);
39 38
 			case BottomTabs:
@@ -51,7 +50,7 @@ public class LayoutFactory {
51 50
             case TopTabsContainer:
52 51
                 return createTopTabsContainer(node);
53 52
             case TopTab:
54
-                return createTopTabContainer(node);
53
+                return createContainer(node, new TopTabCreator(reactInstanceManager));
55 54
 			default:
56 55
 				throw new IllegalArgumentException("Invalid node type: " + node.type);
57 56
 		}
@@ -90,11 +89,16 @@ public class LayoutFactory {
90 89
 		return create(node.children.get(0));
91 90
 	}
92 91
 
93
-	private ViewController createContainer(LayoutNode node) {
92
+	private ViewController createContainer(LayoutNode node, ContainerViewController.ReactViewCreator reactViewCreator) {
94 93
 		String id = node.id;
95 94
 		String name = node.data.optString("name");
96 95
 		NavigationOptions navigationOptions = NavigationOptions.parse(node.data.optJSONObject("navigationOptions"), defaultOptions);
97
-		return new ContainerViewController(activity, id, name, new ContainerViewCreator(new ReactContainerViewCreator(reactInstanceManager)), navigationOptions);
96
+		return new ContainerViewController(activity,
97
+                id,
98
+                name,
99
+                reactViewCreator,
100
+                navigationOptions
101
+        );
98 102
 	}
99 103
 
100 104
 	private ViewController createContainerStack(LayoutNode node) {
@@ -129,12 +133,4 @@ public class LayoutFactory {
129 133
         }
130 134
         return new TopTabsController(activity, node.id, tabs);
131 135
     }
132
-
133
-    private TopTabController createTopTabContainer(LayoutNode node) {
134
-        String name = node.data.optString("name");
135
-        return new TopTabController(activity,
136
-                node.id,
137
-                name,
138
-                new TopTabCreator(new ReactContainerViewCreator(reactInstanceManager)));
139
-    }
140 136
 }

+ 3
- 3
lib/android/app/src/main/java/com/reactnativenavigation/presentation/OptionsPresenter.java View File

@@ -8,7 +8,7 @@ import com.reactnativenavigation.parse.TopBarOptions;
8 8
 import com.reactnativenavigation.parse.TopTabsOptions;
9 9
 import com.reactnativenavigation.utils.TypefaceLoader;
10 10
 import com.reactnativenavigation.viewcontrollers.ContainerViewController;
11
-import com.reactnativenavigation.views.ContainerView;
11
+import com.reactnativenavigation.views.ContainerLayout;
12 12
 
13 13
 public class OptionsPresenter {
14 14
 
@@ -47,7 +47,7 @@ public class OptionsPresenter {
47 47
 			return;
48 48
 		}
49 49
 		if (animated == NavigationOptions.BooleanOptions.True) {
50
-			ContainerView topBarContainerView = (ContainerView) controller.getContainerView();
50
+			ContainerLayout topBarContainerView = (ContainerLayout) controller.getContainerView();
51 51
 			animator.animateShowTopBar(controller.getTopBar(), topBarContainerView.getReactView().asView());
52 52
 		} else {
53 53
 			controller.getTopBar().setVisibility(View.VISIBLE);
@@ -59,7 +59,7 @@ public class OptionsPresenter {
59 59
 			return;
60 60
 		}
61 61
 		if (animated == NavigationOptions.BooleanOptions.True) {
62
-			ContainerView topBarContainerView = (ContainerView) controller.getContainerView();
62
+			ContainerLayout topBarContainerView = (ContainerLayout) controller.getContainerView();
63 63
 			animator.animateHideTopBar(controller.getTopBar(), topBarContainerView.getReactView().asView());
64 64
 		} else {
65 65
 			controller.getTopBar().setVisibility(View.GONE);

+ 3
- 3
lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/ContainerViewController.java View File

@@ -7,8 +7,8 @@ import android.view.View;
7 7
 import com.reactnativenavigation.parse.NavigationOptions;
8 8
 import com.reactnativenavigation.presentation.NavigationOptionsListener;
9 9
 import com.reactnativenavigation.presentation.OptionsPresenter;
10
+import com.reactnativenavigation.views.Container;
10 11
 import com.reactnativenavigation.views.TopBar;
11
-import com.reactnativenavigation.views.ContainerView;
12 12
 
13 13
 public class ContainerViewController extends ViewController implements NavigationOptionsListener {
14 14
 
@@ -96,8 +96,8 @@ public class ContainerViewController extends ViewController implements Navigatio
96 96
 	@Override
97 97
 	protected View createView() {
98 98
 		containerView = viewCreator.create(getActivity(), getId(), containerName);
99
-		if (containerView instanceof ContainerView) {
100
-			topBar = ((ContainerView) containerView).getTopBar();
99
+		if (containerView instanceof Container) {
100
+			topBar = ((Container) containerView).getTopBar();
101 101
 		}
102 102
 		return containerView.asView();
103 103
 	}

+ 0
- 25
lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/toptabs/TopTabController.java View File

@@ -1,25 +0,0 @@
1
-package com.reactnativenavigation.viewcontrollers.toptabs;
2
-
3
-import android.app.Activity;
4
-import android.support.annotation.NonNull;
5
-import android.view.ViewGroup;
6
-
7
-import com.reactnativenavigation.viewcontrollers.ViewController;
8
-import com.reactnativenavigation.views.TopTabCreator;
9
-
10
-public class TopTabController extends ViewController {
11
-    private String name;
12
-    private TopTabCreator topTabCreator;
13
-
14
-    public TopTabController(Activity activity, String id, String name, TopTabCreator topTabCreator) {
15
-        super(activity, id);
16
-        this.name = name;
17
-        this.topTabCreator = topTabCreator;
18
-    }
19
-
20
-    @NonNull
21
-    @Override
22
-    protected ViewGroup createView() {
23
-        return (ViewGroup) topTabCreator.create(getActivity(), getId(), name);
24
-    }
25
-}

+ 7
- 1
lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/toptabs/TopTabsController.java View File

@@ -6,6 +6,7 @@ import android.view.ViewGroup;
6 6
 
7 7
 import com.reactnativenavigation.viewcontrollers.ParentController;
8 8
 import com.reactnativenavigation.viewcontrollers.ViewController;
9
+import com.reactnativenavigation.views.TopTabsLayout;
9 10
 
10 11
 import java.util.Collection;
11 12
 import java.util.List;
@@ -22,7 +23,7 @@ public class TopTabsController extends ParentController {
22 23
     @NonNull
23 24
     @Override
24 25
     protected ViewGroup createView() {
25
-        return new TopTabsViewPager(getActivity(), tabs);
26
+        return new TopTabsLayout(getActivity(), tabs);
26 27
     }
27 28
 
28 29
     @NonNull
@@ -30,4 +31,9 @@ public class TopTabsController extends ParentController {
30 31
     public Collection<ViewController> getChildControllers() {
31 32
         return tabs;
32 33
     }
34
+
35
+    @Override
36
+    protected boolean isViewShown() {
37
+        return super.isViewShown();
38
+    }
33 39
 }

+ 2
- 0
lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/toptabs/TopTabsViewPager.java View File

@@ -1,5 +1,6 @@
1 1
 package com.reactnativenavigation.viewcontrollers.toptabs;
2 2
 
3
+import android.annotation.SuppressLint;
3 4
 import android.content.Context;
4 5
 import android.support.v4.view.ViewPager;
5 6
 import android.view.View;
@@ -12,6 +13,7 @@ import java.util.List;
12 13
 
13 14
 import static android.view.ViewGroup.LayoutParams.MATCH_PARENT;
14 15
 
16
+@SuppressLint("ViewConstructor")
15 17
 public class TopTabsViewPager extends ViewPager implements ContainerViewController.IReactView {
16 18
     private static final int OFFSCREEN_PAGE_LIMIT = 99;
17 19
     private final List<ViewController> tabs;

+ 7
- 0
lib/android/app/src/main/java/com/reactnativenavigation/views/Container.java View File

@@ -0,0 +1,7 @@
1
+package com.reactnativenavigation.views;
2
+
3
+import com.reactnativenavigation.viewcontrollers.ContainerViewController;
4
+
5
+public interface Container extends ContainerViewController.IReactView {
6
+    TopBar getTopBar();
7
+}

lib/android/app/src/main/java/com/reactnativenavigation/views/ContainerView.java → lib/android/app/src/main/java/com/reactnativenavigation/views/ContainerLayout.java View File

@@ -6,12 +6,12 @@ import android.widget.LinearLayout;
6 6
 
7 7
 import com.reactnativenavigation.viewcontrollers.ContainerViewController.IReactView;
8 8
 
9
-public class ContainerView extends LinearLayout implements IReactView {
9
+public class ContainerLayout extends LinearLayout implements Container {
10 10
 
11 11
 	private TopBar topBar;
12 12
 	private IReactView reactView;
13 13
 
14
-	public ContainerView(Context context, IReactView reactView) {
14
+	public ContainerLayout(Context context, IReactView reactView) {
15 15
 		super(context);
16 16
 		this.topBar = new TopBar(context);
17 17
 		this.reactView = reactView;
@@ -24,7 +24,7 @@ public class ContainerView extends LinearLayout implements IReactView {
24 24
 		addView(reactView.asView());
25 25
 	}
26 26
 
27
-	public ContainerView(Context context) {
27
+	public ContainerLayout(Context context) {
28 28
 		super(context);
29 29
 	}
30 30
 
@@ -53,6 +53,7 @@ public class ContainerView extends LinearLayout implements IReactView {
53 53
 		reactView.sendContainerStop();
54 54
 	}
55 55
 
56
+    @Override
56 57
 	public TopBar getTopBar() {
57 58
 		return topBar;
58 59
 	}

+ 7
- 4
lib/android/app/src/main/java/com/reactnativenavigation/views/ContainerViewCreator.java View File

@@ -2,18 +2,21 @@ package com.reactnativenavigation.views;
2 2
 
3 3
 import android.app.Activity;
4 4
 
5
+import com.facebook.react.ReactInstanceManager;
6
+import com.reactnativenavigation.react.ReactContainerViewCreator;
5 7
 import com.reactnativenavigation.viewcontrollers.ContainerViewController;
6 8
 
7 9
 public class ContainerViewCreator implements ContainerViewController.ReactViewCreator {
8 10
 
9
-	private ContainerViewController.ReactViewCreator creator;
11
+    private ReactInstanceManager instanceManager;
10 12
 
11
-	public ContainerViewCreator(ContainerViewController.ReactViewCreator creator) {
12
-		this.creator = creator;
13
+    public ContainerViewCreator(ReactInstanceManager instanceManager) {
14
+        this.instanceManager = instanceManager;
13 15
 	}
14 16
 
15 17
 	@Override
16 18
 	public ContainerViewController.IReactView create(Activity activity, String containerId, String containerName) {
17
-        return new ContainerView(activity, creator.create(activity, containerId, containerName));
19
+        ContainerViewController.IReactView reactView = new ReactContainerViewCreator(instanceManager).create(activity, containerId, containerName);
20
+        return new ContainerLayout(activity, reactView);
18 21
 	}
19 22
 }

+ 0
- 4
lib/android/app/src/main/java/com/reactnativenavigation/views/TopTab.java View File

@@ -48,8 +48,4 @@ public class TopTab extends FrameLayout implements IReactView {
48 48
 	public void sendContainerStop() {
49 49
 		reactView.sendContainerStop();
50 50
 	}
51
-
52
-	public IReactView getReactView() {
53
-		return reactView;
54
-	}
55 51
 }

+ 9
- 5
lib/android/app/src/main/java/com/reactnativenavigation/views/TopTabCreator.java View File

@@ -2,18 +2,22 @@ package com.reactnativenavigation.views;
2 2
 
3 3
 import android.app.Activity;
4 4
 
5
+import com.facebook.react.ReactInstanceManager;
6
+import com.reactnativenavigation.react.ReactContainerViewCreator;
5 7
 import com.reactnativenavigation.viewcontrollers.ContainerViewController;
6 8
 
7 9
 public class TopTabCreator implements ContainerViewController.ReactViewCreator {
8 10
 
9
-	private ContainerViewController.ReactViewCreator creator;
10 11
 
11
-	public TopTabCreator(ContainerViewController.ReactViewCreator creator) {
12
-		this.creator = creator;
13
-	}
12
+    private ReactInstanceManager instanceManager;
13
+
14
+    public TopTabCreator(ReactInstanceManager instanceManager) {
15
+        this.instanceManager = instanceManager;
16
+    }
14 17
 
15 18
 	@Override
16 19
 	public ContainerViewController.IReactView create(Activity activity, String containerId, String containerName) {
17
-        return new TopTab(activity, creator.create(activity, containerId, containerName));
20
+        ContainerViewController.IReactView reactView = new ReactContainerViewCreator(instanceManager).create(activity, containerId, containerName);
21
+        return new TopTab(activity, reactView);
18 22
 	}
19 23
 }

+ 30
- 0
lib/android/app/src/main/java/com/reactnativenavigation/views/TopTabsLayout.java View File

@@ -0,0 +1,30 @@
1
+package com.reactnativenavigation.views;
2
+
3
+import android.annotation.SuppressLint;
4
+import android.content.Context;
5
+import android.widget.LinearLayout;
6
+
7
+import com.reactnativenavigation.viewcontrollers.ViewController;
8
+import com.reactnativenavigation.viewcontrollers.toptabs.TopTabsViewPager;
9
+
10
+import java.util.List;
11
+
12
+@SuppressLint("ViewConstructor")
13
+public class TopTabsLayout extends LinearLayout {
14
+
15
+    private TopBar topBar;
16
+    private TopTabsViewPager viewPager;
17
+
18
+    public TopTabsLayout(Context context, List<ViewController> tabs) {
19
+        super(context);
20
+        topBar = new TopBar(context);
21
+        viewPager = new TopTabsViewPager(context, tabs);
22
+        initViews();
23
+    }
24
+
25
+    private void initViews() {
26
+        setOrientation(VERTICAL);
27
+        addView(topBar);
28
+        addView(viewPager);
29
+    }
30
+}

+ 1
- 2
lib/android/app/src/test/java/com/reactnativenavigation/mocks/SimpleContainerViewController.java View File

@@ -4,10 +4,9 @@ import android.app.Activity;
4 4
 
5 5
 import com.reactnativenavigation.parse.NavigationOptions;
6 6
 import com.reactnativenavigation.viewcontrollers.ContainerViewController;
7
-import com.reactnativenavigation.views.ContainerViewCreator;
8 7
 
9 8
 public class SimpleContainerViewController extends ContainerViewController {
10 9
 	public SimpleContainerViewController(final Activity activity, final String id) {
11
-		super(activity, id, "theContainerName", new ContainerViewCreator(new TestContainerViewCreator()), new NavigationOptions());
10
+		super(activity, id, "theContainerName", new TestContainerViewCreator(), new NavigationOptions());
12 11
 	}
13 12
 }

lib/android/app/src/test/java/com/reactnativenavigation/mocks/TestContainerView.java → lib/android/app/src/test/java/com/reactnativenavigation/mocks/TestContainerLayout.java View File

@@ -4,19 +4,19 @@ import android.content.Context;
4 4
 import android.view.View;
5 5
 
6 6
 import com.reactnativenavigation.viewcontrollers.ContainerViewController;
7
+import com.reactnativenavigation.views.Container;
7 8
 import com.reactnativenavigation.views.TopBar;
8 9
 
9
-public class TestContainerView extends View implements ContainerViewController.IReactView {
10
+public class TestContainerLayout extends View implements ContainerViewController.IReactView, Container {
10 11
 
11 12
 	private TopBar topBar;
12 13
 
13
-	public TestContainerView(final Context context) {
14
+	public TestContainerLayout(final Context context) {
14 15
 		super(context);
15 16
 		topBar = new TopBar(context);
16
-
17 17
 	}
18 18
 
19
-	@Override
19
+    @Override
20 20
 	public boolean isReady() {
21 21
 		return false;
22 22
 	}
@@ -37,4 +37,9 @@ public class TestContainerView extends View implements ContainerViewController.I
37 37
 	@Override
38 38
 	public void sendContainerStop() {
39 39
 	}
40
+
41
+    @Override
42
+    public TopBar getTopBar() {
43
+        return topBar;
44
+    }
40 45
 }

+ 1
- 1
lib/android/app/src/test/java/com/reactnativenavigation/mocks/TestContainerViewCreator.java View File

@@ -8,6 +8,6 @@ import com.reactnativenavigation.viewcontrollers.ContainerViewController.ReactVi
8 8
 public class TestContainerViewCreator implements ReactViewCreator {
9 9
 	@Override
10 10
 	public ContainerViewController.IReactView create(final Activity activity, final String containerId, final String containerName) {
11
-		return new TestContainerView(activity);
11
+		return new TestContainerLayout(activity);
12 12
 	}
13 13
 }

+ 2
- 2
lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/ContainerViewControllerTest.java View File

@@ -3,7 +3,7 @@ package com.reactnativenavigation.viewcontrollers;
3 3
 import android.app.Activity;
4 4
 
5 5
 import com.reactnativenavigation.BaseTest;
6
-import com.reactnativenavigation.mocks.TestContainerView;
6
+import com.reactnativenavigation.mocks.TestContainerLayout;
7 7
 import com.reactnativenavigation.parse.NavigationOptions;
8 8
 
9 9
 import org.junit.Test;
@@ -22,7 +22,7 @@ public class ContainerViewControllerTest extends BaseTest {
22 22
 	public void beforeEach() {
23 23
 		super.beforeEach();
24 24
 		Activity activity = newActivity();
25
-		view = spy(new TestContainerView(activity));
25
+		view = spy(new TestContainerLayout(activity));
26 26
 		uut = new ContainerViewController(activity, "containerId1", "containerName", new ContainerViewController.ReactViewCreator() {
27 27
 			@Override
28 28
 			public ContainerViewController.IReactView create(final Activity activity1, final String containerId, final String containerName) {

+ 8
- 10
lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/OptionsApplyingTest.java View File

@@ -6,15 +6,13 @@ import android.graphics.drawable.ColorDrawable;
6 6
 import android.view.View;
7 7
 
8 8
 import com.reactnativenavigation.BaseTest;
9
-import com.reactnativenavigation.mocks.TestContainerView;
9
+import com.reactnativenavigation.mocks.TestContainerLayout;
10 10
 import com.reactnativenavigation.parse.NavigationOptions;
11
-import com.reactnativenavigation.views.ContainerViewCreator;
12 11
 
13 12
 import org.junit.Test;
14 13
 
15 14
 import static org.assertj.core.api.Java6Assertions.assertThat;
16 15
 import static org.mockito.Mockito.spy;
17
-import static org.mockito.Mockito.verify;
18 16
 
19 17
 public class OptionsApplyingTest extends BaseTest {
20 18
 	private Activity activity;
@@ -27,14 +25,14 @@ public class OptionsApplyingTest extends BaseTest {
27 25
 		super.beforeEach();
28 26
 		activity = newActivity();
29 27
 		initialNavigationOptions = new NavigationOptions();
30
-		view = spy(new TestContainerView(activity));
28
+		view = spy(new TestContainerLayout(activity));
31 29
 		uut = new ContainerViewController(activity, "containerId1", "containerName",
32
-				new ContainerViewCreator(new ContainerViewController.ReactViewCreator() {
33
-					@Override
34
-					public ContainerViewController.IReactView create(final Activity activity1, final String containerId, final String containerName) {
35
-						return view;
36
-					}
37
-				}), initialNavigationOptions);
30
+                new ContainerViewController.ReactViewCreator() {
31
+                    @Override
32
+                    public ContainerViewController.IReactView create(final Activity activity1, final String containerId, final String containerName) {
33
+                        return view;
34
+                    }
35
+                }, initialNavigationOptions);
38 36
 	}
39 37
 
40 38
 	@Test

+ 40
- 0
playground/src/containers/TopTabScreen.js View File

@@ -0,0 +1,40 @@
1
+const React = require('react');
2
+const { PureComponent } = require('react');
3
+const { View, Text } = require('react-native');
4
+
5
+class TopTabScreen extends PureComponent {
6
+  render() {
7
+    return (
8
+      <View style={styles.root}>
9
+        <Text style={styles.h1}>{this.props.text || 'Top Tab Screen'}</Text>
10
+        <Text style={styles.footer}>{`this.props.containerId = ${this.props.containerId}`}</Text>
11
+      </View>
12
+    );
13
+  }
14
+}
15
+
16
+module.exports = TopTabScreen;
17
+
18
+const styles = {
19
+  root: {
20
+    flexGrow: 1,
21
+    justifyContent: 'center',
22
+    alignItems: 'center',
23
+    backgroundColor: '#f5fcff'
24
+  },
25
+  h1: {
26
+    fontSize: 24,
27
+    textAlign: 'center',
28
+    margin: 10
29
+  },
30
+  h2: {
31
+    fontSize: 12,
32
+    textAlign: 'center',
33
+    margin: 10
34
+  },
35
+  footer: {
36
+    fontSize: 10,
37
+    color: '#888',
38
+    marginTop: 10
39
+  }
40
+};

+ 3
- 3
playground/src/containers/WelcomeScreen.js View File

@@ -152,7 +152,7 @@ class WelcomeScreen extends Component {
152 152
       topTabs: [
153 153
         {
154 154
           container: {
155
-            name: 'navigation.playground.TextScreen',
155
+            name: 'navigation.playground.TopTabScreen',
156 156
             passProps: {
157 157
               text: 'This is top tab 1'
158 158
             }
@@ -160,7 +160,7 @@ class WelcomeScreen extends Component {
160 160
         },
161 161
         {
162 162
           container: {
163
-            name: 'navigation.playground.TextScreen',
163
+            name: 'navigation.playground.TopTabScreen',
164 164
             passProps: {
165 165
               text: 'This is top tab 2'
166 166
             }
@@ -168,7 +168,7 @@ class WelcomeScreen extends Component {
168 168
         },
169 169
         {
170 170
           container: {
171
-            name: 'navigation.playground.TextScreen',
171
+            name: 'navigation.playground.TopTabScreen',
172 172
             passProps: {
173 173
               text: 'This is top tab 3'
174 174
             }

+ 2
- 0
playground/src/containers/index.js View File

@@ -13,6 +13,7 @@ const CustomTransitionDestination = require('./CustomTransitionDestination');
13 13
 const CustomDialog = require('./CustomDialog');
14 14
 const BandHandlerScreen = require('./BackHandlerScreen');
15 15
 const SideMenuScreen = require('./SideMenuScreen');
16
+const TopTabScreen = require('./TopTabScreen');
16 17
 
17 18
 function registerContainers() {
18 19
   Navigation.registerContainer(`navigation.playground.CustomTransitionDestination`, () => CustomTransitionDestination);
@@ -29,6 +30,7 @@ function registerContainers() {
29 30
   Navigation.registerContainer('navigation.playground.CustomDialog', () => CustomDialog);
30 31
   Navigation.registerContainer('navigation.playground.BackHandlerScreen', () => BandHandlerScreen);
31 32
   Navigation.registerContainer('navigation.playground.SideMenuScreen', () => SideMenuScreen);
33
+  Navigation.registerContainer('navigation.playground.TopTabScreen', () => TopTabScreen);
32 34
 }
33 35
 
34 36
 module.exports = {