Browse Source

rename container->component android

Daniel Zlotin 7 years ago
parent
commit
b2ade91ee7
43 changed files with 313 additions and 313 deletions
  1. 27
    27
      lib/android/app/src/main/java/com/reactnativenavigation/anim/StackAnimator.java
  2. 18
    18
      lib/android/app/src/main/java/com/reactnativenavigation/parse/LayoutFactory.java
  3. 2
    2
      lib/android/app/src/main/java/com/reactnativenavigation/parse/LayoutNode.java
  4. 3
    3
      lib/android/app/src/main/java/com/reactnativenavigation/parse/OverlayOptions.java
  5. 7
    7
      lib/android/app/src/main/java/com/reactnativenavigation/react/NavigationEvent.java
  6. 12
    12
      lib/android/app/src/main/java/com/reactnativenavigation/react/NavigationModule.java
  7. 20
    0
      lib/android/app/src/main/java/com/reactnativenavigation/react/ReactComponentViewCreator.java
  8. 0
    20
      lib/android/app/src/main/java/com/reactnativenavigation/react/ReactContainerViewCreator.java
  9. 14
    14
      lib/android/app/src/main/java/com/reactnativenavigation/react/ReactView.java
  10. 20
    20
      lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/ComponentViewController.java
  11. 7
    7
      lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/ModalStack.java
  12. 8
    8
      lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/Navigator.java
  13. 1
    1
      lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/overlay/CustomOverlay.java
  14. 6
    6
      lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/overlay/DialogViewController.java
  15. 8
    8
      lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/toptabs/TopTabController.java
  16. 1
    1
      lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/toptabs/TopTabsAdapter.java
  17. 3
    3
      lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/toptabs/TopTabsViewPager.java
  18. 1
    1
      lib/android/app/src/main/java/com/reactnativenavigation/views/Component.java
  19. 7
    7
      lib/android/app/src/main/java/com/reactnativenavigation/views/ComponentLayout.java
  20. 22
    0
      lib/android/app/src/main/java/com/reactnativenavigation/views/ComponentViewCreator.java
  21. 0
    22
      lib/android/app/src/main/java/com/reactnativenavigation/views/ContainerViewCreator.java
  22. 4
    4
      lib/android/app/src/main/java/com/reactnativenavigation/views/CustomDialog.java
  23. 6
    0
      lib/android/app/src/main/java/com/reactnativenavigation/views/ReactComponent.java
  24. 0
    6
      lib/android/app/src/main/java/com/reactnativenavigation/views/ReactContainer.java
  25. 5
    5
      lib/android/app/src/main/java/com/reactnativenavigation/views/TitleBarButton.java
  26. 5
    5
      lib/android/app/src/main/java/com/reactnativenavigation/views/TopBar.java
  27. 5
    5
      lib/android/app/src/main/java/com/reactnativenavigation/views/TopTab.java
  28. 5
    5
      lib/android/app/src/main/java/com/reactnativenavigation/views/TopTabCreator.java
  29. 1
    1
      lib/android/app/src/main/java/com/reactnativenavigation/views/TopTabsLayout.java
  30. 12
    0
      lib/android/app/src/test/java/com/reactnativenavigation/mocks/SimpleComponentViewController.java
  31. 0
    12
      lib/android/app/src/test/java/com/reactnativenavigation/mocks/SimpleContainerViewController.java
  32. 5
    5
      lib/android/app/src/test/java/com/reactnativenavigation/mocks/TestComponentLayout.java
  33. 5
    5
      lib/android/app/src/test/java/com/reactnativenavigation/mocks/TestComponentView.java
  34. 13
    0
      lib/android/app/src/test/java/com/reactnativenavigation/mocks/TestComponentViewCreator.java
  35. 0
    13
      lib/android/app/src/test/java/com/reactnativenavigation/mocks/TestContainerViewCreator.java
  36. 4
    4
      lib/android/app/src/test/java/com/reactnativenavigation/mocks/TopTabLayoutMock.java
  37. 7
    7
      lib/android/app/src/test/java/com/reactnativenavigation/parse/LayoutNodeParserTest.java
  38. 1
    1
      lib/android/app/src/test/java/com/reactnativenavigation/parse/NavigationOptionsTest.java
  39. 17
    17
      lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/ComponentViewControllerTest.java
  40. 6
    6
      lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/NavigatorTest.java
  41. 9
    9
      lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/OptionsApplyingTest.java
  42. 4
    4
      lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/TopTabControllerTest.java
  43. 12
    12
      lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/TopTabsViewControllerTest.java

+ 27
- 27
lib/android/app/src/main/java/com/reactnativenavigation/anim/StackAnimator.java View File

113
 		return metrics.heightPixels;
113
 		return metrics.heightPixels;
114
 	}
114
 	}
115
 
115
 
116
-	public void animateShowTopBar(final TopBar topBar, final View container) {
117
-		ValueAnimator containerHeightAnim = ValueAnimator.ofInt(container.getMeasuredHeight(), container.getMeasuredHeight() - topBar.getMeasuredHeight());
118
-		containerHeightAnim.setInterpolator(DECELERATE_INTERPOLATOR);
119
-		containerHeightAnim.setDuration(DURATION_TOPBAR);
120
-		containerHeightAnim.addUpdateListener(valueAnimator -> {
116
+	public void animateShowTopBar(final TopBar topBar, final View component) {
117
+		ValueAnimator componentHeightAnim = ValueAnimator.ofInt(component.getMeasuredHeight(), component.getMeasuredHeight() - topBar.getMeasuredHeight());
118
+		componentHeightAnim.setInterpolator(DECELERATE_INTERPOLATOR);
119
+		componentHeightAnim.setDuration(DURATION_TOPBAR);
120
+		componentHeightAnim.addUpdateListener(valueAnimator -> {
121
             int val = (Integer) valueAnimator.getAnimatedValue();
121
             int val = (Integer) valueAnimator.getAnimatedValue();
122
-			ViewGroup.LayoutParams layoutParams = container.getLayoutParams();
122
+			ViewGroup.LayoutParams layoutParams = component.getLayoutParams();
123
             layoutParams.height = val;
123
             layoutParams.height = val;
124
-            container.setLayoutParams(layoutParams);
124
+            component.setLayoutParams(layoutParams);
125
         });
125
         });
126
-		ObjectAnimator containerTransitionAnim = ObjectAnimator.ofFloat(container, View.TRANSLATION_Y, -1 * topBar.getMeasuredHeight(), 0);
127
-		containerTransitionAnim.setInterpolator(DECELERATE_INTERPOLATOR);
128
-		containerTransitionAnim.setDuration(DURATION_TOPBAR);
126
+		ObjectAnimator componentTransitionAnim = ObjectAnimator.ofFloat(component, View.TRANSLATION_Y, -1 * topBar.getMeasuredHeight(), 0);
127
+		componentTransitionAnim.setInterpolator(DECELERATE_INTERPOLATOR);
128
+		componentTransitionAnim.setDuration(DURATION_TOPBAR);
129
 
129
 
130
 		ObjectAnimator topbarAnim = ObjectAnimator.ofFloat(topBar, View.TRANSLATION_Y, -1 * topBar.getHeight(), 0);
130
 		ObjectAnimator topbarAnim = ObjectAnimator.ofFloat(topBar, View.TRANSLATION_Y, -1 * topBar.getHeight(), 0);
131
 		topbarAnim.setInterpolator(DECELERATE_INTERPOLATOR);
131
 		topbarAnim.setInterpolator(DECELERATE_INTERPOLATOR);
140
 
140
 
141
 			@Override
141
 			@Override
142
 			public void onAnimationEnd(Animator animation) {
142
 			public void onAnimationEnd(Animator animation) {
143
-                ViewGroup.LayoutParams layoutParams = container.getLayoutParams();
143
+                ViewGroup.LayoutParams layoutParams = component.getLayoutParams();
144
 				layoutParams.height = ViewGroup.LayoutParams.MATCH_PARENT;
144
 				layoutParams.height = ViewGroup.LayoutParams.MATCH_PARENT;
145
-				container.setLayoutParams(layoutParams);
145
+				component.setLayoutParams(layoutParams);
146
 			}
146
 			}
147
 
147
 
148
 			@Override
148
 			@Override
155
 
155
 
156
 			}
156
 			}
157
 		});
157
 		});
158
-		set.playTogether(containerHeightAnim, containerTransitionAnim, topbarAnim);
158
+		set.playTogether(componentHeightAnim, componentTransitionAnim, topbarAnim);
159
 		set.start();
159
 		set.start();
160
 	}
160
 	}
161
 
161
 
162
-	public void animateHideTopBar(final TopBar topBar, final View container) {
163
-		ValueAnimator containerHeightAnim = ValueAnimator.ofInt(container.getMeasuredHeight(), container.getMeasuredHeight() + topBar.getMeasuredHeight());
164
-		containerHeightAnim.setInterpolator(ACCELERATE_INTERPOLATOR);
165
-		containerHeightAnim.setDuration(DURATION_TOPBAR);
166
-		containerHeightAnim.addUpdateListener(valueAnimator -> {
162
+	public void animateHideTopBar(final TopBar topBar, final View component) {
163
+		ValueAnimator componentHeightAnim = ValueAnimator.ofInt(component.getMeasuredHeight(), component.getMeasuredHeight() + topBar.getMeasuredHeight());
164
+		componentHeightAnim.setInterpolator(ACCELERATE_INTERPOLATOR);
165
+		componentHeightAnim.setDuration(DURATION_TOPBAR);
166
+		componentHeightAnim.addUpdateListener(valueAnimator -> {
167
             int val = (Integer) valueAnimator.getAnimatedValue();
167
             int val = (Integer) valueAnimator.getAnimatedValue();
168
-			ViewGroup.LayoutParams layoutParams = container.getLayoutParams();
168
+			ViewGroup.LayoutParams layoutParams = component.getLayoutParams();
169
             layoutParams.height = val;
169
             layoutParams.height = val;
170
-            container.setLayoutParams(layoutParams);
170
+            component.setLayoutParams(layoutParams);
171
         });
171
         });
172
-		ObjectAnimator containerTransitionAnim = ObjectAnimator.ofFloat(container, View.TRANSLATION_Y, 0, -1 * topBar.getMeasuredHeight());
173
-		containerTransitionAnim.setInterpolator(ACCELERATE_INTERPOLATOR);
174
-		containerTransitionAnim.setDuration(DURATION_TOPBAR);
172
+		ObjectAnimator componentTransitionAnim = ObjectAnimator.ofFloat(component, View.TRANSLATION_Y, 0, -1 * topBar.getMeasuredHeight());
173
+		componentTransitionAnim.setInterpolator(ACCELERATE_INTERPOLATOR);
174
+		componentTransitionAnim.setDuration(DURATION_TOPBAR);
175
 
175
 
176
 		ObjectAnimator topbarAnim = ObjectAnimator.ofFloat(topBar, View.TRANSLATION_Y, 0, -1 * topBar.getMeasuredHeight());
176
 		ObjectAnimator topbarAnim = ObjectAnimator.ofFloat(topBar, View.TRANSLATION_Y, 0, -1 * topBar.getMeasuredHeight());
177
 		topbarAnim.setInterpolator(ACCELERATE_INTERPOLATOR);
177
 		topbarAnim.setInterpolator(ACCELERATE_INTERPOLATOR);
185
 
185
 
186
 			@Override
186
 			@Override
187
 			public void onAnimationEnd(Animator animation) {
187
 			public void onAnimationEnd(Animator animation) {
188
-                ViewGroup.LayoutParams layoutParams = container.getLayoutParams();
188
+                ViewGroup.LayoutParams layoutParams = component.getLayoutParams();
189
 				layoutParams.height = ViewGroup.LayoutParams.MATCH_PARENT;
189
 				layoutParams.height = ViewGroup.LayoutParams.MATCH_PARENT;
190
-				container.setLayoutParams(layoutParams);
191
-				container.setTranslationY(0);
190
+				component.setLayoutParams(layoutParams);
191
+				component.setTranslationY(0);
192
 
192
 
193
 				topBar.setVisibility(View.GONE);
193
 				topBar.setVisibility(View.GONE);
194
 				topBar.setTranslationY(0);
194
 				topBar.setTranslationY(0);
204
 
204
 
205
 			}
205
 			}
206
 		});
206
 		});
207
-		set.playTogether(containerHeightAnim, containerTransitionAnim, topbarAnim);
207
+		set.playTogether(componentHeightAnim, componentTransitionAnim, topbarAnim);
208
 		set.start();
208
 		set.start();
209
 	}
209
 	}
210
 }
210
 }

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

3
 import android.app.Activity;
3
 import android.app.Activity;
4
 
4
 
5
 import com.facebook.react.ReactInstanceManager;
5
 import com.facebook.react.ReactInstanceManager;
6
-import com.reactnativenavigation.react.ReactContainerViewCreator;
6
+import com.reactnativenavigation.react.ReactComponentViewCreator;
7
 import com.reactnativenavigation.utils.TypefaceLoader;
7
 import com.reactnativenavigation.utils.TypefaceLoader;
8
 import com.reactnativenavigation.viewcontrollers.BottomTabsController;
8
 import com.reactnativenavigation.viewcontrollers.BottomTabsController;
9
-import com.reactnativenavigation.viewcontrollers.ContainerViewController;
9
+import com.reactnativenavigation.viewcontrollers.ComponentViewController;
10
 import com.reactnativenavigation.viewcontrollers.SideMenuController;
10
 import com.reactnativenavigation.viewcontrollers.SideMenuController;
11
 import com.reactnativenavigation.viewcontrollers.StackController;
11
 import com.reactnativenavigation.viewcontrollers.StackController;
12
 import com.reactnativenavigation.viewcontrollers.ViewController;
12
 import com.reactnativenavigation.viewcontrollers.ViewController;
13
 import com.reactnativenavigation.viewcontrollers.overlay.DialogViewController;
13
 import com.reactnativenavigation.viewcontrollers.overlay.DialogViewController;
14
 import com.reactnativenavigation.viewcontrollers.toptabs.TopTabController;
14
 import com.reactnativenavigation.viewcontrollers.toptabs.TopTabController;
15
 import com.reactnativenavigation.viewcontrollers.toptabs.TopTabsController;
15
 import com.reactnativenavigation.viewcontrollers.toptabs.TopTabsController;
16
-import com.reactnativenavigation.views.ContainerViewCreator;
16
+import com.reactnativenavigation.views.ComponentViewCreator;
17
 import com.reactnativenavigation.views.TopTabsLayoutCreator;
17
 import com.reactnativenavigation.views.TopTabsLayoutCreator;
18
 
18
 
19
 import java.util.ArrayList;
19
 import java.util.ArrayList;
35
 
35
 
36
 	public ViewController create(final LayoutNode node) {
36
 	public ViewController create(final LayoutNode node) {
37
 		switch (node.type) {
37
 		switch (node.type) {
38
-			case Container:
39
-				return createContainer(node);
40
-			case ContainerStack:
41
-				return createContainerStack(node);
38
+			case Component:
39
+				return createComponent(node);
40
+			case ComponentStack:
41
+				return createComponentStack(node);
42
 			case BottomTabs:
42
 			case BottomTabs:
43
 				return createBottomTabs(node);
43
 				return createBottomTabs(node);
44
 			case SideMenuRoot:
44
 			case SideMenuRoot:
50
 			case SideMenuRight:
50
 			case SideMenuRight:
51
 				return createSideMenuRight(node);
51
 				return createSideMenuRight(node);
52
 			case CustomDialog:
52
 			case CustomDialog:
53
-				return createDialogContainer(node);
53
+				return createDialogComponent(node);
54
             case TopTabs:
54
             case TopTabs:
55
                 return createTopTabs(node);
55
                 return createTopTabs(node);
56
             case TopTab:
56
             case TopTab:
93
 		return create(node.children.get(0));
93
 		return create(node.children.get(0));
94
 	}
94
 	}
95
 
95
 
96
-	private ViewController createContainer(LayoutNode node) {
96
+	private ViewController createComponent(LayoutNode node) {
97
 		String id = node.id;
97
 		String id = node.id;
98
 		String name = node.data.optString("name");
98
 		String name = node.data.optString("name");
99
 		NavigationOptions navigationOptions = NavigationOptions.parse(typefaceManager, node.data.optJSONObject("navigationOptions"), defaultOptions);
99
 		NavigationOptions navigationOptions = NavigationOptions.parse(typefaceManager, node.data.optJSONObject("navigationOptions"), defaultOptions);
100
-		return new ContainerViewController(activity,
100
+		return new ComponentViewController(activity,
101
                 id,
101
                 id,
102
                 name,
102
                 name,
103
-                new ContainerViewCreator(reactInstanceManager),
103
+                new ComponentViewCreator(reactInstanceManager),
104
                 navigationOptions
104
                 navigationOptions
105
         );
105
         );
106
 	}
106
 	}
107
 
107
 
108
-	private ViewController createContainerStack(LayoutNode node) {
108
+	private ViewController createComponentStack(LayoutNode node) {
109
 		StackController stackController = new StackController(activity, node.id);
109
 		StackController stackController = new StackController(activity, node.id);
110
 		for (LayoutNode child : node.children) {
110
 		for (LayoutNode child : node.children) {
111
 			stackController.push(create(child), null);
111
 			stackController.push(create(child), null);
114
 	}
114
 	}
115
 
115
 
116
 	private ViewController createBottomTabs(LayoutNode node) {
116
 	private ViewController createBottomTabs(LayoutNode node) {
117
-		final BottomTabsController tabsContainer = new BottomTabsController(activity, node.id);
117
+		final BottomTabsController tabsComponent = new BottomTabsController(activity, node.id);
118
 		List<ViewController> tabs = new ArrayList<>();
118
 		List<ViewController> tabs = new ArrayList<>();
119
 		for (int i = 0; i < node.children.size(); i++) {
119
 		for (int i = 0; i < node.children.size(); i++) {
120
 			tabs.add(create(node.children.get(i)));
120
 			tabs.add(create(node.children.get(i)));
121
 		}
121
 		}
122
-		tabsContainer.setTabs(tabs);
123
-		return tabsContainer;
122
+		tabsComponent.setTabs(tabs);
123
+		return tabsComponent;
124
 	}
124
 	}
125
 
125
 
126
-	private ViewController createDialogContainer(LayoutNode node) {
126
+	private ViewController createDialogComponent(LayoutNode node) {
127
 		String id = node.id;
127
 		String id = node.id;
128
 		String name = node.data.optString("name");
128
 		String name = node.data.optString("name");
129
-		ReactContainerViewCreator creator = new ReactContainerViewCreator(reactInstanceManager);
129
+		ReactComponentViewCreator creator = new ReactComponentViewCreator(reactInstanceManager);
130
 		return new DialogViewController(activity, id, name, creator);
130
 		return new DialogViewController(activity, id, name, creator);
131
 	}
131
 	}
132
 
132
 
148
         return new TopTabController(activity,
148
         return new TopTabController(activity,
149
                 id,
149
                 id,
150
                 name,
150
                 name,
151
-                new ReactContainerViewCreator(reactInstanceManager),
151
+                new ReactComponentViewCreator(reactInstanceManager),
152
                 navigationOptions
152
                 navigationOptions
153
         );
153
         );
154
     }
154
     }

+ 2
- 2
lib/android/app/src/main/java/com/reactnativenavigation/parse/LayoutNode.java View File

7
 
7
 
8
 public class LayoutNode {
8
 public class LayoutNode {
9
 	public enum Type {
9
 	public enum Type {
10
-		Container,
11
-		ContainerStack,
10
+		Component,
11
+		ComponentStack,
12
 		BottomTabs,
12
 		BottomTabs,
13
 		SideMenuRoot,
13
 		SideMenuRoot,
14
 		SideMenuCenter,
14
 		SideMenuCenter,

+ 3
- 3
lib/android/app/src/main/java/com/reactnativenavigation/parse/OverlayOptions.java View File

27
 		return options;
27
 		return options;
28
 	}
28
 	}
29
 
29
 
30
-	public static OverlayOptions create(ViewController containerView) {
30
+	public static OverlayOptions create(ViewController componentView) {
31
 		OverlayOptions options = new OverlayOptions();
31
 		OverlayOptions options = new OverlayOptions();
32
-		if (containerView == null) return options;
32
+		if (componentView == null) return options;
33
 
33
 
34
-		options.customView = containerView;
34
+		options.customView = componentView;
35
 		return options;
35
 		return options;
36
 	}
36
 	}
37
 
37
 

+ 7
- 7
lib/android/app/src/main/java/com/reactnativenavigation/react/NavigationEvent.java View File

13
 
13
 
14
 public class NavigationEvent {
14
 public class NavigationEvent {
15
 	private static final String onAppLaunched = "RNN.appLaunched";
15
 	private static final String onAppLaunched = "RNN.appLaunched";
16
-	private static final String containerDidAppear = "RNN.containerDidAppear";
17
-	private static final String containerDidDisappear = "RNN.containerDidDisappear";
16
+	private static final String componentDidAppear = "RNN.componentDidAppear";
17
+	private static final String componentDidDisappear = "RNN.componentDidDisappear";
18
 	private static final String onNavigationButtonPressed = "RNN.navigationButtonPressed";
18
 	private static final String onNavigationButtonPressed = "RNN.navigationButtonPressed";
19
 
19
 
20
 	private final RCTDeviceEventEmitter emitter;
20
 	private final RCTDeviceEventEmitter emitter;
27
 		emit(onAppLaunched);
27
 		emit(onAppLaunched);
28
 	}
28
 	}
29
 
29
 
30
-	public void containerDidDisappear(String id) {
31
-		emit(containerDidDisappear, id);
30
+	public void componentDidDisappear(String id) {
31
+		emit(componentDidDisappear, id);
32
 	}
32
 	}
33
 
33
 
34
-	public void containerDidAppear(String id) {
35
-		emit(containerDidAppear, id);
34
+	public void componentDidAppear(String id) {
35
+		emit(componentDidAppear, id);
36
 	}
36
 	}
37
 
37
 
38
 	public void sendOnNavigationButtonPressed(String id, String buttonId) {
38
 	public void sendOnNavigationButtonPressed(String id, String buttonId) {
39
 		WritableMap map = Arguments.createMap();
39
 		WritableMap map = Arguments.createMap();
40
-		map.putString("containerId", id);
40
+		map.putString("componentId", id);
41
 		map.putString("buttonId", buttonId);
41
 		map.putString("buttonId", buttonId);
42
 
42
 
43
 		emit(onNavigationButtonPressed, map);
43
 		emit(onNavigationButtonPressed, map);

+ 12
- 12
lib/android/app/src/main/java/com/reactnativenavigation/react/NavigationModule.java View File

52
     }
52
     }
53
 
53
 
54
 	@ReactMethod
54
 	@ReactMethod
55
-	public void setOptions(final String onContainerId, final ReadableMap options) {
55
+	public void setOptions(final String onComponentId, final ReadableMap options) {
56
 		final NavigationOptions navOptions = NavigationOptions.parse(new TypefaceLoader(activity()), JSONParser.parse(options));
56
 		final NavigationOptions navOptions = NavigationOptions.parse(new TypefaceLoader(activity()), JSONParser.parse(options));
57
-		handle(() -> navigator().setOptions(onContainerId, navOptions));
57
+		handle(() -> navigator().setOptions(onComponentId, navOptions));
58
 	}
58
 	}
59
 
59
 
60
 	@ReactMethod
60
 	@ReactMethod
61
-	public void push(final String onContainerId, final ReadableMap rawLayoutTree, final Promise promise) {
61
+	public void push(final String onComponentId, final ReadableMap rawLayoutTree, final Promise promise) {
62
 		final LayoutNode layoutTree = LayoutNodeParser.parse(JSONParser.parse(rawLayoutTree));
62
 		final LayoutNode layoutTree = LayoutNodeParser.parse(JSONParser.parse(rawLayoutTree));
63
 		handle(() -> {
63
 		handle(() -> {
64
             final ViewController viewController = newLayoutFactory().create(layoutTree);
64
             final ViewController viewController = newLayoutFactory().create(layoutTree);
65
-            navigator().push(onContainerId, viewController, promise);
65
+            navigator().push(onComponentId, viewController, promise);
66
         });
66
         });
67
 	}
67
 	}
68
 
68
 
69
 	@ReactMethod
69
 	@ReactMethod
70
-	public void pop(final String onContainerId, final ReadableMap options, final Promise promise) {
71
-		handle(() -> navigator().popSpecific(onContainerId, promise));
70
+	public void pop(final String onComponentId, final ReadableMap options, final Promise promise) {
71
+		handle(() -> navigator().popSpecific(onComponentId, promise));
72
 	}
72
 	}
73
 
73
 
74
 	@ReactMethod
74
 	@ReactMethod
75
-	public void popTo(final String containerId, final Promise promise) {
76
-		handle(() -> navigator().popTo(containerId, promise));
75
+	public void popTo(final String componentId, final Promise promise) {
76
+		handle(() -> navigator().popTo(componentId, promise));
77
 	}
77
 	}
78
 
78
 
79
 	@ReactMethod
79
 	@ReactMethod
80
-	public void popToRoot(final String containerId, final Promise promise) {
81
-		handle(() -> navigator().popToRoot(containerId, promise));
80
+	public void popToRoot(final String componentId, final Promise promise) {
81
+		handle(() -> navigator().popToRoot(componentId, promise));
82
 	}
82
 	}
83
 
83
 
84
 	@ReactMethod
84
 	@ReactMethod
91
 	}
91
 	}
92
 
92
 
93
 	@ReactMethod
93
 	@ReactMethod
94
-	public void dismissModal(final String containerId, final Promise promise) {
95
-		handle(() -> navigator().dismissModal(containerId, promise));
94
+	public void dismissModal(final String componentId, final Promise promise) {
95
+		handle(() -> navigator().dismissModal(componentId, promise));
96
 	}
96
 	}
97
 
97
 
98
 	@ReactMethod
98
 	@ReactMethod

+ 20
- 0
lib/android/app/src/main/java/com/reactnativenavigation/react/ReactComponentViewCreator.java View File

1
+package com.reactnativenavigation.react;
2
+
3
+import android.app.Activity;
4
+
5
+import com.facebook.react.ReactInstanceManager;
6
+import com.reactnativenavigation.viewcontrollers.ComponentViewController;
7
+import com.reactnativenavigation.viewcontrollers.ComponentViewController.ReactViewCreator;
8
+
9
+public class ReactComponentViewCreator implements ReactViewCreator {
10
+	private ReactInstanceManager reactInstanceManager;
11
+
12
+	public ReactComponentViewCreator(final ReactInstanceManager reactInstanceManager) {
13
+		this.reactInstanceManager = reactInstanceManager;
14
+	}
15
+
16
+	@Override
17
+	public ComponentViewController.IReactView create(final Activity activity, final String componentId, final String componentName) {
18
+		return new ReactView(activity, reactInstanceManager, componentId, componentName);
19
+	}
20
+}

+ 0
- 20
lib/android/app/src/main/java/com/reactnativenavigation/react/ReactContainerViewCreator.java View File

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

+ 14
- 14
lib/android/app/src/main/java/com/reactnativenavigation/react/ReactView.java View File

7
 
7
 
8
 import com.facebook.react.ReactInstanceManager;
8
 import com.facebook.react.ReactInstanceManager;
9
 import com.facebook.react.ReactRootView;
9
 import com.facebook.react.ReactRootView;
10
-import com.reactnativenavigation.viewcontrollers.ContainerViewController;
10
+import com.reactnativenavigation.viewcontrollers.ComponentViewController;
11
 
11
 
12
 @SuppressLint("ViewConstructor")
12
 @SuppressLint("ViewConstructor")
13
-public class ReactView extends ReactRootView implements ContainerViewController.IReactView {
13
+public class ReactView extends ReactRootView implements ComponentViewController.IReactView {
14
 
14
 
15
 	private final ReactInstanceManager reactInstanceManager;
15
 	private final ReactInstanceManager reactInstanceManager;
16
-	private final String containerId;
17
-	private final String containerName;
16
+	private final String componentId;
17
+	private final String componentName;
18
 	private boolean isAttachedToReactInstance = false;
18
 	private boolean isAttachedToReactInstance = false;
19
 
19
 
20
-	public ReactView(final Context context, ReactInstanceManager reactInstanceManager, String containerId, String containerName) {
20
+	public ReactView(final Context context, ReactInstanceManager reactInstanceManager, String componentId, String componentName) {
21
 		super(context);
21
 		super(context);
22
 		this.reactInstanceManager = reactInstanceManager;
22
 		this.reactInstanceManager = reactInstanceManager;
23
-		this.containerId = containerId;
24
-		this.containerName = containerName;
23
+		this.componentId = componentId;
24
+		this.componentName = componentName;
25
 		start();
25
 		start();
26
 	}
26
 	}
27
 
27
 
31
             isAttachedToReactInstance = true;
31
             isAttachedToReactInstance = true;
32
         });
32
         });
33
 		final Bundle opts = new Bundle();
33
 		final Bundle opts = new Bundle();
34
-		opts.putString("containerId", containerId);
35
-		startReactApplication(reactInstanceManager, containerName, opts);
34
+		opts.putString("componentId", componentId);
35
+		startReactApplication(reactInstanceManager, componentName, opts);
36
 	}
36
 	}
37
 
37
 
38
 	@Override
38
 	@Override
51
 	}
51
 	}
52
 
52
 
53
 	@Override
53
 	@Override
54
-	public void sendContainerStart() {
55
-		new NavigationEvent(reactInstanceManager.getCurrentReactContext()).containerDidAppear(containerId);
54
+	public void sendComponentStart() {
55
+		new NavigationEvent(reactInstanceManager.getCurrentReactContext()).componentDidAppear(componentId);
56
 	}
56
 	}
57
 
57
 
58
 	@Override
58
 	@Override
59
-	public void sendContainerStop() {
60
-		new NavigationEvent(reactInstanceManager.getCurrentReactContext()).containerDidDisappear(containerId);
59
+	public void sendComponentStop() {
60
+		new NavigationEvent(reactInstanceManager.getCurrentReactContext()).componentDidDisappear(componentId);
61
 	}
61
 	}
62
 
62
 
63
     @Override
63
     @Override
64
 	public void sendOnNavigationButtonPressed(String buttonId) {
64
 	public void sendOnNavigationButtonPressed(String buttonId) {
65
-		new NavigationEvent(reactInstanceManager.getCurrentReactContext()).sendOnNavigationButtonPressed(containerId, buttonId);
65
+		new NavigationEvent(reactInstanceManager.getCurrentReactContext()).sendOnNavigationButtonPressed(componentId, buttonId);
66
 	}
66
 	}
67
 }
67
 }

lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/ContainerViewController.java → lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/ComponentViewController.java View File

7
 
7
 
8
 import com.reactnativenavigation.parse.NavigationOptions;
8
 import com.reactnativenavigation.parse.NavigationOptions;
9
 import com.reactnativenavigation.presentation.NavigationOptionsListener;
9
 import com.reactnativenavigation.presentation.NavigationOptionsListener;
10
-import com.reactnativenavigation.views.ReactContainer;
10
+import com.reactnativenavigation.views.ReactComponent;
11
 import com.reactnativenavigation.views.TopBar;
11
 import com.reactnativenavigation.views.TopBar;
12
 
12
 
13
-public class ContainerViewController extends ViewController implements NavigationOptionsListener {
13
+public class ComponentViewController extends ViewController implements NavigationOptionsListener {
14
 
14
 
15
     public interface ReactViewCreator {
15
     public interface ReactViewCreator {
16
 
16
 
17
-        IReactView create(Activity activity, String containerId, String containerName);
17
+        IReactView create(Activity activity, String componentId, String componentName);
18
 	}
18
 	}
19
 
19
 
20
 	public interface IReactView {
20
 	public interface IReactView {
25
 
25
 
26
 		void destroy();
26
 		void destroy();
27
 
27
 
28
-		void sendContainerStart();
28
+		void sendComponentStart();
29
 
29
 
30
-		void sendContainerStop();
30
+		void sendComponentStop();
31
 
31
 
32
         void sendOnNavigationButtonPressed(String buttonId);
32
         void sendOnNavigationButtonPressed(String buttonId);
33
     }
33
     }
34
 
34
 
35
-	private final String containerName;
35
+	private final String componentName;
36
 
36
 
37
 	private final ReactViewCreator viewCreator;
37
 	private final ReactViewCreator viewCreator;
38
 	private NavigationOptions navigationOptions;
38
 	private NavigationOptions navigationOptions;
39
-	private ReactContainer container;
39
+	private ReactComponent component;
40
 
40
 
41
-	public ContainerViewController(final Activity activity,
41
+	public ComponentViewController(final Activity activity,
42
 								   final String id,
42
 								   final String id,
43
-								   final String containerName,
43
+								   final String componentName,
44
 								   final ReactViewCreator viewCreator,
44
 								   final ReactViewCreator viewCreator,
45
 								   final NavigationOptions initialNavigationOptions) {
45
 								   final NavigationOptions initialNavigationOptions) {
46
 		super(activity, id);
46
 		super(activity, id);
47
-		this.containerName = containerName;
47
+		this.componentName = componentName;
48
 		this.viewCreator = viewCreator;
48
 		this.viewCreator = viewCreator;
49
 		this.navigationOptions = initialNavigationOptions;
49
 		this.navigationOptions = initialNavigationOptions;
50
 	}
50
 	}
51
 
51
 
52
     @RestrictTo(RestrictTo.Scope.TESTS)
52
     @RestrictTo(RestrictTo.Scope.TESTS)
53
     TopBar getTopBar() {
53
     TopBar getTopBar() {
54
-        return container.getTopBar();
54
+        return component.getTopBar();
55
     }
55
     }
56
 
56
 
57
 	@Override
57
 	@Override
58
 	public void destroy() {
58
 	public void destroy() {
59
 		super.destroy();
59
 		super.destroy();
60
-		if (container != null) container.destroy();
61
-		container = null;
60
+		if (component != null) component.destroy();
61
+		component = null;
62
 	}
62
 	}
63
 
63
 
64
 	@Override
64
 	@Override
65
 	public void onViewAppeared() {
65
 	public void onViewAppeared() {
66
 		super.onViewAppeared();
66
 		super.onViewAppeared();
67
 		ensureViewIsCreated();
67
 		ensureViewIsCreated();
68
-		container.applyOptions(navigationOptions);
69
-		container.sendContainerStart();
68
+		component.applyOptions(navigationOptions);
69
+		component.sendComponentStart();
70
 	}
70
 	}
71
 
71
 
72
 	@Override
72
 	@Override
73
 	public void onViewDisappear() {
73
 	public void onViewDisappear() {
74
 		super.onViewDisappear();
74
 		super.onViewDisappear();
75
-		container.sendContainerStop();
75
+		component.sendComponentStop();
76
 	}
76
 	}
77
 
77
 
78
 	@Override
78
 	@Override
79
 	protected boolean isViewShown() {
79
 	protected boolean isViewShown() {
80
-		return super.isViewShown() && container.isReady();
80
+		return super.isViewShown() && component.isReady();
81
 	}
81
 	}
82
 
82
 
83
 	@NonNull
83
 	@NonNull
84
 	@Override
84
 	@Override
85
 	protected View createView() {
85
 	protected View createView() {
86
-		container = (ReactContainer) viewCreator.create(getActivity(), getId(), containerName);
87
-        return container.asView();
86
+		component = (ReactComponent) viewCreator.create(getActivity(), getId(), componentName);
87
+        return component.asView();
88
 	}
88
 	}
89
 
89
 
90
 	@Override
90
 	@Override
91
 	public void mergeNavigationOptions(NavigationOptions options) {
91
 	public void mergeNavigationOptions(NavigationOptions options) {
92
 		navigationOptions.mergeWith(options);
92
 		navigationOptions.mergeWith(options);
93
-        container.applyOptions(navigationOptions);
93
+        component.applyOptions(navigationOptions);
94
 	}
94
 	}
95
 
95
 
96
 	NavigationOptions getNavigationOptions() {
96
 	NavigationOptions getNavigationOptions() {

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

26
 		}
26
 		}
27
 	}
27
 	}
28
 
28
 
29
-	public void dismissModal(final String containerId, Promise promise) {
30
-		Modal modal = findModalByContainerId(containerId);
29
+	public void dismissModal(final String componentId, Promise promise) {
30
+		Modal modal = findModalByComponentId(componentId);
31
 		if (modal != null) {
31
 		if (modal != null) {
32
 			modal.dismiss();
32
 			modal.dismiss();
33
 			modals.remove(modal);
33
 			modals.remove(modal);
34
 			if (promise != null) {
34
 			if (promise != null) {
35
-				promise.resolve(containerId);
35
+				promise.resolve(componentId);
36
 			}
36
 			}
37
 		} else {
37
 		} else {
38
 			Navigator.rejectPromise(promise);
38
 			Navigator.rejectPromise(promise);
50
 	}
50
 	}
51
 
51
 
52
 	@Nullable
52
 	@Nullable
53
-	private Modal findModalByContainerId(String containerId) {
53
+	private Modal findModalByComponentId(String componentId) {
54
 		for (Modal modal : modals) {
54
 		for (Modal modal : modals) {
55
-			if (modal.containsDeepContainerId(containerId)) {
55
+			if (modal.containsDeepComponentId(componentId)) {
56
 				return modal;
56
 				return modal;
57
 			}
57
 			}
58
 		}
58
 		}
78
 			dialog.dismiss();
78
 			dialog.dismiss();
79
 		}
79
 		}
80
 
80
 
81
-		boolean containsDeepContainerId(String containerId) {
82
-			return viewController.findControllerById(containerId) != null;
81
+		boolean containsDeepComponentId(String componentId) {
82
+			return viewController.findControllerById(componentId) != null;
83
 		}
83
 		}
84
 
84
 
85
 		private void preMeasureView() {
85
 		private void preMeasureView() {

+ 8
- 8
lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/Navigator.java View File

77
         return defaultOptions;
77
         return defaultOptions;
78
     }
78
     }
79
 
79
 
80
-	public void setOptions(final String containerId, NavigationOptions options) {
81
-		ViewController target = findControllerById(containerId);
80
+	public void setOptions(final String componentId, NavigationOptions options) {
81
+		ViewController target = findControllerById(componentId);
82
 		if (target instanceof NavigationOptionsListener) {
82
 		if (target instanceof NavigationOptionsListener) {
83
 			((NavigationOptionsListener) target).mergeNavigationOptions(options);
83
 			((NavigationOptionsListener) target).mergeNavigationOptions(options);
84
 		}
84
 		}
133
 		}
133
 		}
134
 	}
134
 	}
135
 
135
 
136
-	void popTo(final String containerId) {
137
-		popTo(containerId, null);
136
+	void popTo(final String componentId) {
137
+		popTo(componentId, null);
138
 	}
138
 	}
139
 
139
 
140
-	public void popTo(final String containerId, Promise promise) {
141
-		ViewController target = findControllerById(containerId);
140
+	public void popTo(final String componentId, Promise promise) {
141
+		ViewController target = findControllerById(componentId);
142
 		if (target != null) {
142
 		if (target != null) {
143
 		    target.performOnParentStack(stack -> stack.popTo(target, promise), () -> rejectPromise(promise));
143
 		    target.performOnParentStack(stack -> stack.popTo(target, promise), () -> rejectPromise(promise));
144
 		} else {
144
 		} else {
150
 		modalStack.showModal(viewController, promise);
150
 		modalStack.showModal(viewController, promise);
151
 	}
151
 	}
152
 
152
 
153
-	public void dismissModal(final String containerId, Promise promise) {
154
-		modalStack.dismissModal(containerId, promise);
153
+	public void dismissModal(final String componentId, Promise promise) {
154
+		modalStack.dismissModal(componentId, promise);
155
 	}
155
 	}
156
 
156
 
157
 	public void dismissAllModals(Promise promise) {
157
 	public void dismissAllModals(Promise promise) {

+ 1
- 1
lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/overlay/CustomOverlay.java View File

4
 import android.content.Context;
4
 import android.content.Context;
5
 
5
 
6
 import com.reactnativenavigation.parse.OverlayOptions;
6
 import com.reactnativenavigation.parse.OverlayOptions;
7
-import com.reactnativenavigation.viewcontrollers.ContainerViewController;
7
+import com.reactnativenavigation.viewcontrollers.ComponentViewController;
8
 import com.reactnativenavigation.viewcontrollers.ViewController;
8
 import com.reactnativenavigation.viewcontrollers.ViewController;
9
 import com.reactnativenavigation.views.CustomDialog;
9
 import com.reactnativenavigation.views.CustomDialog;
10
 
10
 

+ 6
- 6
lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/overlay/DialogViewController.java View File

4
 import android.support.annotation.NonNull;
4
 import android.support.annotation.NonNull;
5
 import android.view.View;
5
 import android.view.View;
6
 
6
 
7
-import com.reactnativenavigation.viewcontrollers.ContainerViewController;
7
+import com.reactnativenavigation.viewcontrollers.ComponentViewController;
8
 import com.reactnativenavigation.viewcontrollers.ViewController;
8
 import com.reactnativenavigation.viewcontrollers.ViewController;
9
 
9
 
10
 
10
 
11
 public class DialogViewController extends ViewController {
11
 public class DialogViewController extends ViewController {
12
 
12
 
13
-	private ContainerViewController.ReactViewCreator viewCreator;
14
-	private String containerName;
13
+	private ComponentViewController.ReactViewCreator viewCreator;
14
+	private String componentName;
15
 
15
 
16
-	public DialogViewController(Activity activity, String id, String containerName, ContainerViewController.ReactViewCreator viewCreator) {
16
+	public DialogViewController(Activity activity, String id, String componentName, ComponentViewController.ReactViewCreator viewCreator) {
17
 		super(activity, id);
17
 		super(activity, id);
18
 		this.viewCreator = viewCreator;
18
 		this.viewCreator = viewCreator;
19
-		this.containerName = containerName;
19
+		this.componentName = componentName;
20
 	}
20
 	}
21
 
21
 
22
 	@NonNull
22
 	@NonNull
23
 	@Override
23
 	@Override
24
 	protected View createView() {
24
 	protected View createView() {
25
-		return viewCreator.create(getActivity(), getId(), containerName).asView();
25
+		return viewCreator.create(getActivity(), getId(), componentName).asView();
26
 	}
26
 	}
27
 }
27
 }

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

5
 
5
 
6
 import com.reactnativenavigation.parse.NavigationOptions;
6
 import com.reactnativenavigation.parse.NavigationOptions;
7
 import com.reactnativenavigation.presentation.NavigationOptionsListener;
7
 import com.reactnativenavigation.presentation.NavigationOptionsListener;
8
-import com.reactnativenavigation.viewcontrollers.ContainerViewController;
8
+import com.reactnativenavigation.viewcontrollers.ComponentViewController;
9
 import com.reactnativenavigation.viewcontrollers.ViewController;
9
 import com.reactnativenavigation.viewcontrollers.ViewController;
10
 import com.reactnativenavigation.views.TopTab;
10
 import com.reactnativenavigation.views.TopTab;
11
 
11
 
12
 public class TopTabController extends ViewController implements NavigationOptionsListener {
12
 public class TopTabController extends ViewController implements NavigationOptionsListener {
13
 
13
 
14
-    private final String containerName;
15
-    private ContainerViewController.ReactViewCreator viewCreator;
14
+    private final String componentName;
15
+    private ComponentViewController.ReactViewCreator viewCreator;
16
     private final NavigationOptions options;
16
     private final NavigationOptions options;
17
     private TopTab topTab;
17
     private TopTab topTab;
18
     private boolean isSelectedTab;
18
     private boolean isSelectedTab;
19
 
19
 
20
-    public TopTabController(Activity activity, String id, String name, ContainerViewController.ReactViewCreator viewCreator, NavigationOptions initialOptions) {
20
+    public TopTabController(Activity activity, String id, String name, ComponentViewController.ReactViewCreator viewCreator, NavigationOptions initialOptions) {
21
         super(activity, id);
21
         super(activity, id);
22
-        this.containerName = name;
22
+        this.componentName = name;
23
         this.viewCreator = viewCreator;
23
         this.viewCreator = viewCreator;
24
         this.options = initialOptions;
24
         this.options = initialOptions;
25
     }
25
     }
29
         super.onViewAppeared();
29
         super.onViewAppeared();
30
         isSelectedTab = true;
30
         isSelectedTab = true;
31
         applyOptions(options);
31
         applyOptions(options);
32
-        topTab.sendContainerStart();
32
+        topTab.sendComponentStart();
33
     }
33
     }
34
 
34
 
35
     @Override
35
     @Override
41
     public void onViewDisappear() {
41
     public void onViewDisappear() {
42
         super.onViewDisappear();
42
         super.onViewDisappear();
43
         isSelectedTab = false;
43
         isSelectedTab = false;
44
-        topTab.sendContainerStop();
44
+        topTab.sendComponentStop();
45
     }
45
     }
46
 
46
 
47
     @Override
47
     @Override
53
     public View createView() {
53
     public View createView() {
54
         topTab = new TopTab(
54
         topTab = new TopTab(
55
                 getActivity(),
55
                 getActivity(),
56
-                viewCreator.create(getActivity(), getId(), containerName)
56
+                viewCreator.create(getActivity(), getId(), componentName)
57
         );
57
         );
58
         return topTab;
58
         return topTab;
59
     }
59
     }

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

31
     }
31
     }
32
 
32
 
33
     @Override
33
     @Override
34
-    public Object instantiateItem(ViewGroup container, int position) {
34
+    public Object instantiateItem(ViewGroup component, int position) {
35
         return tabs.get(position).getView();
35
         return tabs.get(position).getView();
36
     }
36
     }
37
 
37
 

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

5
 import android.support.v4.view.ViewPager;
5
 import android.support.v4.view.ViewPager;
6
 import android.view.ViewGroup;
6
 import android.view.ViewGroup;
7
 
7
 
8
-import com.reactnativenavigation.viewcontrollers.ContainerViewController;
8
+import com.reactnativenavigation.viewcontrollers.ComponentViewController;
9
 import com.reactnativenavigation.viewcontrollers.ViewController;
9
 import com.reactnativenavigation.viewcontrollers.ViewController;
10
 
10
 
11
 import java.util.List;
11
 import java.util.List;
39
     }
39
     }
40
 
40
 
41
     public void sendOnNavigationButtonPressed(String id) {
41
     public void sendOnNavigationButtonPressed(String id) {
42
-        ((ContainerViewController.IReactView) tabs.get(getCurrentItem()).getView()).sendOnNavigationButtonPressed(id);
42
+        ((ComponentViewController.IReactView) tabs.get(getCurrentItem()).getView()).sendOnNavigationButtonPressed(id);
43
     }
43
     }
44
-}
44
+}

lib/android/app/src/main/java/com/reactnativenavigation/views/Container.java → lib/android/app/src/main/java/com/reactnativenavigation/views/Component.java View File

4
 
4
 
5
 import com.reactnativenavigation.parse.NavigationOptions;
5
 import com.reactnativenavigation.parse.NavigationOptions;
6
 
6
 
7
-public interface Container {
7
+public interface Component {
8
     void applyOptions(NavigationOptions options);
8
     void applyOptions(NavigationOptions options);
9
 
9
 
10
     void sendOnNavigationButtonPressed(String id);
10
     void sendOnNavigationButtonPressed(String id);

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

8
 
8
 
9
 import com.reactnativenavigation.parse.NavigationOptions;
9
 import com.reactnativenavigation.parse.NavigationOptions;
10
 import com.reactnativenavigation.presentation.OptionsPresenter;
10
 import com.reactnativenavigation.presentation.OptionsPresenter;
11
-import com.reactnativenavigation.viewcontrollers.ContainerViewController.IReactView;
11
+import com.reactnativenavigation.viewcontrollers.ComponentViewController.IReactView;
12
 
12
 
13
 @SuppressLint("ViewConstructor")
13
 @SuppressLint("ViewConstructor")
14
-public class ContainerLayout extends LinearLayout implements ReactContainer {
14
+public class ComponentLayout extends LinearLayout implements ReactComponent {
15
 
15
 
16
 	private TopBar topBar;
16
 	private TopBar topBar;
17
 	private IReactView reactView;
17
 	private IReactView reactView;
18
 	private final OptionsPresenter optionsPresenter;
18
 	private final OptionsPresenter optionsPresenter;
19
 
19
 
20
-	public ContainerLayout(Context context, IReactView reactView) {
20
+	public ComponentLayout(Context context, IReactView reactView) {
21
 		super(context);
21
 		super(context);
22
 		this.topBar = new TopBar(context, this);
22
 		this.topBar = new TopBar(context, this);
23
 		this.reactView = reactView;
23
 		this.reactView = reactView;
47
 	}
47
 	}
48
 
48
 
49
 	@Override
49
 	@Override
50
-	public void sendContainerStart() {
51
-		reactView.sendContainerStart();
50
+	public void sendComponentStart() {
51
+		reactView.sendComponentStart();
52
 	}
52
 	}
53
 
53
 
54
 	@Override
54
 	@Override
55
-	public void sendContainerStop() {
56
-		reactView.sendContainerStop();
55
+	public void sendComponentStop() {
56
+		reactView.sendComponentStop();
57
 	}
57
 	}
58
 
58
 
59
     @Override
59
     @Override

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

1
+package com.reactnativenavigation.views;
2
+
3
+import android.app.Activity;
4
+
5
+import com.facebook.react.ReactInstanceManager;
6
+import com.reactnativenavigation.react.ReactComponentViewCreator;
7
+import com.reactnativenavigation.viewcontrollers.ComponentViewController;
8
+
9
+public class ComponentViewCreator implements ComponentViewController.ReactViewCreator {
10
+
11
+    private ReactInstanceManager instanceManager;
12
+
13
+    public ComponentViewCreator(ReactInstanceManager instanceManager) {
14
+        this.instanceManager = instanceManager;
15
+	}
16
+
17
+	@Override
18
+	public ComponentViewController.IReactView create(Activity activity, String componentId, String componentName) {
19
+        ComponentViewController.IReactView reactView = new ReactComponentViewCreator(instanceManager).create(activity, componentId, componentName);
20
+        return new ComponentLayout(activity, reactView);
21
+	}
22
+}

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

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

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

14
 
14
 
15
 public class CustomDialog extends Dialog {
15
 public class CustomDialog extends Dialog {
16
 
16
 
17
-	private View container;
17
+	private View component;
18
 
18
 
19
-	public CustomDialog(@NonNull Context context, @NonNull View container) {
19
+	public CustomDialog(@NonNull Context context, @NonNull View component) {
20
 		super(context);
20
 		super(context);
21
 
21
 
22
-		this.container = container;
22
+		this.component = component;
23
 		init();
23
 		init();
24
 	}
24
 	}
25
 
25
 
26
 	private void init() {
26
 	private void init() {
27
-		addContentView(container, new WindowManager.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
27
+		addContentView(component, new WindowManager.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
28
 	}
28
 	}
29
 }
29
 }

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

1
+package com.reactnativenavigation.views;
2
+
3
+import com.reactnativenavigation.viewcontrollers.ComponentViewController;
4
+
5
+public interface ReactComponent extends Component, ComponentViewController.IReactView {
6
+}

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

1
-package com.reactnativenavigation.views;
2
-
3
-import com.reactnativenavigation.viewcontrollers.ContainerViewController;
4
-
5
-public interface ReactContainer extends Container, ContainerViewController.IReactView {
6
-}

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

24
 public class TitleBarButton implements MenuItem.OnMenuItemClickListener {
24
 public class TitleBarButton implements MenuItem.OnMenuItemClickListener {
25
 	private Toolbar toolbar;
25
 	private Toolbar toolbar;
26
 	private final Button button;
26
 	private final Button button;
27
-	private Container container;
27
+	private Component component;
28
 	private Drawable icon;
28
 	private Drawable icon;
29
 
29
 
30
-	TitleBarButton(Container container, Toolbar toolbar, Button button) {
31
-		this.container = container;
30
+	TitleBarButton(Component component, Toolbar toolbar, Button button) {
31
+		this.component = component;
32
 		this.toolbar = toolbar;
32
 		this.toolbar = toolbar;
33
 		this.button = button;
33
 		this.button = button;
34
 	}
34
 	}
118
 	}
118
 	}
119
 
119
 
120
 	private void setNavigationClickListener() {
120
 	private void setNavigationClickListener() {
121
-		toolbar.setNavigationOnClickListener(view -> container.sendOnNavigationButtonPressed(button.id));
121
+		toolbar.setNavigationOnClickListener(view -> component.sendOnNavigationButtonPressed(button.id));
122
 	}
122
 	}
123
 
123
 
124
 	@Override
124
 	@Override
125
 	public boolean onMenuItemClick(MenuItem menuItem) {
125
 	public boolean onMenuItemClick(MenuItem menuItem) {
126
-		this.container.sendOnNavigationButtonPressed(button.id);
126
+		this.component.sendOnNavigationButtonPressed(button.id);
127
 		return true;
127
 		return true;
128
 	}
128
 	}
129
 
129
 

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

23
 @SuppressLint("ViewConstructor")
23
 @SuppressLint("ViewConstructor")
24
 public class TopBar extends AppBarLayout {
24
 public class TopBar extends AppBarLayout {
25
 	private final Toolbar titleBar;
25
 	private final Toolbar titleBar;
26
-    private Container container;
26
+    private Component component;
27
     private TopTabs topTabs;
27
     private TopTabs topTabs;
28
 
28
 
29
-    public TopBar(final Context context, Container container) {
29
+    public TopBar(final Context context, Component component) {
30
         super(context);
30
         super(context);
31
-        this.container = container;
31
+        this.component = component;
32
         titleBar = new Toolbar(context);
32
         titleBar = new Toolbar(context);
33
         topTabs = new TopTabs(getContext());
33
         topTabs = new TopTabs(getContext());
34
         addView(titleBar);
34
         addView(titleBar);
115
 	}
115
 	}
116
 
116
 
117
 	private void setLeftButton(final Button button) {
117
 	private void setLeftButton(final Button button) {
118
-		TitleBarButton leftBarButton = new TitleBarButton(container, this.titleBar, button);
118
+		TitleBarButton leftBarButton = new TitleBarButton(component, this.titleBar, button);
119
 		leftBarButton.applyNavigationIcon(getContext());
119
 		leftBarButton.applyNavigationIcon(getContext());
120
 	}
120
 	}
121
 
121
 
129
 
129
 
130
 		for (int i = 0; i < rightButtons.size(); i++){
130
 		for (int i = 0; i < rightButtons.size(); i++){
131
 	   		Button button = rightButtons.get(i);
131
 	   		Button button = rightButtons.get(i);
132
-			TitleBarButton titleBarButton = new TitleBarButton(container, this.titleBar, button);
132
+			TitleBarButton titleBarButton = new TitleBarButton(component, this.titleBar, button);
133
 			titleBarButton.addToMenu(getContext(), menu);
133
 			titleBarButton.addToMenu(getContext(), menu);
134
        }
134
        }
135
     }
135
     }

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

5
 import android.view.View;
5
 import android.view.View;
6
 import android.widget.FrameLayout;
6
 import android.widget.FrameLayout;
7
 
7
 
8
-import com.reactnativenavigation.viewcontrollers.ContainerViewController.IReactView;
8
+import com.reactnativenavigation.viewcontrollers.ComponentViewController.IReactView;
9
 
9
 
10
 @SuppressLint("ViewConstructor")
10
 @SuppressLint("ViewConstructor")
11
 public class TopTab extends FrameLayout implements IReactView {
11
 public class TopTab extends FrameLayout implements IReactView {
34
 	}
34
 	}
35
 
35
 
36
 	@Override
36
 	@Override
37
-	public void sendContainerStart() {
38
-		reactView.sendContainerStart();
37
+	public void sendComponentStart() {
38
+		reactView.sendComponentStart();
39
 	}
39
 	}
40
 
40
 
41
 	@Override
41
 	@Override
42
-	public void sendContainerStop() {
43
-		reactView.sendContainerStop();
42
+	public void sendComponentStop() {
43
+		reactView.sendComponentStop();
44
 	}
44
 	}
45
 
45
 
46
     @Override
46
     @Override

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

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

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

15
 import java.util.List;
15
 import java.util.List;
16
 
16
 
17
 @SuppressLint("ViewConstructor")
17
 @SuppressLint("ViewConstructor")
18
-public class TopTabsLayout extends LinearLayout implements Container {
18
+public class TopTabsLayout extends LinearLayout implements Component {
19
 
19
 
20
     private TopBar topBar;
20
     private TopBar topBar;
21
     private TopTabsViewPager viewPager;
21
     private TopTabsViewPager viewPager;

+ 12
- 0
lib/android/app/src/test/java/com/reactnativenavigation/mocks/SimpleComponentViewController.java View File

1
+package com.reactnativenavigation.mocks;
2
+
3
+import android.app.Activity;
4
+
5
+import com.reactnativenavigation.parse.NavigationOptions;
6
+import com.reactnativenavigation.viewcontrollers.ComponentViewController;
7
+
8
+public class SimpleComponentViewController extends ComponentViewController {
9
+	public SimpleComponentViewController(final Activity activity, final String id) {
10
+		super(activity, id, "theComponentName", new TestComponentViewCreator(), new NavigationOptions());
11
+	}
12
+}

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

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

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

5
 
5
 
6
 import com.reactnativenavigation.parse.NavigationOptions;
6
 import com.reactnativenavigation.parse.NavigationOptions;
7
 import com.reactnativenavigation.presentation.OptionsPresenter;
7
 import com.reactnativenavigation.presentation.OptionsPresenter;
8
-import com.reactnativenavigation.views.ReactContainer;
8
+import com.reactnativenavigation.views.ReactComponent;
9
 import com.reactnativenavigation.views.TopBar;
9
 import com.reactnativenavigation.views.TopBar;
10
 
10
 
11
-public class TestContainerLayout extends View implements ReactContainer {
11
+public class TestComponentLayout extends View implements ReactComponent {
12
 
12
 
13
     private final TopBar topBar;
13
     private final TopBar topBar;
14
     private final OptionsPresenter optionsPresenter;
14
     private final OptionsPresenter optionsPresenter;
15
 
15
 
16
-    public TestContainerLayout(final Context context) {
16
+    public TestComponentLayout(final Context context) {
17
 		super(context);
17
 		super(context);
18
         topBar = new TopBar(context, this);
18
         topBar = new TopBar(context, this);
19
         optionsPresenter = new OptionsPresenter(topBar, new View(context));
19
         optionsPresenter = new OptionsPresenter(topBar, new View(context));
38
 	}
38
 	}
39
 
39
 
40
 	@Override
40
 	@Override
41
-	public void sendContainerStart() {
41
+	public void sendComponentStart() {
42
 	}
42
 	}
43
 
43
 
44
 	@Override
44
 	@Override
45
-	public void sendContainerStop() {
45
+	public void sendComponentStop() {
46
 	}
46
 	}
47
 
47
 
48
     @Override
48
     @Override

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

4
 import android.view.View;
4
 import android.view.View;
5
 
5
 
6
 import com.reactnativenavigation.parse.NavigationOptions;
6
 import com.reactnativenavigation.parse.NavigationOptions;
7
-import com.reactnativenavigation.views.ReactContainer;
7
+import com.reactnativenavigation.views.ReactComponent;
8
 import com.reactnativenavigation.views.TopBar;
8
 import com.reactnativenavigation.views.TopBar;
9
 
9
 
10
-public class TestContainerView extends View implements ReactContainer {
10
+public class TestComponentView extends View implements ReactComponent {
11
 
11
 
12
 	private TopBar topBar;
12
 	private TopBar topBar;
13
 
13
 
14
-	public TestContainerView(final Context context) {
14
+	public TestComponentView(final Context context) {
15
 		super(context);
15
 		super(context);
16
 		topBar = new TopBar(context, this);
16
 		topBar = new TopBar(context, this);
17
 
17
 
32
 	}
32
 	}
33
 
33
 
34
 	@Override
34
 	@Override
35
-	public void sendContainerStart() {
35
+	public void sendComponentStart() {
36
 	}
36
 	}
37
 
37
 
38
 	@Override
38
 	@Override
39
-	public void sendContainerStop() {
39
+	public void sendComponentStop() {
40
 	}
40
 	}
41
 
41
 
42
     @Override
42
     @Override

+ 13
- 0
lib/android/app/src/test/java/com/reactnativenavigation/mocks/TestComponentViewCreator.java View File

1
+package com.reactnativenavigation.mocks;
2
+
3
+import android.app.Activity;
4
+
5
+import com.reactnativenavigation.viewcontrollers.ComponentViewController;
6
+import com.reactnativenavigation.viewcontrollers.ComponentViewController.ReactViewCreator;
7
+
8
+public class TestComponentViewCreator implements ReactViewCreator {
9
+	@Override
10
+	public ComponentViewController.IReactView create(final Activity activity, final String componentId, final String componentName) {
11
+		return new TestComponentLayout(activity);
12
+	}
13
+}

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

1
-package com.reactnativenavigation.mocks;
2
-
3
-import android.app.Activity;
4
-
5
-import com.reactnativenavigation.viewcontrollers.ContainerViewController;
6
-import com.reactnativenavigation.viewcontrollers.ContainerViewController.ReactViewCreator;
7
-
8
-public class TestContainerViewCreator implements ReactViewCreator {
9
-	@Override
10
-	public ContainerViewController.IReactView create(final Activity activity, final String containerId, final String containerName) {
11
-		return new TestContainerLayout(activity);
12
-	}
13
-}

+ 4
- 4
lib/android/app/src/test/java/com/reactnativenavigation/mocks/TopTabLayoutMock.java View File

3
 import android.content.Context;
3
 import android.content.Context;
4
 import android.view.View;
4
 import android.view.View;
5
 
5
 
6
-import com.reactnativenavigation.viewcontrollers.ContainerViewController;
6
+import com.reactnativenavigation.viewcontrollers.ComponentViewController;
7
 
7
 
8
-public class TopTabLayoutMock extends View implements ContainerViewController.IReactView {
8
+public class TopTabLayoutMock extends View implements ComponentViewController.IReactView {
9
 
9
 
10
     public TopTabLayoutMock(Context context) {
10
     public TopTabLayoutMock(Context context) {
11
         super(context);
11
         super(context);
27
     }
27
     }
28
 
28
 
29
     @Override
29
     @Override
30
-    public void sendContainerStart() {
30
+    public void sendComponentStart() {
31
 
31
 
32
     }
32
     }
33
 
33
 
34
     @Override
34
     @Override
35
-    public void sendContainerStop() {
35
+    public void sendComponentStop() {
36
 
36
 
37
     }
37
     }
38
 
38
 

+ 7
- 7
lib/android/app/src/test/java/com/reactnativenavigation/parse/LayoutNodeParserTest.java View File

10
 public class LayoutNodeParserTest extends BaseTest {
10
 public class LayoutNodeParserTest extends BaseTest {
11
 	@Test
11
 	@Test
12
 	public void dto() throws Exception {
12
 	public void dto() throws Exception {
13
-		LayoutNode node = new LayoutNode("the id", LayoutNode.Type.Container);
13
+		LayoutNode node = new LayoutNode("the id", LayoutNode.Type.Component);
14
 		assertThat(node.id).isEqualTo("the id");
14
 		assertThat(node.id).isEqualTo("the id");
15
-		assertThat(node.type).isEqualTo(LayoutNode.Type.Container);
15
+		assertThat(node.type).isEqualTo(LayoutNode.Type.Component);
16
 		assertThat(node.data.keys()).isEmpty();
16
 		assertThat(node.data.keys()).isEmpty();
17
 		assertThat(node.children).isEmpty();
17
 		assertThat(node.children).isEmpty();
18
 	}
18
 	}
19
 
19
 
20
 	@Test
20
 	@Test
21
 	public void parseType() throws Exception {
21
 	public void parseType() throws Exception {
22
-		assertThat(LayoutNode.Type.valueOf("Container")).isEqualTo(LayoutNode.Type.Container);
22
+		assertThat(LayoutNode.Type.valueOf("Component")).isEqualTo(LayoutNode.Type.Component);
23
 	}
23
 	}
24
 
24
 
25
 	@Test(expected = RuntimeException.class)
25
 	@Test(expected = RuntimeException.class)
30
 	@Test
30
 	@Test
31
 	public void parseFromTree() throws Exception {
31
 	public void parseFromTree() throws Exception {
32
 		JSONObject tree = new JSONObject("{id: node1, " +
32
 		JSONObject tree = new JSONObject("{id: node1, " +
33
-				"type: ContainerStack, " +
33
+				"type: ComponentStack, " +
34
 				"data: {dataKey: dataValue}, " +
34
 				"data: {dataKey: dataValue}, " +
35
-				"children: [{id: childId1, type: Container}]}");
35
+				"children: [{id: childId1, type: Component}]}");
36
 
36
 
37
 		LayoutNode result = LayoutNodeParser.parse(tree);
37
 		LayoutNode result = LayoutNodeParser.parse(tree);
38
 
38
 
39
 		assertThat(result).isNotNull();
39
 		assertThat(result).isNotNull();
40
 		assertThat(result.id).isEqualTo("node1");
40
 		assertThat(result.id).isEqualTo("node1");
41
-		assertThat(result.type).isEqualTo(LayoutNode.Type.ContainerStack);
41
+		assertThat(result.type).isEqualTo(LayoutNode.Type.ComponentStack);
42
 		assertThat(result.data.length()).isEqualTo(1);
42
 		assertThat(result.data.length()).isEqualTo(1);
43
 		assertThat(result.data.getString("dataKey")).isEqualTo("dataValue");
43
 		assertThat(result.data.getString("dataKey")).isEqualTo("dataValue");
44
 		assertThat(result.children).hasSize(1);
44
 		assertThat(result.children).hasSize(1);
45
 		assertThat(result.children.get(0).id).isEqualTo("childId1");
45
 		assertThat(result.children.get(0).id).isEqualTo("childId1");
46
-		assertThat(result.children.get(0).type).isEqualTo(LayoutNode.Type.Container);
46
+		assertThat(result.children.get(0).type).isEqualTo(LayoutNode.Type.Component);
47
 		assertThat(result.children.get(0).data.keys()).isEmpty();
47
 		assertThat(result.children.get(0).data.keys()).isEmpty();
48
 		assertThat(result.children.get(0).children).isEmpty();
48
 		assertThat(result.children.get(0).children).isEmpty();
49
 	}
49
 	}

+ 1
- 1
lib/android/app/src/test/java/com/reactnativenavigation/parse/NavigationOptionsTest.java View File

27
     private static final NavigationOptions.BooleanOptions BOTTOM_TABS_ANIMATE_HIDE = True;
27
     private static final NavigationOptions.BooleanOptions BOTTOM_TABS_ANIMATE_HIDE = True;
28
     private static final NavigationOptions.BooleanOptions BOTTOM_TABS_HIDDEN = True;
28
     private static final NavigationOptions.BooleanOptions BOTTOM_TABS_HIDDEN = True;
29
     private static final int BOTTOM_TABS_BADGE = 3;
29
     private static final int BOTTOM_TABS_BADGE = 3;
30
-    private static final String BOTTOM_TABS_CURRENT_TAB_ID = "ContainerId";
30
+    private static final String BOTTOM_TABS_CURRENT_TAB_ID = "ComponentId";
31
     private static final int BOTTOM_TABS_CURRENT_TAB_INDEX = 1;
31
     private static final int BOTTOM_TABS_CURRENT_TAB_INDEX = 1;
32
     private TypefaceLoader mockLoader;
32
     private TypefaceLoader mockLoader;
33
 
33
 

lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/ContainerViewControllerTest.java → lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/ComponentViewControllerTest.java View File

3
 import android.app.Activity;
3
 import android.app.Activity;
4
 
4
 
5
 import com.reactnativenavigation.BaseTest;
5
 import com.reactnativenavigation.BaseTest;
6
-import com.reactnativenavigation.mocks.TestContainerLayout;
6
+import com.reactnativenavigation.mocks.TestComponentLayout;
7
 import com.reactnativenavigation.parse.NavigationOptions;
7
 import com.reactnativenavigation.parse.NavigationOptions;
8
 
8
 
9
 import org.junit.Test;
9
 import org.junit.Test;
14
 import static org.mockito.Mockito.verify;
14
 import static org.mockito.Mockito.verify;
15
 import static org.mockito.Mockito.when;
15
 import static org.mockito.Mockito.when;
16
 
16
 
17
-public class ContainerViewControllerTest extends BaseTest {
18
-	private ContainerViewController uut;
19
-	private ContainerViewController.IReactView view;
17
+public class ComponentViewControllerTest extends BaseTest {
18
+	private ComponentViewController uut;
19
+	private ComponentViewController.IReactView view;
20
 
20
 
21
 	@Override
21
 	@Override
22
 	public void beforeEach() {
22
 	public void beforeEach() {
23
 		super.beforeEach();
23
 		super.beforeEach();
24
 		Activity activity = newActivity();
24
 		Activity activity = newActivity();
25
-		view = spy(new TestContainerLayout(activity));
26
-		uut = new ContainerViewController(activity, "containerId1", "containerName", new ContainerViewController.ReactViewCreator() {
25
+		view = spy(new TestComponentLayout(activity));
26
+		uut = new ComponentViewController(activity, "componentId1", "componentName", new ComponentViewController.ReactViewCreator() {
27
 			@Override
27
 			@Override
28
-			public ContainerViewController.IReactView create(final Activity activity1, final String containerId, final String containerName) {
28
+			public ComponentViewController.IReactView create(final Activity activity1, final String componentId, final String componentName) {
29
 				return view;
29
 				return view;
30
 			}
30
 			}
31
 		}, new NavigationOptions());
31
 		}, new NavigationOptions());
32
 	}
32
 	}
33
 
33
 
34
 	@Test
34
 	@Test
35
-	public void createsViewFromContainerViewCreator() throws Exception {
35
+	public void createsViewFromComponentViewCreator() throws Exception {
36
 		assertThat(uut.getView()).isSameAs(view);
36
 		assertThat(uut.getView()).isSameAs(view);
37
 	}
37
 	}
38
 
38
 
39
 	@Test
39
 	@Test
40
-	public void containerViewDestroyedOnDestroy() throws Exception {
40
+	public void componentViewDestroyedOnDestroy() throws Exception {
41
 		uut.ensureViewIsCreated();
41
 		uut.ensureViewIsCreated();
42
 		verify(view, times(0)).destroy();
42
 		verify(view, times(0)).destroy();
43
 		uut.destroy();
43
 		uut.destroy();
45
 	}
45
 	}
46
 
46
 
47
 	@Test
47
 	@Test
48
-	public void lifecycleMethodsSentToContainerView() throws Exception {
48
+	public void lifecycleMethodsSentToComponentView() throws Exception {
49
 		uut.ensureViewIsCreated();
49
 		uut.ensureViewIsCreated();
50
-		verify(view, times(0)).sendContainerStart();
51
-		verify(view, times(0)).sendContainerStop();
50
+		verify(view, times(0)).sendComponentStart();
51
+		verify(view, times(0)).sendComponentStop();
52
 		uut.onViewAppeared();
52
 		uut.onViewAppeared();
53
-		verify(view, times(1)).sendContainerStart();
54
-		verify(view, times(0)).sendContainerStop();
53
+		verify(view, times(1)).sendComponentStart();
54
+		verify(view, times(0)).sendComponentStop();
55
 		uut.onViewDisappear();
55
 		uut.onViewDisappear();
56
-		verify(view, times(1)).sendContainerStart();
57
-		verify(view, times(1)).sendContainerStop();
56
+		verify(view, times(1)).sendComponentStart();
57
+		verify(view, times(1)).sendComponentStop();
58
 	}
58
 	}
59
 
59
 
60
 	@Test
60
 	@Test
61
-	public void isViewShownOnlyIfContainerViewIsReady() throws Exception {
61
+	public void isViewShownOnlyIfComponentViewIsReady() throws Exception {
62
 		assertThat(uut.isViewShown()).isFalse();
62
 		assertThat(uut.isViewShown()).isFalse();
63
 		uut.ensureViewIsCreated();
63
 		uut.ensureViewIsCreated();
64
 		when(view.asView().isShown()).thenReturn(true);
64
 		when(view.asView().isShown()).thenReturn(true);

+ 6
- 6
lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/NavigatorTest.java View File

5
 
5
 
6
 import com.reactnativenavigation.BaseTest;
6
 import com.reactnativenavigation.BaseTest;
7
 import com.reactnativenavigation.mocks.MockPromise;
7
 import com.reactnativenavigation.mocks.MockPromise;
8
-import com.reactnativenavigation.mocks.SimpleContainerViewController;
8
+import com.reactnativenavigation.mocks.SimpleComponentViewController;
9
 import com.reactnativenavigation.mocks.SimpleViewController;
9
 import com.reactnativenavigation.mocks.SimpleViewController;
10
 import com.reactnativenavigation.mocks.TestStackAnimator;
10
 import com.reactnativenavigation.mocks.TestStackAnimator;
11
 import com.reactnativenavigation.parse.NavigationOptions;
11
 import com.reactnativenavigation.parse.NavigationOptions;
195
 
195
 
196
 	@Test
196
 	@Test
197
 	public void setOptions_CallsApplyNavigationOptions() {
197
 	public void setOptions_CallsApplyNavigationOptions() {
198
-		ContainerViewController containerVc = new SimpleContainerViewController(activity, "theId");
199
-		uut.setRoot(containerVc);
200
-		assertThat(containerVc.getNavigationOptions().topBarOptions.title).isEmpty();
198
+		ComponentViewController componentVc = new SimpleComponentViewController(activity, "theId");
199
+		uut.setRoot(componentVc);
200
+		assertThat(componentVc.getNavigationOptions().topBarOptions.title).isEmpty();
201
 
201
 
202
 		NavigationOptions options = new NavigationOptions();
202
 		NavigationOptions options = new NavigationOptions();
203
 		options.topBarOptions.title = "new title";
203
 		options.topBarOptions.title = "new title";
204
 
204
 
205
 		uut.setOptions("theId", options);
205
 		uut.setOptions("theId", options);
206
-		assertThat(containerVc.getNavigationOptions().topBarOptions.title).isEqualTo("new title");
206
+		assertThat(componentVc.getNavigationOptions().topBarOptions.title).isEqualTo("new title");
207
 	}
207
 	}
208
 
208
 
209
 	@Test
209
 	@Test
210
-	public void setOptions_AffectsOnlyContainerViewControllers() {
210
+	public void setOptions_AffectsOnlyComponentViewControllers() {
211
 		uut.setOptions("some unknown child id", new NavigationOptions());
211
 		uut.setOptions("some unknown child id", new NavigationOptions());
212
 	}
212
 	}
213
 
213
 

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

6
 import android.view.View;
6
 import android.view.View;
7
 
7
 
8
 import com.reactnativenavigation.BaseTest;
8
 import com.reactnativenavigation.BaseTest;
9
-import com.reactnativenavigation.mocks.TestContainerLayout;
9
+import com.reactnativenavigation.mocks.TestComponentLayout;
10
 import com.reactnativenavigation.parse.NavigationOptions;
10
 import com.reactnativenavigation.parse.NavigationOptions;
11
 
11
 
12
 import org.junit.Test;
12
 import org.junit.Test;
16
 
16
 
17
 public class OptionsApplyingTest extends BaseTest {
17
 public class OptionsApplyingTest extends BaseTest {
18
 	private Activity activity;
18
 	private Activity activity;
19
-	private ContainerViewController uut;
20
-	private ContainerViewController.IReactView view;
19
+	private ComponentViewController uut;
20
+	private ComponentViewController.IReactView view;
21
 	private NavigationOptions initialNavigationOptions;
21
 	private NavigationOptions initialNavigationOptions;
22
 
22
 
23
 	@Override
23
 	@Override
25
 		super.beforeEach();
25
 		super.beforeEach();
26
 		activity = newActivity();
26
 		activity = newActivity();
27
 		initialNavigationOptions = new NavigationOptions();
27
 		initialNavigationOptions = new NavigationOptions();
28
-		view = spy(new TestContainerLayout(activity));
29
-		uut = new ContainerViewController(activity,
30
-                "containerId1",
31
-                "containerName",
32
-                (activity1, containerId, containerName) -> view,
28
+		view = spy(new TestComponentLayout(activity));
29
+		uut = new ComponentViewController(activity,
30
+                "componentId1",
31
+                "componentName",
32
+                (activity1, componentId, componentName) -> view,
33
                 initialNavigationOptions
33
                 initialNavigationOptions
34
         );
34
         );
35
 		uut.ensureViewIsCreated();
35
 		uut.ensureViewIsCreated();
134
 
134
 
135
 		assertThat(uut.getTopBar().getVisibility()).isEqualTo(View.GONE);
135
 		assertThat(uut.getTopBar().getVisibility()).isEqualTo(View.GONE);
136
 	}
136
 	}
137
-}
137
+}

+ 4
- 4
lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/TopTabControllerTest.java View File

26
         view = spy(new TopTabLayoutMock(activity));
26
         view = spy(new TopTabLayoutMock(activity));
27
         initialOptions = new NavigationOptions();
27
         initialOptions = new NavigationOptions();
28
         uut = new TopTabController(activity,
28
         uut = new TopTabController(activity,
29
-                "containerId",
30
-                "containerName",
31
-                (activity1, containerId, containerName) -> view,
29
+                "componentId",
30
+                "componentName",
31
+                (activity1, componentId, componentName) -> view,
32
                 initialOptions
32
                 initialOptions
33
         );
33
         );
34
-        parentController = spy(new TopTabsControllerMock(activity, "parentContainerId"));
34
+        parentController = spy(new TopTabsControllerMock(activity, "parentComponentId"));
35
         uut.setParentController(parentController);
35
         uut.setParentController(parentController);
36
     }
36
     }
37
 
37
 

+ 12
- 12
lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/TopTabsViewControllerTest.java View File

6
 import com.reactnativenavigation.BaseTest;
6
 import com.reactnativenavigation.BaseTest;
7
 import com.reactnativenavigation.mocks.TopTabLayoutMock;
7
 import com.reactnativenavigation.mocks.TopTabLayoutMock;
8
 import com.reactnativenavigation.parse.NavigationOptions;
8
 import com.reactnativenavigation.parse.NavigationOptions;
9
-import com.reactnativenavigation.viewcontrollers.ContainerViewController.IReactView;
9
+import com.reactnativenavigation.viewcontrollers.ComponentViewController.IReactView;
10
 import com.reactnativenavigation.viewcontrollers.toptabs.TopTabController;
10
 import com.reactnativenavigation.viewcontrollers.toptabs.TopTabController;
11
 import com.reactnativenavigation.viewcontrollers.toptabs.TopTabsAdapter;
11
 import com.reactnativenavigation.viewcontrollers.toptabs.TopTabsAdapter;
12
 import com.reactnativenavigation.viewcontrollers.toptabs.TopTabsController;
12
 import com.reactnativenavigation.viewcontrollers.toptabs.TopTabsController;
46
 
46
 
47
         TopTabsLayoutCreator layoutCreator = Mockito.mock(TopTabsLayoutCreator.class);
47
         TopTabsLayoutCreator layoutCreator = Mockito.mock(TopTabsLayoutCreator.class);
48
         Mockito.when(layoutCreator.create()).thenReturn(topTabsLayout);
48
         Mockito.when(layoutCreator.create()).thenReturn(topTabsLayout);
49
-        uut = new TopTabsController(activity, "containerId", tabControllers, layoutCreator, navigationOptions);
49
+        uut = new TopTabsController(activity, "componentId", tabControllers, layoutCreator, navigationOptions);
50
     }
50
     }
51
 
51
 
52
     private void createTabs(Activity activity) {
52
     private void createTabs(Activity activity) {
57
             tabControllers.add(spy(new TopTabController(activity,
57
             tabControllers.add(spy(new TopTabController(activity,
58
                     "idTab" + i,
58
                     "idTab" + i,
59
                     "tab" + i,
59
                     "tab" + i,
60
-                    (activity1, containerId, containerName) -> reactView,
60
+                    (activity1, componentId, componentName) -> reactView,
61
                     tabOptions.get(i))
61
                     tabOptions.get(i))
62
             ));
62
             ));
63
         }
63
         }
64
     }
64
     }
65
 
65
 
66
     @Test
66
     @Test
67
-    public void createsViewFromContainerViewCreator() throws Exception {
67
+    public void createsViewFromComponentViewCreator() throws Exception {
68
         uut.ensureViewIsCreated();
68
         uut.ensureViewIsCreated();
69
         for (int i = 0; i < SIZE; i++) {
69
         for (int i = 0; i < SIZE; i++) {
70
             verify(tabControllers.get(i), times(1)).createView();
70
             verify(tabControllers.get(i), times(1)).createView();
72
     }
72
     }
73
 
73
 
74
     @Test
74
     @Test
75
-    public void containerViewDestroyedOnDestroy() throws Exception {
75
+    public void componentViewDestroyedOnDestroy() throws Exception {
76
         uut.ensureViewIsCreated();
76
         uut.ensureViewIsCreated();
77
         TopTabsLayout topTabs = (TopTabsLayout) uut.getView();
77
         TopTabsLayout topTabs = (TopTabsLayout) uut.getView();
78
         for (int i = 0; i < SIZE; i++) {
78
         for (int i = 0; i < SIZE; i++) {
91
         TopTabLayoutMock selectedTab = tabs.get(1);
91
         TopTabLayoutMock selectedTab = tabs.get(1);
92
         uut.onViewAppeared();
92
         uut.onViewAppeared();
93
         uut.switchToTab(1);
93
         uut.switchToTab(1);
94
-        verify(initialTab, times(1)).sendContainerStop();
95
-        verify(selectedTab, times(1)).sendContainerStart();
96
-        verify(selectedTab, times(0)).sendContainerStop();
94
+        verify(initialTab, times(1)).sendComponentStop();
95
+        verify(selectedTab, times(1)).sendComponentStart();
96
+        verify(selectedTab, times(0)).sendComponentStop();
97
     }
97
     }
98
 
98
 
99
     @Test
99
     @Test
102
         uut.onViewAppeared();
102
         uut.onViewAppeared();
103
         uut.switchToTab(1);
103
         uut.switchToTab(1);
104
         uut.switchToTab(0);
104
         uut.switchToTab(0);
105
-        verify(tabs.get(0), times(1)).sendContainerStop();
106
-        verify(tabs.get(0), times(2)).sendContainerStart();
107
-        verify(tabs.get(1), times(1)).sendContainerStart();
108
-        verify(tabs.get(1), times(1)).sendContainerStop();
105
+        verify(tabs.get(0), times(1)).sendComponentStop();
106
+        verify(tabs.get(0), times(2)).sendComponentStart();
107
+        verify(tabs.get(1), times(1)).sendComponentStart();
108
+        verify(tabs.get(1), times(1)).sendComponentStop();
109
     }
109
     }
110
 
110
 
111
     @Test
111
     @Test