Browse Source

Merge branch 'newAPI' into v2

Daniel Zlotin 6 years ago
parent
commit
da2007bf26
100 changed files with 1324 additions and 1598 deletions
  1. 11
    11
      AndroidE2E/app/src/androidTest/java/com/reactnativenavigation/e2e/androide2e/BaseTest.java
  2. 16
    22
      AndroidE2E/app/src/androidTest/java/com/reactnativenavigation/e2e/androide2e/OverlayTest.java
  3. 9
    13
      AndroidE2E/app/src/androidTest/java/com/reactnativenavigation/e2e/androide2e/TopTabsTest.java
  4. 5
    5
      README.md
  5. 1
    1
      docs/docs/Container.md
  6. 2
    2
      e2e/ScreenStyle.test.js
  7. 2
    2
      integration/redux/MyComponent.js
  8. 5
    5
      integration/redux/Redux.test.js
  9. 2
    2
      integration/remx/MyComponent.js
  10. 5
    5
      integration/remx/remx.test.js
  11. 27
    27
      lib/android/app/src/main/java/com/reactnativenavigation/parse/LayoutFactory.java
  12. 4
    6
      lib/android/app/src/main/java/com/reactnativenavigation/parse/LayoutNode.java
  13. 0
    2
      lib/android/app/src/main/java/com/reactnativenavigation/parse/NavigationOptions.java
  14. 3
    3
      lib/android/app/src/main/java/com/reactnativenavigation/parse/OverlayOptions.java
  15. 7
    7
      lib/android/app/src/main/java/com/reactnativenavigation/react/NavigationEvent.java
  16. 12
    12
      lib/android/app/src/main/java/com/reactnativenavigation/react/NavigationModule.java
  17. 20
    0
      lib/android/app/src/main/java/com/reactnativenavigation/react/ReactComponentViewCreator.java
  18. 0
    20
      lib/android/app/src/main/java/com/reactnativenavigation/react/ReactContainerViewCreator.java
  19. 14
    14
      lib/android/app/src/main/java/com/reactnativenavigation/react/ReactView.java
  20. 100
    0
      lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/ComponentViewController.java
  21. 0
    105
      lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/ContainerViewController.java
  22. 8
    8
      lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/ModalStack.java
  23. 8
    8
      lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/Navigator.java
  24. 1
    1
      lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/overlay/CustomOverlay.java
  25. 6
    6
      lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/overlay/DialogViewController.java
  26. 8
    8
      lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/toptabs/TopTabController.java
  27. 1
    1
      lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/toptabs/TopTabsAdapter.java
  28. 4
    4
      lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/toptabs/TopTabsController.java
  29. 3
    3
      lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/toptabs/TopTabsViewPager.java
  30. 1
    1
      lib/android/app/src/main/java/com/reactnativenavigation/views/Component.java
  31. 15
    18
      lib/android/app/src/main/java/com/reactnativenavigation/views/ComponentLayout.java
  32. 22
    0
      lib/android/app/src/main/java/com/reactnativenavigation/views/ComponentViewCreator.java
  33. 0
    24
      lib/android/app/src/main/java/com/reactnativenavigation/views/ContainerViewCreator.java
  34. 4
    4
      lib/android/app/src/main/java/com/reactnativenavigation/views/CustomDialog.java
  35. 6
    0
      lib/android/app/src/main/java/com/reactnativenavigation/views/ReactComponent.java
  36. 0
    6
      lib/android/app/src/main/java/com/reactnativenavigation/views/ReactContainer.java
  37. 5
    5
      lib/android/app/src/main/java/com/reactnativenavigation/views/TitleBarButton.java
  38. 15
    25
      lib/android/app/src/main/java/com/reactnativenavigation/views/TopBar.java
  39. 5
    5
      lib/android/app/src/main/java/com/reactnativenavigation/views/TopTab.java
  40. 5
    5
      lib/android/app/src/main/java/com/reactnativenavigation/views/TopTabCreator.java
  41. 1
    1
      lib/android/app/src/main/java/com/reactnativenavigation/views/TopTabsLayout.java
  42. 12
    0
      lib/android/app/src/test/java/com/reactnativenavigation/mocks/SimpleComponentViewController.java
  43. 0
    12
      lib/android/app/src/test/java/com/reactnativenavigation/mocks/SimpleContainerViewController.java
  44. 5
    5
      lib/android/app/src/test/java/com/reactnativenavigation/mocks/TestComponentLayout.java
  45. 11
    11
      lib/android/app/src/test/java/com/reactnativenavigation/mocks/TestComponentView.java
  46. 13
    0
      lib/android/app/src/test/java/com/reactnativenavigation/mocks/TestComponentViewCreator.java
  47. 0
    13
      lib/android/app/src/test/java/com/reactnativenavigation/mocks/TestContainerViewCreator.java
  48. 4
    4
      lib/android/app/src/test/java/com/reactnativenavigation/mocks/TopTabLayoutMock.java
  49. 7
    7
      lib/android/app/src/test/java/com/reactnativenavigation/parse/LayoutNodeParserTest.java
  50. 1
    1
      lib/android/app/src/test/java/com/reactnativenavigation/parse/NavigationOptionsTest.java
  51. 0
    1
      lib/android/app/src/test/java/com/reactnativenavigation/parse/OverlayOptionsTest.java
  52. 17
    17
      lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/ComponentViewControllerTest.java
  53. 6
    6
      lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/NavigatorTest.java
  54. 51
    51
      lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/OptionsApplyingTest.java
  55. 4
    4
      lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/TopTabControllerTest.java
  56. 15
    15
      lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/TopTabsViewControllerTest.java
  57. 7
    7
      lib/ios/RNNAnimator.m
  58. 1
    1
      lib/ios/RNNBottomTabsOptions.m
  59. 18
    18
      lib/ios/RNNBridgeModule.m
  60. 6
    6
      lib/ios/RNNCommandsHandler.h
  61. 15
    15
      lib/ios/RNNCommandsHandler.m
  62. 12
    12
      lib/ios/RNNControllerFactory.m
  63. 3
    3
      lib/ios/RNNEventEmitter.h
  64. 9
    9
      lib/ios/RNNEventEmitter.m
  65. 11
    11
      lib/ios/RNNInteractivePopAnimator.m
  66. 2
    3
      lib/ios/RNNLayoutNode.h
  67. 4
    8
      lib/ios/RNNLayoutNode.m
  68. 1
    1
      lib/ios/RNNModalManager.h
  69. 5
    5
      lib/ios/RNNModalManager.m
  70. 1
    1
      lib/ios/RNNNavigationButtons.m
  71. 12
    12
      lib/ios/RNNNavigationOptions.m
  72. 4
    4
      lib/ios/RNNNavigationStackManager.h
  73. 10
    10
      lib/ios/RNNNavigationStackManager.m
  74. 1
    1
      lib/ios/RNNReactRootViewCreator.m
  75. 3
    3
      lib/ios/RNNRootViewController.h
  76. 18
    18
      lib/ios/RNNRootViewController.m
  77. 5
    5
      lib/ios/RNNStore.h
  78. 17
    17
      lib/ios/RNNStore.m
  79. 1
    1
      lib/ios/RNNTabBarController.h
  80. 2
    2
      lib/ios/RNNTabBarController.m
  81. 3
    3
      lib/ios/ReactNativeNavigationTests/RNNCommandsHandlerTest.m
  82. 18
    18
      lib/ios/ReactNativeNavigationTests/RNNControllerFactoryTest.m
  83. 12
    12
      lib/ios/ReactNativeNavigationTests/RNNNavigationStackManagerTest.m
  84. 3
    3
      lib/ios/ReactNativeNavigationTests/RNNRootViewControllerTest.m
  85. 31
    31
      lib/ios/ReactNativeNavigationTests/RNNStoreTest.m
  86. 36
    39
      lib/src/Navigation.js
  87. 13
    13
      lib/src/adapters/NativeCommandsSender.js
  88. 6
    6
      lib/src/adapters/NativeEventsReceiver.js
  89. 27
    27
      lib/src/commands/Commands.js
  90. 75
    80
      lib/src/commands/Commands.test.js
  91. 125
    0
      lib/src/commands/LayoutExamples.js
  92. 15
    15
      lib/src/commands/LayoutTreeCrawler.js
  93. 67
    67
      lib/src/commands/LayoutTreeCrawler.test.js
  94. 54
    60
      lib/src/commands/LayoutTreeParser.js
  95. 99
    302
      lib/src/commands/LayoutTreeParser.test.js
  96. 3
    5
      lib/src/commands/LayoutTypes.js
  97. 4
    4
      lib/src/commands/OptionsProcessor.js
  98. 56
    58
      lib/src/commands/OptionsProcessor.test.js
  99. 0
    138
      lib/src/commands/SimpleLayouts.js
  100. 0
    0
      lib/src/components/ComponentRegistry.js

+ 11
- 11
AndroidE2E/app/src/androidTest/java/com/reactnativenavigation/e2e/androide2e/BaseTest.java View File

@@ -89,17 +89,17 @@ public abstract class BaseTest {
89 89
         return bitmap;
90 90
     }
91 91
 
92
-    public void swipeOpenFromLeft() {
93
-        int w = device().getDisplayWidth();
94
-        int h = device().getDisplayHeight();
95
-        device().swipe(5, h / 2, w / 2, h / 2, 10);
96
-    }
97
-
98
-    public void swipeOpenFromRight() {
99
-        int w = device().getDisplayWidth();
100
-        int h = device().getDisplayHeight();
101
-        device().swipe(w - 5, h / 2, w / 2, h / 2, 10);
102
-    }
92
+	public void swipeOpenFromLeft() {
93
+		int w = device().getDisplayWidth();
94
+		int h = device().getDisplayHeight();
95
+		device().swipe(5, h / 2, w / 2, h / 2, 20);
96
+	}
97
+
98
+	public void swipeOpenFromRight() {
99
+		int w = device().getDisplayWidth();
100
+		int h = device().getDisplayHeight();
101
+		device().swipe(w - 5, h / 2, w / 2, h / 2, 20);
102
+	}
103 103
 
104 104
     public void swipeUp() {
105 105
         int w = device().getDisplayWidth();

+ 16
- 22
AndroidE2E/app/src/androidTest/java/com/reactnativenavigation/e2e/androide2e/OverlayTest.java View File

@@ -1,26 +1,20 @@
1 1
 package com.reactnativenavigation.e2e.androide2e;
2 2
 
3
-import android.support.test.uiautomator.By;
3
+public class OverlayTest {//extends BaseTest {
4 4
 
5
-import org.junit.Test;
6
-
7
-import static org.assertj.core.api.Java6Assertions.assertThat;
8
-
9
-public class OverlayTest extends BaseTest {
10
-
11
-	@Test
12
-	public void testOverlayAlertAppear() throws Exception {
13
-		elementByText("PUSH OPTIONS SCREEN").click();
14
-		elementByText("SHOW CUSTOM ALERT").click();
15
-		assertExists(By.text("Test view"));
16
-		elementByText("OK").click();
17
-		assertExists(By.text("Static Title"));
18
-	}
19
-
20
-	@Test
21
-	public void testSnackbarAppear() throws Exception {
22
-		elementByText("PUSH OPTIONS SCREEN").click();
23
-		elementByText("SHOW SNACKBAR").click();
24
-		assertExists(By.text("Test!"));
25
-	}
5
+//	@Test
6
+//	public void testOverlayAlertAppear() throws Exception {
7
+//		elementByText("PUSH OPTIONS SCREEN").click();
8
+//		elementByText("SHOW CUSTOM ALERT").click();
9
+//		assertExists(By.text("Test view"));
10
+//		elementByText("OK").click();
11
+//		assertExists(By.text("Static Title"));
12
+//	}
13
+//
14
+//	@Test
15
+//	public void testSnackbarAppear() throws Exception {
16
+//		elementByText("PUSH OPTIONS SCREEN").click();
17
+//		elementByText("SHOW SNACKBAR").click();
18
+//		assertExists(By.text("Test!"));
19
+//	}
26 20
 }

+ 9
- 13
AndroidE2E/app/src/androidTest/java/com/reactnativenavigation/e2e/androide2e/TopTabsTest.java View File

@@ -1,16 +1,12 @@
1 1
 package com.reactnativenavigation.e2e.androide2e;
2 2
 
3
-import android.support.test.uiautomator.By;
4
-
5
-import org.junit.Test;
6
-
7
-public class TopTabsTest extends BaseTest {
8
-
9
-    @Test
10
-    public void tabsCanBeSwiped() throws Exception {
11
-        elementByText("PUSH TOP TABS SCREEN").click();
12
-        assertExists(By.text("This is top tab 1"));
13
-        swipeOpenFromRight();
14
-        assertExists(By.text("This is top tab 2"));
15
-    }
3
+public class TopTabsTest {//extends BaseTest {
4
+
5
+//    @Test
6
+//    public void tabsCanBeSwiped() throws Exception {
7
+//        elementByText("PUSH TOP TABS SCREEN").click();
8
+//        assertExists(By.text("This is top tab 1"));
9
+//        swipeOpenFromRight();
10
+//        assertExists(By.text("This is top tab 2"));
11
+//    }
16 12
 }

+ 5
- 5
README.md View File

@@ -36,14 +36,14 @@ v2 is written in Test Driven Development. We have a test for every feature inclu
36 36
 
37 37
 ## v2 Roadmap
38 38
 
39
-### Current Priorities 
39
+### Current Priorities
40 40
 
41 41
 1) buttons in Android
42 42
 2) showOverlay in iOS
43 43
 3) showOverlay in Android
44 44
 4) async commands
45
-5) currentTab 
46
-6) change navigationOptions to be nested
45
+5) currentTab
46
+6) change Options to be nested
47 47
 7) topTabs in both platforms, with API implications
48 48
 
49 49
 ### Top API
@@ -132,7 +132,7 @@ v2 is written in Test Driven Development. We have a test for every feature inclu
132 132
 | sideMenuVisible          |        [Contribute](/docs/docs/CONTRIBUTING.md)   | [Contribute](/docs/docs/CONTRIBUTING.md) |
133 133
 
134 134
 
135
-## v1 vs v2 Feature Comparison  
135
+## v1 vs v2 Feature Comparison
136 136
 v2 currently supports most of react-native-navigation’s basic functionality but it is still behind v1.
137 137
 Here is the full comparison of features between v1 and v2 (will be updated regularly):
138 138
 ### Top Level API
@@ -206,5 +206,5 @@ Note:  v1 properties with names beginning with 'navBar' are replaced in v2 with
206 206
 | customTransition(shared element)       |     :x:  |     WIP @bogobogo     | [Contribute](/docs/docs/CONTRIBUTING.md)|
207 207
 | splitViewScreen       |     :x:  |    [Contribute](/docs/docs/CONTRIBUTING.md)      | [Contribute](/docs/docs/CONTRIBUTING.md)|
208 208
 
209
-Element transitions, adding buttons and styles are not yet implemented. [Contribute](/docs/docs/CONTRIBUTING.md)  
209
+Element transitions, adding buttons and styles are not yet implemented. [Contribute](/docs/docs/CONTRIBUTING.md)
210 210
 

+ 1
- 1
docs/docs/Container.md View File

@@ -7,5 +7,5 @@
7 7
 | name | <code>string</code> | The container's registered name |
8 8
 | topTabs | [<code>Array.&lt;Container&gt;</code>](#Container) |  |
9 9
 | passProps | <code>object</code> | props |
10
-| navigationOptions | <a href="https://wix.github.io/react-native-navigation/v2/#/docs/NavigationOptions">NavigationOptions</a> |  |
10
+| options | <a href="https://wix.github.io/react-native-navigation/v2/#/docs/Options">Options</a> |  |
11 11
 

+ 2
- 2
e2e/ScreenStyle.test.js View File

@@ -8,12 +8,12 @@ describe('screen style', () => {
8 8
     await device.relaunchApp();
9 9
   });
10 10
 
11
-  it('declare a navigationOptions on container component', async () => {
11
+  it('declare a options on component component', async () => {
12 12
     await elementById(testIDs.PUSH_OPTIONS_BUTTON).tap();
13 13
     await expect(element(by.label('Static Title'))).toBeVisible();
14 14
   });
15 15
 
16
-  it('change title on container component', async () => {
16
+  it('change title on component component', async () => {
17 17
     await elementById(testIDs.PUSH_OPTIONS_BUTTON).tap();
18 18
     await expect(element(by.label('Static Title'))).toBeVisible();
19 19
     await elementById(testIDs.DYNAMIC_OPTIONS_BUTTON).tap();

integration/redux/MyContainer.js → integration/redux/MyComponent.js View File

@@ -5,7 +5,7 @@ const { Text } = require('react-native');
5 5
 const { connect } = require('react-redux');
6 6
 const store = require('./MyStore');
7 7
 
8
-class MyContainer extends Component {
8
+class MyComponent extends Component {
9 9
   render() {
10 10
     if (this.props.renderCountIncrement) {
11 11
       this.props.renderCountIncrement();
@@ -28,4 +28,4 @@ function mapStateToProps(state) {
28 28
   };
29 29
 }
30 30
 
31
-module.exports = connect(mapStateToProps)(MyContainer);
31
+module.exports = connect(mapStateToProps)(MyComponent);

+ 5
- 5
integration/redux/Redux.test.js View File

@@ -4,18 +4,18 @@ const renderer = require('react-test-renderer');
4 4
 const { Provider } = require('react-redux');
5 5
 
6 6
 describe('redux support', () => {
7
-  let MyConnectedContainer;
7
+  let MyConnectedComponent;
8 8
   let store;
9 9
 
10 10
   beforeEach(() => {
11
-    MyConnectedContainer = require('./MyContainer');
11
+    MyConnectedComponent = require('./MyComponent');
12 12
     store = require('./MyStore');
13 13
   });
14 14
 
15 15
   it('renders normally', () => {
16 16
     const tree = renderer.create(
17 17
       <Provider store={store.reduxStore}>
18
-        <MyConnectedContainer />
18
+        <MyConnectedComponent />
19 19
       </Provider>
20 20
     );
21 21
     expect(tree.toJSON().children).toEqual(['no name']);
@@ -25,7 +25,7 @@ describe('redux support', () => {
25 25
     const renderCountIncrement = jest.fn();
26 26
     const tree = renderer.create(
27 27
       <Provider store={store.reduxStore}>
28
-        <MyConnectedContainer renderCountIncrement={renderCountIncrement} />
28
+        <MyConnectedComponent renderCountIncrement={renderCountIncrement} />
29 29
       </Provider>
30 30
     );
31 31
 
@@ -43,7 +43,7 @@ describe('redux support', () => {
43 43
     const renderCountIncrement = jest.fn();
44 44
     const tree = renderer.create(
45 45
       <Provider store={store.reduxStore}>
46
-        <MyConnectedContainer printAge={true} renderCountIncrement={renderCountIncrement} />
46
+        <MyConnectedComponent printAge={true} renderCountIncrement={renderCountIncrement} />
47 47
       </Provider>
48 48
     );
49 49
 

integration/remx/MyContainer.js → integration/remx/MyComponent.js View File

@@ -5,7 +5,7 @@ const { Text } = require('react-native');
5 5
 const { connect } = require('remx');
6 6
 const store = require('./MyStore');
7 7
 
8
-class MyContainer extends Component {
8
+class MyComponent extends Component {
9 9
   render() {
10 10
     if (this.props.renderCountIncrement) {
11 11
       this.props.renderCountIncrement();
@@ -28,4 +28,4 @@ function mapStateToProps() {
28 28
   };
29 29
 }
30 30
 
31
-module.exports = connect(mapStateToProps)(MyContainer);
31
+module.exports = connect(mapStateToProps)(MyComponent);

+ 5
- 5
integration/remx/remx.test.js View File

@@ -3,22 +3,22 @@ require('react-native');
3 3
 const renderer = require('react-test-renderer');
4 4
 
5 5
 describe('remx support', () => {
6
-  let MyConnectedContainer;
6
+  let MyConnectedComponent;
7 7
   let store;
8 8
 
9 9
   beforeEach(() => {
10
-    MyConnectedContainer = require('./MyContainer');
10
+    MyConnectedComponent = require('./MyComponent');
11 11
     store = require('./MyStore');
12 12
   });
13 13
 
14 14
   it('renders normally', () => {
15
-    const tree = renderer.create(<MyConnectedContainer />);
15
+    const tree = renderer.create(<MyConnectedComponent />);
16 16
     expect(tree.toJSON().children).toEqual(['no name']);
17 17
   });
18 18
 
19 19
   it('rerenders as a result of an underlying state change (by selector)', () => {
20 20
     const renderCountIncrement = jest.fn();
21
-    const tree = renderer.create(<MyConnectedContainer renderCountIncrement={renderCountIncrement} />);
21
+    const tree = renderer.create(<MyConnectedComponent renderCountIncrement={renderCountIncrement} />);
22 22
 
23 23
     expect(tree.toJSON().children).toEqual(['no name']);
24 24
     expect(renderCountIncrement).toHaveBeenCalledTimes(1);
@@ -32,7 +32,7 @@ describe('remx support', () => {
32 32
 
33 33
   it('rerenders as a result of an underlying state change with a new key', () => {
34 34
     const renderCountIncrement = jest.fn();
35
-    const tree = renderer.create(<MyConnectedContainer printAge={true} renderCountIncrement={renderCountIncrement} />);
35
+    const tree = renderer.create(<MyConnectedComponent printAge={true} renderCountIncrement={renderCountIncrement} />);
36 36
 
37 37
     expect(tree.toJSON().children).toEqual(null);
38 38
     expect(renderCountIncrement).toHaveBeenCalledTimes(1);

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

@@ -3,17 +3,17 @@ package com.reactnativenavigation.parse;
3 3
 import android.app.Activity;
4 4
 
5 5
 import com.facebook.react.ReactInstanceManager;
6
-import com.reactnativenavigation.react.ReactContainerViewCreator;
6
+import com.reactnativenavigation.react.ReactComponentViewCreator;
7 7
 import com.reactnativenavigation.utils.TypefaceLoader;
8 8
 import com.reactnativenavigation.viewcontrollers.BottomTabsController;
9
-import com.reactnativenavigation.viewcontrollers.ContainerViewController;
9
+import com.reactnativenavigation.viewcontrollers.ComponentViewController;
10 10
 import com.reactnativenavigation.viewcontrollers.SideMenuController;
11 11
 import com.reactnativenavigation.viewcontrollers.StackController;
12 12
 import com.reactnativenavigation.viewcontrollers.ViewController;
13 13
 import com.reactnativenavigation.viewcontrollers.overlay.DialogViewController;
14 14
 import com.reactnativenavigation.viewcontrollers.toptabs.TopTabController;
15 15
 import com.reactnativenavigation.viewcontrollers.toptabs.TopTabsController;
16
-import com.reactnativenavigation.views.ContainerViewCreator;
16
+import com.reactnativenavigation.views.ComponentViewCreator;
17 17
 import com.reactnativenavigation.views.TopTabsLayoutCreator;
18 18
 
19 19
 import java.util.ArrayList;
@@ -35,10 +35,10 @@ public class LayoutFactory {
35 35
 
36 36
 	public ViewController create(final LayoutNode node) {
37 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 Stack:
41
+				return createStack(node);
42 42
 			case BottomTabs:
43 43
 				return createBottomTabs(node);
44 44
 			case SideMenuRoot:
@@ -49,12 +49,12 @@ public class LayoutFactory {
49 49
 				return createSideMenuLeft(node);
50 50
 			case SideMenuRight:
51 51
 				return createSideMenuRight(node);
52
-			case CustomDialog:
53
-				return createDialogContainer(node);
52
+//			case CustomDialog:
53
+//				return createDialogComponent(node);
54 54
             case TopTabs:
55 55
                 return createTopTabs(node);
56
-            case TopTab:
57
-                return createTopTab(node);
56
+//            case TopTab:
57
+//                return createTopTab(node);
58 58
 			default:
59 59
 				throw new IllegalArgumentException("Invalid node type: " + node.type);
60 60
 		}
@@ -93,19 +93,19 @@ public class LayoutFactory {
93 93
 		return create(node.children.get(0));
94 94
 	}
95 95
 
96
-	private ViewController createContainer(LayoutNode node) {
96
+	private ViewController createComponent(LayoutNode node) {
97 97
 		String id = node.id;
98 98
 		String name = node.data.optString("name");
99
-		NavigationOptions navigationOptions = NavigationOptions.parse(typefaceManager, node.data.optJSONObject("navigationOptions"), defaultOptions);
100
-		return new ContainerViewController(activity,
99
+		NavigationOptions options = NavigationOptions.parse(typefaceManager, node.data.optJSONObject("options"), defaultOptions);
100
+		return new ComponentViewController(activity,
101 101
                 id,
102 102
                 name,
103
-                new ContainerViewCreator(reactInstanceManager),
104
-                navigationOptions
103
+                new ComponentViewCreator(reactInstanceManager),
104
+                options
105 105
         );
106 106
 	}
107 107
 
108
-	private ViewController createContainerStack(LayoutNode node) {
108
+	private ViewController createStack(LayoutNode node) {
109 109
 		StackController stackController = new StackController(activity, node.id);
110 110
 		for (LayoutNode child : node.children) {
111 111
 			stackController.push(create(child), null);
@@ -114,19 +114,19 @@ public class LayoutFactory {
114 114
 	}
115 115
 
116 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 118
 		List<ViewController> tabs = new ArrayList<>();
119 119
 		for (int i = 0; i < node.children.size(); i++) {
120 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 127
 		String id = node.id;
128 128
 		String name = node.data.optString("name");
129
-		ReactContainerViewCreator creator = new ReactContainerViewCreator(reactInstanceManager);
129
+		ReactComponentViewCreator creator = new ReactComponentViewCreator(reactInstanceManager);
130 130
 		return new DialogViewController(activity, id, name, creator);
131 131
 	}
132 132
 
@@ -137,19 +137,19 @@ public class LayoutFactory {
137 137
             tabController.setTabIndex(i);
138 138
             tabs.add(tabController);
139 139
         }
140
-        NavigationOptions navigationOptions = NavigationOptions.parse(typefaceManager, node.getNavigationOptions(), defaultOptions);
141
-        return new TopTabsController(activity, node.id, tabs, new TopTabsLayoutCreator(activity, tabs), navigationOptions);
140
+        NavigationOptions options = NavigationOptions.parse(typefaceManager, node.getNavigationOptions(), defaultOptions);
141
+        return new TopTabsController(activity, node.id, tabs, new TopTabsLayoutCreator(activity, tabs), options);
142 142
     }
143 143
 
144 144
     private ViewController createTopTab(LayoutNode node) {
145 145
         String id = node.id;
146 146
         String name = node.data.optString("name");
147
-        NavigationOptions navigationOptions = NavigationOptions.parse(typefaceManager, node.getNavigationOptions(), defaultOptions);
147
+        NavigationOptions options = NavigationOptions.parse(typefaceManager, node.getNavigationOptions(), defaultOptions);
148 148
         return new TopTabController(activity,
149 149
                 id,
150 150
                 name,
151
-                new ReactContainerViewCreator(reactInstanceManager),
152
-                navigationOptions
151
+                new ReactComponentViewCreator(reactInstanceManager),
152
+                options
153 153
         );
154 154
     }
155 155
 }

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

@@ -7,16 +7,14 @@ import java.util.List;
7 7
 
8 8
 public class LayoutNode {
9 9
 	public enum Type {
10
-		Container,
11
-		ContainerStack,
10
+		Component,
11
+		Stack,
12 12
 		BottomTabs,
13 13
 		SideMenuRoot,
14 14
 		SideMenuCenter,
15 15
 		SideMenuLeft,
16 16
 		SideMenuRight,
17
-		CustomDialog,
18
-        TopTabs,
19
-        TopTab
17
+        TopTabs
20 18
 	}
21 19
 
22 20
 	public final String id;
@@ -37,6 +35,6 @@ public class LayoutNode {
37 35
 	}
38 36
 
39 37
     JSONObject getNavigationOptions() {
40
-	    return data.optJSONObject("navigationOptions");
38
+	    return data.optJSONObject("options");
41 39
     }
42 40
 }

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

@@ -6,8 +6,6 @@ import com.reactnativenavigation.utils.TypefaceLoader;
6 6
 
7 7
 import org.json.JSONObject;
8 8
 
9
-import java.util.ArrayList;
10
-
11 9
 public class NavigationOptions implements DEFAULT_VALUES {
12 10
 
13 11
     public enum BooleanOptions {

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

@@ -27,11 +27,11 @@ public class OverlayOptions {
27 27
 		return options;
28 28
 	}
29 29
 
30
-	public static OverlayOptions create(ViewController containerView) {
30
+	public static OverlayOptions create(ViewController componentView) {
31 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 35
 		return options;
36 36
 	}
37 37
 

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

@@ -13,8 +13,8 @@ import static com.facebook.react.modules.core.DeviceEventManagerModule.RCTDevice
13 13
 
14 14
 public class NavigationEvent {
15 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 18
 	private static final String onNavigationButtonPressed = "RNN.navigationButtonPressed";
19 19
 
20 20
 	private final RCTDeviceEventEmitter emitter;
@@ -27,17 +27,17 @@ public class NavigationEvent {
27 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 38
 	public void sendOnNavigationButtonPressed(String id, String buttonId) {
39 39
 		WritableMap map = Arguments.createMap();
40
-		map.putString("containerId", id);
40
+		map.putString("componentId", id);
41 41
 		map.putString("buttonId", buttonId);
42 42
 
43 43
 		emit(onNavigationButtonPressed, map);

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

@@ -52,33 +52,33 @@ public class NavigationModule extends ReactContextBaseJavaModule {
52 52
     }
53 53
 
54 54
 	@ReactMethod
55
-	public void setOptions(final String onContainerId, final ReadableMap options) {
55
+	public void setOptions(final String onComponentId, final ReadableMap options) {
56 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 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 62
 		final LayoutNode layoutTree = LayoutNodeParser.parse(JSONParser.parse(rawLayoutTree));
63 63
 		handle(() -> {
64 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 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 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 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 84
 	@ReactMethod
@@ -91,8 +91,8 @@ public class NavigationModule extends ReactContextBaseJavaModule {
91 91
 	}
92 92
 
93 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 98
 	@ReactMethod

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

@@ -0,0 +1,20 @@
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,20 +0,0 @@
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,21 +7,21 @@ import android.view.View;
7 7
 
8 8
 import com.facebook.react.ReactInstanceManager;
9 9
 import com.facebook.react.ReactRootView;
10
-import com.reactnativenavigation.viewcontrollers.ContainerViewController;
10
+import com.reactnativenavigation.viewcontrollers.ComponentViewController;
11 11
 
12 12
 @SuppressLint("ViewConstructor")
13
-public class ReactView extends ReactRootView implements ContainerViewController.IReactView {
13
+public class ReactView extends ReactRootView implements ComponentViewController.IReactView {
14 14
 
15 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 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 21
 		super(context);
22 22
 		this.reactInstanceManager = reactInstanceManager;
23
-		this.containerId = containerId;
24
-		this.containerName = containerName;
23
+		this.componentId = componentId;
24
+		this.componentName = componentName;
25 25
 		start();
26 26
 	}
27 27
 
@@ -31,8 +31,8 @@ public class ReactView extends ReactRootView implements ContainerViewController.
31 31
             isAttachedToReactInstance = true;
32 32
         });
33 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 38
 	@Override
@@ -51,17 +51,17 @@ public class ReactView extends ReactRootView implements ContainerViewController.
51 51
 	}
52 52
 
53 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 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 63
     @Override
64 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
 }

+ 100
- 0
lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/ComponentViewController.java View File

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

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

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

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

@@ -28,13 +28,13 @@ public class ModalStack {
28 28
 		}
29 29
 	}
30 30
 
31
-	public void dismissModal(final String containerId, Promise promise) {
32
-		Modal modal = findModalByContainerId(containerId);
31
+	public void dismissModal(final String componentId, Promise promise) {
32
+		Modal modal = findModalByComponentId(componentId);
33 33
 		if (modal != null) {
34 34
 			modal.dismiss();
35 35
 			modals.remove(modal);
36 36
 			if (promise != null) {
37
-				promise.resolve(containerId);
37
+				promise.resolve(componentId);
38 38
 			}
39 39
 		} else {
40 40
 			Navigator.rejectPromise(promise);
@@ -52,9 +52,9 @@ public class ModalStack {
52 52
 	}
53 53
 
54 54
 	@Nullable
55
-	private Modal findModalByContainerId(String containerId) {
55
+	private Modal findModalByComponentId(String componentId) {
56 56
 		for (Modal modal : modals) {
57
-			if (modal.containsDeepContainerId(containerId)) {
57
+			if (modal.containsDeepComponentId(componentId)) {
58 58
 				return modal;
59 59
 			}
60 60
 		}
@@ -63,7 +63,7 @@ public class ModalStack {
63 63
 
64 64
 	@Nullable
65 65
     ViewController findControllerById(String id) {
66
-        Modal modal = findModalByContainerId(id);
66
+        Modal modal = findModalByComponentId(id);
67 67
         return modal != null ? modal.viewController : null;
68 68
     }
69 69
 
@@ -87,8 +87,8 @@ public class ModalStack {
87 87
 			dialog.dismiss();
88 88
 		}
89 89
 
90
-		boolean containsDeepContainerId(String containerId) {
91
-			return viewController.findControllerById(containerId) != null;
90
+		boolean containsDeepComponentId(String componentId) {
91
+			return viewController.findControllerById(componentId) != null;
92 92
 		}
93 93
 
94 94
 		private void preMeasureView() {

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

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

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

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

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

@@ -31,7 +31,7 @@ public class TopTabsAdapter extends PagerAdapter implements ViewPager.OnPageChan
31 31
     }
32 32
 
33 33
     @Override
34
-    public Object instantiateItem(ViewGroup container, int position) {
34
+    public Object instantiateItem(ViewGroup component, int position) {
35 35
         return tabs.get(position).getView();
36 36
     }
37 37
 

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

@@ -20,12 +20,12 @@ public class TopTabsController extends ParentController implements NavigationOpt
20 20
     private List<TopTabController> tabs;
21 21
     private TopTabsLayout topTabsLayout;
22 22
     private TopTabsLayoutCreator viewCreator;
23
-    private NavigationOptions navigationOptions;
23
+    private NavigationOptions options;
24 24
 
25
-    public TopTabsController(Activity activity, String id, List<TopTabController> tabs, TopTabsLayoutCreator viewCreator, NavigationOptions navigationOptions) {
25
+    public TopTabsController(Activity activity, String id, List<TopTabController> tabs, TopTabsLayoutCreator viewCreator, NavigationOptions options) {
26 26
         super(activity, id);
27 27
         this.viewCreator = viewCreator;
28
-        this.navigationOptions = navigationOptions;
28
+        this.options = options;
29 29
         this.tabs = tabs;
30 30
         for (ViewController tab : tabs) {
31 31
             tab.setParentController(this);
@@ -47,7 +47,7 @@ public class TopTabsController extends ParentController implements NavigationOpt
47 47
 
48 48
     @Override
49 49
     public void onViewAppeared() {
50
-        applyOptions(navigationOptions);
50
+        applyOptions(options);
51 51
         performOnCurrentTab(TopTabController::onViewAppeared);
52 52
     }
53 53
 

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

@@ -5,7 +5,7 @@ import android.content.Context;
5 5
 import android.support.v4.view.ViewPager;
6 6
 import android.view.ViewGroup;
7 7
 
8
-import com.reactnativenavigation.viewcontrollers.ContainerViewController;
8
+import com.reactnativenavigation.viewcontrollers.ComponentViewController;
9 9
 import com.reactnativenavigation.viewcontrollers.ViewController;
10 10
 
11 11
 import java.util.List;
@@ -39,6 +39,6 @@ public class TopTabsViewPager extends ViewPager {
39 39
     }
40 40
 
41 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

@@ -6,7 +6,7 @@ import android.view.View;
6 6
 import com.reactnativenavigation.parse.NavigationOptions;
7 7
 import com.reactnativenavigation.viewcontrollers.ContainerViewController;
8 8
 
9
-public interface Container {
9
+public interface Component {
10 10
     void applyOptions(NavigationOptions options);
11 11
 
12 12
     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

@@ -11,25 +11,22 @@ import android.widget.RelativeLayout;
11 11
 import com.facebook.react.uimanager.events.EventDispatcher;
12 12
 import com.reactnativenavigation.parse.NavigationOptions;
13 13
 import com.reactnativenavigation.presentation.OptionsPresenter;
14
-import com.reactnativenavigation.viewcontrollers.ContainerViewController;
15
-import com.reactnativenavigation.viewcontrollers.ContainerViewController.IReactView;
14
+import com.reactnativenavigation.viewcontrollers.ComponentViewController.IReactView;
16 15
 
17 16
 import static android.view.ViewGroup.LayoutParams.MATCH_PARENT;
18 17
 import static android.view.ViewGroup.LayoutParams.WRAP_CONTENT;
19 18
 
20 19
 @SuppressLint("ViewConstructor")
21
-public class ContainerLayout extends RelativeLayout implements ReactContainer {
20
+public class ComponentLayout extends RelativeLayout implements ReactComponent {
22 21
 
23 22
     private TopBar topBar;
24 23
     private IReactView reactView;
25 24
     private final OptionsPresenter optionsPresenter;
26 25
 
27
-    public ContainerLayout(Context context, IReactView reactView, EventDispatcher eventDispatcher) {
28
-        super(context);
29
-        this.reactView = reactView;
30
-        this.topBar = new TopBar(context, this, eventDispatcher);
31
-        topBar.setId(View.generateViewId());
32
-
26
+	public ComponentLayout(Context context, IReactView reactView, EventDispatcher eventDispatcher) {
27
+		super(context);
28
+		this.topBar = new TopBar(context, this);
29
+		this.reactView = reactView;
33 30
         optionsPresenter = new OptionsPresenter(this);
34 31
         initViews();
35 32
     }
@@ -56,15 +53,15 @@ public class ContainerLayout extends RelativeLayout implements ReactContainer {
56 53
         reactView.destroy();
57 54
     }
58 55
 
59
-    @Override
60
-    public void sendContainerStart() {
61
-        reactView.sendContainerStart();
62
-    }
56
+	@Override
57
+	public void sendComponentStart() {
58
+		reactView.sendComponentStart();
59
+	}
63 60
 
64
-    @Override
65
-    public void sendContainerStop() {
66
-        reactView.sendContainerStop();
67
-    }
61
+	@Override
62
+	public void sendComponentStop() {
63
+		reactView.sendComponentStop();
64
+	}
68 65
 
69 66
     @Override
70 67
     public void applyOptions(NavigationOptions options) {
@@ -99,4 +96,4 @@ public class ContainerLayout extends RelativeLayout implements ReactContainer {
99 96
         layoutParams.addRule(BELOW, topBar.getId());
100 97
         reactView.asView().setLayoutParams(layoutParams);
101 98
     }
102
-}
99
+}

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

@@ -0,0 +1,22 @@
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
- 24
lib/android/app/src/main/java/com/reactnativenavigation/views/ContainerViewCreator.java View File

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

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

@@ -14,16 +14,16 @@ import com.facebook.react.ReactRootView;
14 14
 
15 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 20
 		super(context);
21 21
 
22
-		this.container = container;
22
+		this.component = component;
23 23
 		init();
24 24
 	}
25 25
 
26 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

@@ -0,0 +1,6 @@
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,6 +0,0 @@
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,11 +24,11 @@ import java.util.ArrayList;
24 24
 public class TitleBarButton implements MenuItem.OnMenuItemClickListener {
25 25
 	private Toolbar toolbar;
26 26
 	private final Button button;
27
-	private Container container;
27
+	private Component component;
28 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 32
 		this.toolbar = toolbar;
33 33
 		this.button = button;
34 34
 	}
@@ -118,12 +118,12 @@ public class TitleBarButton implements MenuItem.OnMenuItemClickListener {
118 118
 	}
119 119
 
120 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 124
 	@Override
125 125
 	public boolean onMenuItemClick(MenuItem menuItem) {
126
-		this.container.sendOnNavigationButtonPressed(button.id);
126
+		this.component.sendOnNavigationButtonPressed(button.id);
127 127
 		return true;
128 128
 	}
129 129
 

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

@@ -21,33 +21,23 @@ import com.reactnativenavigation.parse.Color;
21 21
 import com.reactnativenavigation.parse.NavigationOptions;
22 22
 import com.reactnativenavigation.parse.Number;
23 23
 import com.reactnativenavigation.viewcontrollers.toptabs.TopTabsViewPager;
24
+import com.reactnativenavigation.parse.Color;
24 25
 
25 26
 import java.util.ArrayList;
26 27
 
27 28
 @SuppressLint("ViewConstructor")
28 29
 public class TopBar extends AppBarLayout {
29
-    private final Toolbar titleBar;
30
-    private Container container;
30
+	private final Toolbar titleBar;
31
+    private Component component;
31 32
     private TopTabs topTabs;
32 33
 
33
-    private TopBarAnimator animator;
34
-    private TopBarCollapseBehavior collapsingBehavior;
35
-
36
-    public TopBar(Context context) {
37
-        this(context, null, null);
38
-    }
39
-
40
-    public TopBar(Context context, Container container) {
41
-        this(context, container, null);
42
-    }
43
-
44
-    public TopBar(Context context, Container container, EventDispatcher eventDispatcher) {
34
+    public TopBar(final Context context, Component component) {
45 35
         super(context);
46 36
         collapsingBehavior = new TopBarCollapseBehavior(eventDispatcher, this);
47
-        this.container = container;
37
+        this.component = component;
48 38
         titleBar = new Toolbar(context);
49 39
         topTabs = new TopTabs(getContext());
50
-        animator = new TopBarAnimator(this, container != null ? container.getContentView() : null);
40
+        animator = new TopBarAnimator(this, component != null ? component.getContentView() : null);
51 41
         addView(titleBar);
52 42
     }
53 43
 
@@ -131,10 +121,10 @@ public class TopBar extends AppBarLayout {
131 121
         setLeftButton(leftButton);
132 122
     }
133 123
 
134
-    private void setLeftButton(final Button button) {
135
-        TitleBarButton leftBarButton = new TitleBarButton(container, this.titleBar, button);
136
-        leftBarButton.applyNavigationIcon(getContext());
137
-    }
124
+	private void setLeftButton(final Button button) {
125
+		TitleBarButton leftBarButton = new TitleBarButton(component, this.titleBar, button);
126
+		leftBarButton.applyNavigationIcon(getContext());
127
+	}
138 128
 
139 129
     private void setRightButtons(ArrayList<Button> rightButtons) {
140 130
         if (rightButtons == null || rightButtons.size() == 0) {
@@ -144,11 +134,11 @@ public class TopBar extends AppBarLayout {
144 134
         Menu menu = getTitleBar().getMenu();
145 135
         menu.clear();
146 136
 
147
-        for (int i = 0; i < rightButtons.size(); i++) {
148
-            Button button = rightButtons.get(i);
149
-            TitleBarButton titleBarButton = new TitleBarButton(container, this.titleBar, button);
150
-            titleBarButton.addToMenu(getContext(), menu);
151
-        }
137
+		for (int i = 0; i < rightButtons.size(); i++){
138
+	   		Button button = rightButtons.get(i);
139
+			TitleBarButton titleBarButton = new TitleBarButton(component, this.titleBar, button);
140
+			titleBarButton.addToMenu(getContext(), menu);
141
+       }
152 142
     }
153 143
 
154 144
     public Toolbar getTitleBar() {

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

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

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

@@ -3,10 +3,10 @@ package com.reactnativenavigation.views;
3 3
 import android.app.Activity;
4 4
 
5 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 12
     private ReactInstanceManager instanceManager;
@@ -16,8 +16,8 @@ public class TopTabCreator implements ContainerViewController.ReactViewCreator {
16 16
     }
17 17
 
18 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 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

@@ -19,7 +19,7 @@ import com.reactnativenavigation.viewcontrollers.toptabs.TopTabsViewPager;
19 19
 import java.util.List;
20 20
 
21 21
 @SuppressLint("ViewConstructor")
22
-public class TopTabsLayout extends RelativeLayout implements Container {
22
+public class TopTabsLayout extends RelativeLayout implements Component {
23 23
 
24 24
     private TopBar topBar;
25 25
     private List<TopTabController> tabs;

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

@@ -0,0 +1,12 @@
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,12 +0,0 @@
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

@@ -10,14 +10,14 @@ import com.reactnativenavigation.presentation.OptionsPresenter;
10 10
 import com.reactnativenavigation.views.ReactContainer;
11 11
 import com.reactnativenavigation.views.TopBar;
12 12
 
13
-public class TestContainerLayout extends RelativeLayout implements ReactContainer {
13
+public class TestComponentLayout extends RelativeLayout implements ReactComponent {
14 14
 
15 15
     private final TopBar topBar;
16 16
     private final View contentView;
17 17
     private final OptionsPresenter optionsPresenter;
18 18
 
19
-    public TestContainerLayout(final Context context) {
20
-        super(context);
19
+    public TestComponentLayout(final Context context) {
20
+		super(context);
21 21
         topBar = new TopBar(context, this);
22 22
         contentView = new View(context);
23 23
         addView(topBar);
@@ -63,11 +63,11 @@ public class TestContainerLayout extends RelativeLayout implements ReactContaine
63 63
     }
64 64
 
65 65
     @Override
66
-    public void sendContainerStart() {
66
+    public void sendComponentStart() {
67 67
     }
68 68
 
69 69
     @Override
70
-    public void sendContainerStop() {
70
+    public void sendComponentStop() {
71 71
     }
72 72
 
73 73
     @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

@@ -7,15 +7,15 @@ import com.reactnativenavigation.parse.NavigationOptions;
7 7
 import com.reactnativenavigation.views.ReactContainer;
8 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 12
     private TopBar topBar;
13 13
 
14
-    public TestContainerView(final Context context) {
15
-        super(context);
16
-        topBar = new TopBar(context, this);
14
+	public TestComponentView(final Context context) {
15
+		super(context);
16
+		topBar = new TopBar(context, this);
17 17
 
18
-    }
18
+	}
19 19
 
20 20
     @Override
21 21
     public boolean isReady() {
@@ -31,13 +31,13 @@ public class TestContainerView extends View implements ReactContainer {
31 31
     public void destroy() {
32 32
     }
33 33
 
34
-    @Override
35
-    public void sendContainerStart() {
36
-    }
34
+	@Override
35
+	public void sendComponentStart() {
36
+	}
37 37
 
38
-    @Override
39
-    public void sendContainerStop() {
40
-    }
38
+	@Override
39
+	public void sendComponentStop() {
40
+	}
41 41
 
42 42
     @Override
43 43
     public void applyOptions(NavigationOptions options) {

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

@@ -0,0 +1,13 @@
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,13 +0,0 @@
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,9 +3,9 @@ package com.reactnativenavigation.mocks;
3 3
 import android.content.Context;
4 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 10
     public TopTabLayoutMock(Context context) {
11 11
         super(context);
@@ -27,12 +27,12 @@ public class TopTabLayoutMock extends View implements ContainerViewController.IR
27 27
     }
28 28
 
29 29
     @Override
30
-    public void sendContainerStart() {
30
+    public void sendComponentStart() {
31 31
 
32 32
     }
33 33
 
34 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,16 +10,16 @@ import static org.assertj.core.api.Java6Assertions.assertThat;
10 10
 public class LayoutNodeParserTest extends BaseTest {
11 11
 	@Test
12 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 14
 		assertThat(node.id).isEqualTo("the id");
15
-		assertThat(node.type).isEqualTo(LayoutNode.Type.Container);
15
+		assertThat(node.type).isEqualTo(LayoutNode.Type.Component);
16 16
 		assertThat(node.data.keys()).isEmpty();
17 17
 		assertThat(node.children).isEmpty();
18 18
 	}
19 19
 
20 20
 	@Test
21 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 25
 	@Test(expected = RuntimeException.class)
@@ -30,20 +30,20 @@ public class LayoutNodeParserTest extends BaseTest {
30 30
 	@Test
31 31
 	public void parseFromTree() throws Exception {
32 32
 		JSONObject tree = new JSONObject("{id: node1, " +
33
-				"type: ContainerStack, " +
33
+				"type: Stack, " +
34 34
 				"data: {dataKey: dataValue}, " +
35
-				"children: [{id: childId1, type: Container}]}");
35
+				"children: [{id: childId1, type: Component}]}");
36 36
 
37 37
 		LayoutNode result = LayoutNodeParser.parse(tree);
38 38
 
39 39
 		assertThat(result).isNotNull();
40 40
 		assertThat(result.id).isEqualTo("node1");
41
-		assertThat(result.type).isEqualTo(LayoutNode.Type.ContainerStack);
41
+		assertThat(result.type).isEqualTo(LayoutNode.Type.Stack);
42 42
 		assertThat(result.data.length()).isEqualTo(1);
43 43
 		assertThat(result.data.getString("dataKey")).isEqualTo("dataValue");
44 44
 		assertThat(result.children).hasSize(1);
45 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 47
 		assertThat(result.children.get(0).data.keys()).isEmpty();
48 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

@@ -29,7 +29,7 @@ public class NavigationOptionsTest extends BaseTest {
29 29
     private static final NavigationOptions.BooleanOptions BOTTOM_TABS_ANIMATE_HIDE = True;
30 30
     private static final NavigationOptions.BooleanOptions BOTTOM_TABS_HIDDEN = True;
31 31
     private static final int BOTTOM_TABS_BADGE = 3;
32
-    private static final String BOTTOM_TABS_CURRENT_TAB_ID = "ContainerId";
32
+    private static final String BOTTOM_TABS_CURRENT_TAB_ID = "ComponentId";
33 33
     private static final int BOTTOM_TABS_CURRENT_TAB_INDEX = 1;
34 34
     private TypefaceLoader mockLoader;
35 35
 

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

@@ -7,7 +7,6 @@ import com.reactnativenavigation.BaseTest;
7 7
 import org.json.JSONObject;
8 8
 import org.junit.Test;
9 9
 
10
-import static com.reactnativenavigation.parse.NavigationOptions.BooleanOptions.True;
11 10
 import static org.assertj.core.api.Java6Assertions.assertThat;
12 11
 
13 12
 public class OverlayOptionsTest extends BaseTest {

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,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.TestContainerLayout;
6
+import com.reactnativenavigation.mocks.TestComponentLayout;
7 7
 import com.reactnativenavigation.parse.NavigationOptions;
8 8
 
9 9
 import org.junit.Test;
@@ -14,30 +14,30 @@ import static org.mockito.Mockito.times;
14 14
 import static org.mockito.Mockito.verify;
15 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 21
 	@Override
22 22
 	public void beforeEach() {
23 23
 		super.beforeEach();
24 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 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 29
 				return view;
30 30
 			}
31 31
 		}, new NavigationOptions());
32 32
 	}
33 33
 
34 34
 	@Test
35
-	public void createsViewFromContainerViewCreator() throws Exception {
35
+	public void createsViewFromComponentViewCreator() throws Exception {
36 36
 		assertThat(uut.getView()).isSameAs(view);
37 37
 	}
38 38
 
39 39
 	@Test
40
-	public void containerViewDestroyedOnDestroy() throws Exception {
40
+	public void componentViewDestroyedOnDestroy() throws Exception {
41 41
 		uut.ensureViewIsCreated();
42 42
 		verify(view, times(0)).destroy();
43 43
 		uut.destroy();
@@ -45,20 +45,20 @@ public class ContainerViewControllerTest extends BaseTest {
45 45
 	}
46 46
 
47 47
 	@Test
48
-	public void lifecycleMethodsSentToContainerView() throws Exception {
48
+	public void lifecycleMethodsSentToComponentView() throws Exception {
49 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 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 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 60
 	@Test
61
-	public void isViewShownOnlyIfContainerViewIsReady() throws Exception {
61
+	public void isViewShownOnlyIfComponentViewIsReady() throws Exception {
62 62
 		assertThat(uut.isViewShown()).isFalse();
63 63
 		uut.ensureViewIsCreated();
64 64
 		when(view.asView().isShown()).thenReturn(true);

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

@@ -5,7 +5,7 @@ import android.support.annotation.NonNull;
5 5
 
6 6
 import com.reactnativenavigation.BaseTest;
7 7
 import com.reactnativenavigation.mocks.MockPromise;
8
-import com.reactnativenavigation.mocks.SimpleContainerViewController;
8
+import com.reactnativenavigation.mocks.SimpleComponentViewController;
9 9
 import com.reactnativenavigation.mocks.SimpleViewController;
10 10
 import com.reactnativenavigation.mocks.TestNavigationAnimator;
11 11
 import com.reactnativenavigation.parse.NavigationOptions;
@@ -195,19 +195,19 @@ public class NavigatorTest extends BaseTest {
195 195
 
196 196
 	@Test
197 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.getOptions().topBarOptions.title).isEmpty();
201 201
 
202 202
 		NavigationOptions options = new NavigationOptions();
203 203
 		options.topBarOptions.title = "new title";
204 204
 
205 205
 		uut.setOptions("theId", options);
206
-		assertThat(containerVc.getNavigationOptions().topBarOptions.title).isEqualTo("new title");
206
+		assertThat(componentVc.getOptions().topBarOptions.title).isEqualTo("new title");
207 207
 	}
208 208
 
209 209
 	@Test
210
-	public void setOptions_AffectsOnlyContainerViewControllers() {
210
+	public void setOptions_AffectsOnlyComponentViewControllers() {
211 211
 		uut.setOptions("some unknown child id", new NavigationOptions());
212 212
 	}
213 213
 

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

@@ -8,7 +8,7 @@ import android.view.ViewGroup;
8 8
 import android.widget.RelativeLayout;
9 9
 
10 10
 import com.reactnativenavigation.BaseTest;
11
-import com.reactnativenavigation.mocks.TestContainerLayout;
11
+import com.reactnativenavigation.mocks.TestComponentLayout;
12 12
 import com.reactnativenavigation.parse.NavigationOptions;
13 13
 
14 14
 import org.junit.Test;
@@ -18,21 +18,21 @@ import static org.assertj.core.api.Java6Assertions.assertThat;
18 18
 import static org.mockito.Mockito.spy;
19 19
 
20 20
 public class OptionsApplyingTest extends BaseTest {
21
-    private Activity activity;
22
-    private ContainerViewController uut;
23
-    private ContainerViewController.IReactView view;
24
-    private NavigationOptions initialNavigationOptions;
25
-
26
-    @Override
27
-    public void beforeEach() {
28
-        super.beforeEach();
29
-        activity = newActivity();
30
-        initialNavigationOptions = new NavigationOptions();
31
-        view = spy(new TestContainerLayout(activity));
32
-        uut = new ContainerViewController(activity,
33
-                "containerId1",
34
-                "containerName",
35
-                (activity1, containerId, containerName) -> view,
21
+	private Activity activity;
22
+	private ComponentViewController uut;
23
+	private ComponentViewController.IReactView view;
24
+	private NavigationOptions initialNavigationOptions;
25
+
26
+	@Override
27
+	public void beforeEach() {
28
+		super.beforeEach();
29
+		activity = newActivity();
30
+		initialNavigationOptions = new NavigationOptions();
31
+		view = spy(new TestComponentLayout(activity));
32
+		uut = new ComponentViewController(activity,
33
+                "componentId1",
34
+                "componentName",
35
+                (activity1, componentId, componentName) -> view,
36 36
                 initialNavigationOptions
37 37
         );
38 38
         uut.ensureViewIsCreated();
@@ -45,27 +45,27 @@ public class OptionsApplyingTest extends BaseTest {
45 45
         assertThat(uut.getParentStackController()).isNull();
46 46
     }
47 47
 
48
-    @Test
49
-    public void initialOptionsAppliedOnAppear() throws Exception {
50
-        assertThat(uut.getNavigationOptions()).isSameAs(initialNavigationOptions);
51
-        initialNavigationOptions.topBarOptions.title = "the title";
52
-        StackController stackController = new StackController(activity, "stackId");
53
-        stackController.push(uut);
54
-        assertThat(uut.getTopBar().getTitle()).isEmpty();
48
+	@Test
49
+	public void initialOptionsAppliedOnAppear() throws Exception {
50
+		assertThat(uut.getOptions()).isSameAs(initialNavigationOptions);
51
+		initialNavigationOptions.topBarOptions.title = "the title";
52
+		StackController stackController = new StackController(activity, "stackId");
53
+		stackController.push(uut);
54
+		assertThat(uut.getTopBar().getTitle()).isEmpty();
55 55
 
56 56
         uut.onViewAppeared();
57 57
         assertThat(uut.getTopBar().getTitle()).isEqualTo("the title");
58 58
     }
59 59
 
60
-    @Test
61
-    public void mergeNavigationOptionsUpdatesCurrentOptions() throws Exception {
62
-        assertThat(uut.getNavigationOptions().topBarOptions.title).isEmpty();
63
-        NavigationOptions options = new NavigationOptions();
64
-        options.topBarOptions.title = "new title";
65
-        uut.mergeNavigationOptions(options);
66
-        assertThat(uut.getNavigationOptions().topBarOptions.title).isEqualTo("new title");
67
-        assertThat(uut.getNavigationOptions()).isSameAs(initialNavigationOptions);
68
-    }
60
+	@Test
61
+	public void mergeNavigationOptionsUpdatesCurrentOptions() throws Exception {
62
+		assertThat(uut.getOptions().topBarOptions.title).isEmpty();
63
+		NavigationOptions options = new NavigationOptions();
64
+		options.topBarOptions.title = "new title";
65
+		uut.mergeNavigationOptions(options);
66
+		assertThat(uut.getOptions().topBarOptions.title).isEqualTo("new title");
67
+		assertThat(uut.getOptions()).isSameAs(initialNavigationOptions);
68
+	}
69 69
 
70 70
     @Test
71 71
     public void reappliesOptionsOnMerge() throws Exception {
@@ -92,12 +92,12 @@ public class OptionsApplyingTest extends BaseTest {
92 92
         assertThat(((ColorDrawable) uut.getTopBar().getTitleBar().getBackground()).getColor()).isEqualTo(Color.RED);
93 93
     }
94 94
 
95
-    @Test
96
-    public void appliesTopBarTextColor() throws Exception {
97
-        assertThat(uut.getNavigationOptions()).isSameAs(initialNavigationOptions);
98
-        initialNavigationOptions.topBarOptions.title = "the title";
99
-        uut.onViewAppeared();
100
-        assertThat(uut.getTopBar().getTitleTextView().getCurrentTextColor()).isNotEqualTo(Color.RED);
95
+	@Test
96
+	public void appliesTopBarTextColor() throws Exception {
97
+		assertThat(uut.getOptions()).isSameAs(initialNavigationOptions);
98
+		initialNavigationOptions.topBarOptions.title = "the title";
99
+		uut.onViewAppeared();
100
+		assertThat(uut.getTopBar().getTitleTextView().getCurrentTextColor()).isNotEqualTo(Color.RED);
101 101
 
102 102
         NavigationOptions opts = new NavigationOptions();
103 103
         opts.topBarOptions.title = "the title";
@@ -108,12 +108,12 @@ public class OptionsApplyingTest extends BaseTest {
108 108
         assertThat(uut.getTopBar().getTitleTextView().getCurrentTextColor()).isEqualTo(Color.RED);
109 109
     }
110 110
 
111
-    @Test
112
-    public void appliesTopBarTextSize() throws Exception {
113
-        assertThat(uut.getNavigationOptions()).isSameAs(initialNavigationOptions);
114
-        initialNavigationOptions.topBarOptions.title = "the title";
115
-        uut.onViewAppeared();
116
-        assertThat(uut.getTopBar().getTitleTextView().getTextSize()).isNotEqualTo(18);
111
+	@Test
112
+	public void appliesTopBarTextSize() throws Exception {
113
+		assertThat(uut.getOptions()).isSameAs(initialNavigationOptions);
114
+		initialNavigationOptions.topBarOptions.title = "the title";
115
+		uut.onViewAppeared();
116
+		assertThat(uut.getTopBar().getTitleTextView().getTextSize()).isNotEqualTo(18);
117 117
 
118 118
         NavigationOptions opts = new NavigationOptions();
119 119
         opts.topBarOptions.title = "the title";
@@ -124,12 +124,12 @@ public class OptionsApplyingTest extends BaseTest {
124 124
         assertThat(uut.getTopBar().getTitleTextView().getTextSize()).isEqualTo(18);
125 125
     }
126 126
 
127
-    @Test
128
-    public void appliesTopBarHidden() throws Exception {
129
-        assertThat(uut.getNavigationOptions()).isSameAs(initialNavigationOptions);
130
-        initialNavigationOptions.topBarOptions.title = "the title";
131
-        uut.onViewAppeared();
132
-        assertThat(uut.getTopBar().getVisibility()).isNotEqualTo(View.GONE);
127
+	@Test
128
+	public void appliesTopBarHidden() throws Exception {
129
+		assertThat(uut.getOptions()).isSameAs(initialNavigationOptions);
130
+		initialNavigationOptions.topBarOptions.title = "the title";
131
+		uut.onViewAppeared();
132
+		assertThat(uut.getTopBar().getVisibility()).isNotEqualTo(View.GONE);
133 133
 
134 134
         NavigationOptions opts = new NavigationOptions();
135 135
         opts.topBarOptions.hidden = NavigationOptions.BooleanOptions.True;
@@ -154,4 +154,4 @@ public class OptionsApplyingTest extends BaseTest {
154 154
         uutLayoutParams = (RelativeLayout.LayoutParams) ((ViewGroup) uut.getContainer().asView()).getChildAt(1).getLayoutParams();
155 155
         assertThat(uutLayoutParams.getRule(BELOW)).isEqualTo(0);
156 156
     }
157
-}
157
+}

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

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

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

@@ -6,7 +6,7 @@ import android.view.ViewGroup;
6 6
 import com.reactnativenavigation.BaseTest;
7 7
 import com.reactnativenavigation.mocks.TopTabLayoutMock;
8 8
 import com.reactnativenavigation.parse.NavigationOptions;
9
-import com.reactnativenavigation.viewcontrollers.ContainerViewController.IReactView;
9
+import com.reactnativenavigation.viewcontrollers.ComponentViewController.IReactView;
10 10
 import com.reactnativenavigation.viewcontrollers.toptabs.TopTabController;
11 11
 import com.reactnativenavigation.viewcontrollers.toptabs.TopTabsAdapter;
12 12
 import com.reactnativenavigation.viewcontrollers.toptabs.TopTabsController;
@@ -31,7 +31,7 @@ public class TopTabsViewControllerTest extends BaseTest {
31 31
     private List<TopTabLayoutMock> tabs = new ArrayList<>(SIZE);
32 32
     private List<TopTabController> tabControllers = new ArrayList<>(SIZE);
33 33
     private List<NavigationOptions> tabOptions = new ArrayList<>(SIZE);
34
-    private NavigationOptions navigationOptions;
34
+    private NavigationOptions options;
35 35
     private TopTabsLayout topTabsLayout;
36 36
 
37 37
     @Override
@@ -41,12 +41,12 @@ public class TopTabsViewControllerTest extends BaseTest {
41 41
         tabs.clear();
42 42
         Activity activity = newActivity();
43 43
         createTabs(activity);
44
-        navigationOptions = new NavigationOptions();
44
+        options = new NavigationOptions();
45 45
         topTabsLayout = spy(new TopTabsLayout(activity, tabControllers, new TopTabsAdapter(tabControllers)));
46 46
 
47 47
         TopTabsLayoutCreator layoutCreator = Mockito.mock(TopTabsLayoutCreator.class);
48 48
         Mockito.when(layoutCreator.create()).thenReturn(topTabsLayout);
49
-        uut = new TopTabsController(activity, "containerId", tabControllers, layoutCreator, navigationOptions);
49
+        uut = new TopTabsController(activity, "componentId", tabControllers, layoutCreator, options);
50 50
     }
51 51
 
52 52
     private void createTabs(Activity activity) {
@@ -57,14 +57,14 @@ public class TopTabsViewControllerTest extends BaseTest {
57 57
             tabControllers.add(spy(new TopTabController(activity,
58 58
                     "idTab" + i,
59 59
                     "tab" + i,
60
-                    (activity1, containerId, containerName) -> reactView,
60
+                    (activity1, componentId, componentName) -> reactView,
61 61
                     tabOptions.get(i))
62 62
             ));
63 63
         }
64 64
     }
65 65
 
66 66
     @Test
67
-    public void createsViewFromContainerViewCreator() throws Exception {
67
+    public void createsViewFromComponentViewCreator() throws Exception {
68 68
         uut.ensureViewIsCreated();
69 69
         for (int i = 0; i < SIZE; i++) {
70 70
             verify(tabControllers.get(i), times(1)).createView();
@@ -72,7 +72,7 @@ public class TopTabsViewControllerTest extends BaseTest {
72 72
     }
73 73
 
74 74
     @Test
75
-    public void containerViewDestroyedOnDestroy() throws Exception {
75
+    public void componentViewDestroyedOnDestroy() throws Exception {
76 76
         uut.ensureViewIsCreated();
77 77
         TopTabsLayout topTabs = (TopTabsLayout) uut.getView();
78 78
         for (int i = 0; i < SIZE; i++) {
@@ -91,9 +91,9 @@ public class TopTabsViewControllerTest extends BaseTest {
91 91
         TopTabLayoutMock selectedTab = tabs.get(1);
92 92
         uut.onViewAppeared();
93 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 99
     @Test
@@ -102,10 +102,10 @@ public class TopTabsViewControllerTest extends BaseTest {
102 102
         uut.onViewAppeared();
103 103
         uut.switchToTab(1);
104 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 111
     @Test
@@ -130,7 +130,7 @@ public class TopTabsViewControllerTest extends BaseTest {
130 130
     public void appliesOptionsOnLayoutWhenVisible() throws Exception {
131 131
         uut.ensureViewIsCreated();
132 132
         uut.onViewAppeared();
133
-        verify(topTabsLayout, times(1)).applyOptions(navigationOptions);
133
+        verify(topTabsLayout, times(1)).applyOptions(options);
134 134
     }
135 135
 
136 136
     private IReactView tab(TopTabsLayout topTabs, final int index) {

+ 7
- 7
lib/ios/RNNAnimator.m View File

@@ -59,7 +59,7 @@
59 59
 
60 60
 -(NSArray*)prepareSharedElementTransition:(NSArray*)RNNSharedElementsToVC
61 61
 						andfromVCElements:(NSArray*)RNNSharedElementsFromVC
62
-						withContainerView:(UIView*)containerView
62
+						withComponentView:(UIView*)componentView
63 63
 {
64 64
 	NSMutableArray* transitions = [NSMutableArray new];
65 65
 	for (NSDictionary* transition in self.animations) {
@@ -69,8 +69,8 @@
69 69
 		RNNViewLocation* animatedViewLocations = [[RNNViewLocation alloc] initWithTransition:transitionStateHolder andVC:self.fromVC];
70 70
 		RNNAnimatedView* animatedView = [[RNNAnimatedView alloc] initWithTransition:transitionStateHolder andLocation:animatedViewLocations andIsBackButton:self.backButton];
71 71
 		transitionStateHolder.locations = animatedViewLocations;
72
-		[containerView addSubview:animatedView];
73
-		[containerView bringSubviewToFront:animatedView];
72
+		[componentView addSubview:animatedView];
73
+		[componentView bringSubviewToFront:animatedView];
74 74
 		transitionStateHolder.animatedView = animatedView;
75 75
 		[transitions addObject:transitionStateHolder];
76 76
 		if (transitionStateHolder.isSharedElementTransition){
@@ -147,18 +147,18 @@
147 147
 {
148 148
 	UIViewController* toVC   = [transitionContext viewControllerForKey:UITransitionContextToViewControllerKey];
149 149
 	UIViewController* fromVC  = [transitionContext viewControllerForKey:UITransitionContextFromViewControllerKey];
150
-	UIView* containerView = [transitionContext containerView];
150
+	UIView* componentView = [transitionContext containerView];
151 151
 	self.fromVC = fromVC;
152 152
 	self.toVC = toVC;
153 153
 	toVC.view.frame = fromVC.view.frame;
154 154
 	UIView* fromSnapshot = [fromVC.view snapshotViewAfterScreenUpdates:true];
155 155
 	fromSnapshot.frame = fromVC.view.frame;
156
-	[containerView addSubview:fromSnapshot];
157
-	[containerView addSubview:toVC.view];
156
+	[componentView addSubview:fromSnapshot];
157
+	[componentView addSubview:toVC.view];
158 158
 	toVC.view.alpha = 0;
159 159
 	NSArray* onlyForTesting = @[];
160 160
 	NSArray* onlyForTesting2 = @[];
161
-	NSArray* transitions = [self prepareSharedElementTransition:onlyForTesting andfromVCElements:onlyForTesting2 withContainerView:containerView];
161
+	NSArray* transitions = [self prepareSharedElementTransition:onlyForTesting andfromVCElements:onlyForTesting2 withComponentView:componentView];
162 162
 	[self animateComplition:transitions fromVCSnapshot:fromSnapshot andTransitioningContext:transitionContext];
163 163
 	[self animateTransitions:transitions];
164 164
 }

+ 1
- 1
lib/ios/RNNBottomTabsOptions.m View File

@@ -10,7 +10,7 @@ extern const NSInteger BLUR_TOPBAR_TAG;
10 10
 	}
11 11
 	
12 12
 	if (self.currentTabId) {
13
-		[(RNNTabBarController*)viewController.tabBarController setSelectedIndexByContainerID:self.currentTabId];
13
+		[(RNNTabBarController*)viewController.tabBarController setSelectedIndexByComponentID:self.currentTabId];
14 14
 	}
15 15
 	
16 16
 	if (self.hidden) {

+ 18
- 18
lib/ios/RNNBridgeModule.m View File

@@ -24,33 +24,33 @@ RCT_EXPORT_METHOD(setRoot:(NSDictionary*)layout resolver:(RCTPromiseResolveBlock
24 24
 	}];
25 25
 }
26 26
 
27
-RCT_EXPORT_METHOD(setOptions:(NSString*)containerId options:(NSDictionary*)options resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
28
-	[_commandsHandler setOptions:containerId options:options completion:^{
29
-		resolve(containerId);
27
+RCT_EXPORT_METHOD(setOptions:(NSString*)componentId options:(NSDictionary*)options resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
28
+	[_commandsHandler setOptions:componentId options:options completion:^{
29
+		resolve(componentId);
30 30
 	}];
31 31
 }
32 32
 
33
-RCT_EXPORT_METHOD(push:(NSString*)containerId layout:(NSDictionary*)layout resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
34
-	[_commandsHandler push:containerId layout:layout completion:^{
35
-		resolve(containerId);
33
+RCT_EXPORT_METHOD(push:(NSString*)componentId layout:(NSDictionary*)layout resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
34
+	[_commandsHandler push:componentId layout:layout completion:^{
35
+		resolve(componentId);
36 36
 	}];
37 37
 }
38 38
 
39
-RCT_EXPORT_METHOD(pop:(NSString*)containerId options:(NSDictionary*)options resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
40
-	[_commandsHandler pop:containerId options:(NSDictionary*)options completion:^{
41
-		resolve(containerId);
39
+RCT_EXPORT_METHOD(pop:(NSString*)componentId options:(NSDictionary*)options resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
40
+	[_commandsHandler pop:componentId options:(NSDictionary*)options completion:^{
41
+		resolve(componentId);
42 42
 	}];
43 43
 }
44 44
 
45
-RCT_EXPORT_METHOD(popTo:(NSString*)containerId resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
46
-	[_commandsHandler popTo:containerId completion:^{
47
-		resolve(containerId);
45
+RCT_EXPORT_METHOD(popTo:(NSString*)componentId resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
46
+	[_commandsHandler popTo:componentId completion:^{
47
+		resolve(componentId);
48 48
 	}];
49 49
 }
50 50
 
51
-RCT_EXPORT_METHOD(popToRoot:(NSString*)containerId resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
52
-	[_commandsHandler popToRoot:containerId completion:^{
53
-		resolve(containerId);
51
+RCT_EXPORT_METHOD(popToRoot:(NSString*)componentId resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
52
+	[_commandsHandler popToRoot:componentId completion:^{
53
+		resolve(componentId);
54 54
 	}];
55 55
 }
56 56
 
@@ -60,9 +60,9 @@ RCT_EXPORT_METHOD(showModal:(NSDictionary*)layout resolver:(RCTPromiseResolveBlo
60 60
 	}];
61 61
 }
62 62
 
63
-RCT_EXPORT_METHOD(dismissModal:(NSString*)containerId resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
64
-	[_commandsHandler dismissModal:containerId completion:^{
65
-		resolve(containerId);
63
+RCT_EXPORT_METHOD(dismissModal:(NSString*)componentId resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
64
+	[_commandsHandler dismissModal:componentId completion:^{
65
+		resolve(componentId);
66 66
 	}];
67 67
 }
68 68
 

+ 6
- 6
lib/ios/RNNCommandsHandler.h View File

@@ -10,19 +10,19 @@
10 10
 
11 11
 -(void) setRoot:(NSDictionary*)layout completion:(RNNTransitionCompletionBlock)completion;
12 12
 
13
--(void) setOptions:(NSString*)containerId options:(NSDictionary*)options completion:(RNNTransitionCompletionBlock)completion;
13
+-(void) setOptions:(NSString*)componentId options:(NSDictionary*)options completion:(RNNTransitionCompletionBlock)completion;
14 14
 
15
--(void) push:(NSString*)containerId layout:(NSDictionary*)layout completion:(RNNTransitionCompletionBlock)completion;
15
+-(void) push:(NSString*)componentId layout:(NSDictionary*)layout completion:(RNNTransitionCompletionBlock)completion;
16 16
 
17
--(void) pop:(NSString*)containerId options:(NSDictionary*)options completion:(RNNTransitionCompletionBlock)completion;
17
+-(void) pop:(NSString*)componentId options:(NSDictionary*)options completion:(RNNTransitionCompletionBlock)completion;
18 18
 
19
--(void) popTo:(NSString*)containerId completion:(RNNTransitionCompletionBlock)completion;
19
+-(void) popTo:(NSString*)componentId completion:(RNNTransitionCompletionBlock)completion;
20 20
 
21
--(void) popToRoot:(NSString*)containerId completion:(RNNTransitionCompletionBlock)completion;
21
+-(void) popToRoot:(NSString*)componentId completion:(RNNTransitionCompletionBlock)completion;
22 22
 
23 23
 -(void) showModal:(NSDictionary*)layout completion:(RNNTransitionCompletionBlock)completion;
24 24
 
25
--(void) dismissModal:(NSString*)containerId completion:(RNNTransitionCompletionBlock)completion;
25
+-(void) dismissModal:(NSString*)componentId completion:(RNNTransitionCompletionBlock)completion;
26 26
 
27 27
 -(void) dismissAllModalsWithCompletion:(RNNTransitionCompletionBlock)completion;
28 28
 

+ 15
- 15
lib/ios/RNNCommandsHandler.m View File

@@ -35,62 +35,62 @@
35 35
 	completion();
36 36
 }
37 37
 
38
--(void) setOptions:(NSString*)containerId options:(NSDictionary*)options completion:(RNNTransitionCompletionBlock)completion {
38
+-(void) setOptions:(NSString*)componentId options:(NSDictionary*)options completion:(RNNTransitionCompletionBlock)completion {
39 39
 	[self assertReady];
40 40
 	
41
-	UIViewController* vc = [_store findContainerForId:containerId];
41
+	UIViewController* vc = [_store findComponentForId:componentId];
42 42
 	if([vc isKindOfClass:[RNNRootViewController class]]) {
43 43
 		RNNRootViewController* rootVc = (RNNRootViewController*)vc;
44
-		[rootVc.navigationOptions mergeWith:options];
44
+		[rootVc.options mergeWith:options];
45 45
 		[CATransaction begin];
46 46
 		[CATransaction setCompletionBlock:completion];
47 47
 		
48
-		[rootVc.navigationOptions applyOn:vc];
48
+		[rootVc.options applyOn:vc];
49 49
 		
50 50
 		[CATransaction commit];
51 51
 	}
52 52
 }
53 53
 
54
--(void) push:(NSString*)containerId layout:(NSDictionary*)layout completion:(RNNTransitionCompletionBlock)completion {
54
+-(void) push:(NSString*)componentId layout:(NSDictionary*)layout completion:(RNNTransitionCompletionBlock)completion {
55 55
 	[self assertReady];
56 56
 	
57 57
 	UIViewController<RNNRootViewProtocol> *newVc = [_controllerFactory createLayoutAndSaveToStore:layout];
58
-	[_navigationStackManager push:newVc onTop:containerId completion:completion];
58
+	[_navigationStackManager push:newVc onTop:componentId completion:completion];
59 59
 }
60 60
 
61
--(void)pop:(NSString*)containerId options:(NSDictionary*)options completion:(RNNTransitionCompletionBlock)completion {
61
+-(void)pop:(NSString*)componentId options:(NSDictionary*)options completion:(RNNTransitionCompletionBlock)completion {
62 62
 	[self assertReady];
63 63
 	[CATransaction begin];
64 64
 	[CATransaction setCompletionBlock:completion];
65 65
 	NSDictionary* animationData = options[@"customTransition"];
66 66
 	if (animationData){
67 67
 		if ([animationData objectForKey:@"animations"]) {
68
-			[_navigationStackManager pop:containerId withAnimationData:animationData];
68
+			[_navigationStackManager pop:componentId withAnimationData:animationData];
69 69
 		} else {
70 70
 			[[NSException exceptionWithName:NSInvalidArgumentException reason:@"unsupported transitionAnimation" userInfo:nil] raise];
71 71
 		}
72 72
 	} else {
73
-		[_navigationStackManager pop:containerId withAnimationData:nil];
73
+		[_navigationStackManager pop:componentId withAnimationData:nil];
74 74
 	}
75 75
 	[CATransaction commit];
76 76
 }
77 77
 
78
--(void) popTo:(NSString*)containerId completion:(RNNTransitionCompletionBlock)completion {
78
+-(void) popTo:(NSString*)componentId completion:(RNNTransitionCompletionBlock)completion {
79 79
 	[self assertReady];
80 80
 	[CATransaction begin];
81 81
 	[CATransaction setCompletionBlock:completion];
82 82
 	
83
-	[_navigationStackManager popTo:containerId];
83
+	[_navigationStackManager popTo:componentId];
84 84
 	
85 85
 	[CATransaction commit];
86 86
 }
87 87
 
88
--(void) popToRoot:(NSString*)containerId completion:(RNNTransitionCompletionBlock)completion {
88
+-(void) popToRoot:(NSString*)componentId completion:(RNNTransitionCompletionBlock)completion {
89 89
 	[self assertReady];
90 90
 	[CATransaction begin];
91 91
 	[CATransaction setCompletionBlock:completion];
92 92
 	
93
-	[_navigationStackManager popToRoot:containerId];
93
+	[_navigationStackManager popToRoot:componentId];
94 94
 	
95 95
 	[CATransaction commit];
96 96
 }
@@ -102,12 +102,12 @@
102 102
 	[_modalManager showModal:newVc completion:completion];
103 103
 }
104 104
 
105
--(void) dismissModal:(NSString*)containerId completion:(RNNTransitionCompletionBlock)completion {
105
+-(void) dismissModal:(NSString*)componentId completion:(RNNTransitionCompletionBlock)completion {
106 106
 	[self assertReady];
107 107
 	[CATransaction begin];
108 108
 	[CATransaction setCompletionBlock:completion];
109 109
 	
110
-	[_modalManager dismissModal:containerId];
110
+	[_modalManager dismissModal:componentId];
111 111
 	
112 112
 	[CATransaction commit];
113 113
 }

+ 12
- 12
lib/ios/RNNControllerFactory.m View File

@@ -44,12 +44,12 @@
44 44
 	
45 45
 	UIViewController<RNNRootViewProtocol> *result;
46 46
 	
47
-	if ( node.isContainer || node.isTopTab) {
48
-		result = [self createContainer:node];
47
+	if ( node.isComponent) {
48
+		result = [self createComponent:node];
49 49
 	}
50 50
 	
51
-	else if (node.isContainerStack)	{
52
-		result = [self createContainerStack:node];
51
+	else if (node.isStack)	{
52
+		result = [self createStack:node];
53 53
 	}
54 54
 	
55 55
 	else if (node.isTabs) {
@@ -79,25 +79,25 @@
79 79
 		@throw [NSException exceptionWithName:@"UnknownControllerType" reason:[@"Unknown controller type " stringByAppendingString:node.type] userInfo:nil];
80 80
 	}
81 81
 
82
-	[_store setContainer:result containerId:node.nodeId];
82
+	[_store setComponent:result componentId:node.nodeId];
83 83
 	
84 84
 	return result;
85 85
 }
86 86
 
87
-- (UIViewController<RNNRootViewProtocol> *)createContainer:(RNNLayoutNode*)node {
87
+- (UIViewController<RNNRootViewProtocol> *)createComponent:(RNNLayoutNode*)node {
88 88
 	NSString* name = node.data[@"name"];
89 89
 	NSDictionary* customTransition = node.data[@"customTransition"];
90 90
 	RNNAnimator* animator = [[RNNAnimator alloc] initWithAnimationsDictionary:customTransition];
91
-	RNNNavigationOptions* options = [[RNNNavigationOptions alloc] initWithDict:node.data[@"navigationOptions"]];
92
-	NSString* containerId = node.nodeId;
93
-	RNNRootViewController* container = [[RNNRootViewController alloc] initWithName:name withOptions:options withContainerId:containerId rootViewCreator:_creator eventEmitter:_eventEmitter animator:animator];
91
+	RNNNavigationOptions* options = [[RNNNavigationOptions alloc] initWithDict:node.data[@"options"]];
92
+	NSString* componentId = node.nodeId;
93
+	RNNRootViewController* component = [[RNNRootViewController alloc] initWithName:name withOptions:options withComponentId:componentId rootViewCreator:_creator eventEmitter:_eventEmitter animator:animator];
94 94
 	CGSize availableSize = UIApplication.sharedApplication.delegate.window.bounds.size;
95
-	[_bridge.uiManager setAvailableSize:availableSize forRootView:container.view];
95
+	[_bridge.uiManager setAvailableSize:availableSize forRootView:component.view];
96 96
 	
97
-	return container;
97
+	return component;
98 98
 }
99 99
 
100
-- (UIViewController<RNNRootViewProtocol> *)createContainerStack:(RNNLayoutNode*)node {
100
+- (UIViewController<RNNRootViewProtocol> *)createStack:(RNNLayoutNode*)node {
101 101
 	RNNNavigationController* vc = [[RNNNavigationController alloc] init];
102 102
 	
103 103
 	NSMutableArray* controllers = [NSMutableArray new];

+ 3
- 3
lib/ios/RNNEventEmitter.h View File

@@ -8,10 +8,10 @@
8 8
 
9 9
 -(void)sendOnAppLaunched;
10 10
 
11
--(void)sendContainerDidAppear:(NSString*)containerId;
11
+-(void)sendComponentDidAppear:(NSString*)componentId;
12 12
 
13
--(void)sendContainerDidDisappear:(NSString*)containerId;
13
+-(void)sendComponentDidDisappear:(NSString*)componentId;
14 14
 
15
--(void)sendOnNavigationButtonPressed:(NSString*)containerId buttonId:(NSString*)buttonId;
15
+-(void)sendOnNavigationButtonPressed:(NSString*)componentId buttonId:(NSString*)buttonId;
16 16
 
17 17
 @end

+ 9
- 9
lib/ios/RNNEventEmitter.m View File

@@ -5,12 +5,12 @@
5 5
 RCT_EXPORT_MODULE();
6 6
 
7 7
 static NSString* const onAppLaunched	= @"RNN.appLaunched";
8
-static NSString* const containerDidAppear	= @"RNN.containerDidAppear";
9
-static NSString* const containerDidDisappear	= @"RNN.containerDidDisappear";
8
+static NSString* const componentDidAppear	= @"RNN.componentDidAppear";
9
+static NSString* const componentDidDisappear	= @"RNN.componentDidDisappear";
10 10
 static NSString* const onNavigationButtonPressed	= @"RNN.navigationButtonPressed";
11 11
 
12 12
 -(NSArray<NSString *> *)supportedEvents {
13
-	return @[onAppLaunched, containerDidAppear, containerDidDisappear, onNavigationButtonPressed];
13
+	return @[onAppLaunched, componentDidAppear, componentDidDisappear, onNavigationButtonPressed];
14 14
 }
15 15
 
16 16
 # pragma mark public
@@ -19,16 +19,16 @@ static NSString* const onNavigationButtonPressed	= @"RNN.navigationButtonPressed
19 19
 	[self send:onAppLaunched body:nil];
20 20
 }
21 21
 
22
--(void)sendContainerDidAppear:(NSString *)containerId {
23
-	[self send:containerDidAppear body:containerId];
22
+-(void)sendComponentDidAppear:(NSString *)componentId {
23
+	[self send:componentDidAppear body:componentId];
24 24
 }
25 25
 
26
--(void)sendContainerDidDisappear:(NSString *)containerId {
27
-	[self send:containerDidDisappear body:containerId];
26
+-(void)sendComponentDidDisappear:(NSString *)componentId {
27
+	[self send:componentDidDisappear body:componentId];
28 28
 }
29 29
 
30
--(void)sendOnNavigationButtonPressed:(NSString *)containerId buttonId:(NSString*)buttonId {
31
-	[self send:onNavigationButtonPressed body:@{@"containerId":containerId , @"buttonId": buttonId }];
30
+-(void)sendOnNavigationButtonPressed:(NSString *)componentId buttonId:(NSString*)buttonId {
31
+	[self send:onNavigationButtonPressed body:@{@"componentId":componentId , @"buttonId": buttonId }];
32 32
 }
33 33
 
34 34
 # pragma mark private

+ 11
- 11
lib/ios/RNNInteractivePopAnimator.m View File

@@ -90,7 +90,7 @@
90 90
 	return YES;
91 91
 }
92 92
 - (void)animationEnded:(BOOL)transitionCompleted {
93
-	
93
+
94 94
 }
95 95
 
96 96
 - (NSTimeInterval)transitionDuration:(id <UIViewControllerContextTransitioning>)transitionContext
@@ -104,8 +104,8 @@
104 104
 	self.transitionContext = transitionContext;
105 105
 	UIViewController* toVC   = [transitionContext viewControllerForKey:UITransitionContextToViewControllerKey];
106 106
 	UIViewController* fromVC  = [transitionContext viewControllerForKey:UITransitionContextFromViewControllerKey];
107
-	UIView* containerView = [transitionContext containerView];
108
-	
107
+	UIView* componentView = [transitionContext containerView];
108
+
109 109
 	toVC.view.frame = fromVC.view.frame;
110 110
 	UIView* topViewContent = [self.topView subviews][0];
111 111
 	UIImage* image = [[self.topView subviews][0] image];
@@ -122,8 +122,8 @@
122 122
 	[self.bottomView setHidden:YES];
123 123
 	UIView* toSnapshot = [toVC.view snapshotViewAfterScreenUpdates:true];
124 124
 	toSnapshot.frame = fromVC.view.frame;
125
-	[containerView insertSubview:(UIView *)toSnapshot atIndex:1];
126
-	[containerView addSubview:self.imageSnapshot];
125
+	[componentView insertSubview:(UIView *)toSnapshot atIndex:1];
126
+	[componentView addSubview:self.imageSnapshot];
127 127
 	toSnapshot.alpha = 0.0;
128 128
 	[self.topView setHidden:YES];
129 129
 	[UIView animateKeyframesWithDuration:(NSTimeInterval)[self transitionDuration:transitionContext]
@@ -141,13 +141,13 @@
141 141
 								  [self.imageSnapshot removeFromSuperview];
142 142
 								  self.totalTranslate = 0;
143 143
 								  if (![transitionContext transitionWasCancelled]) {
144
-									  [containerView addSubview: toVC.view];
144
+									  [componentView addSubview: toVC.view];
145 145
 									  [transitionContext completeTransition:![transitionContext transitionWasCancelled]];
146
-									  
146
+
147 147
 								  }
148 148
 								  if ([transitionContext transitionWasCancelled]) {
149 149
 									  [self.topView setHidden:NO];
150
-									  [containerView addSubview: fromVC.view];
150
+									  [componentView addSubview: fromVC.view];
151 151
 									  [transitionContext completeTransition:NO];
152 152
 								  }
153 153
 							  }];
@@ -157,15 +157,15 @@
157 157
 								  animationControllerForOperation:(UINavigationControllerOperation)operation
158 158
 											   fromViewController:(UIViewController*)fromVC
159 159
 												 toViewController:(UIViewController*)toVC {
160
-	
160
+
161 161
 		if (operation == UINavigationControllerOperationPop) {
162 162
 			return self;
163 163
 		} else {
164 164
 			return nil;
165 165
 		}
166
-	
166
+
167 167
 	return nil;
168
-	
168
+
169 169
 }
170 170
 - (id<UIViewControllerInteractiveTransitioning>)navigationController:(UINavigationController *)navigationController
171 171
 						 interactionControllerForAnimationController:(id<UIViewControllerAnimatedTransitioning>)animationController {

+ 2
- 3
lib/ios/RNNLayoutNode.h View File

@@ -11,11 +11,10 @@
11 11
 
12 12
 +(instancetype)create:(NSDictionary *)json;
13 13
 
14
--(BOOL)isContainer;
15
--(BOOL)isContainerStack;
14
+-(BOOL)isComponent;
15
+-(BOOL)isStack;
16 16
 -(BOOL)isTabs;
17 17
 -(BOOL)isTopTabs;
18
--(BOOL)isTopTab;
19 18
 -(BOOL)isSideMenuRoot;
20 19
 -(BOOL)isSideMenuLeft;
21 20
 -(BOOL)isSideMenuRight;

+ 4
- 8
lib/ios/RNNLayoutNode.m View File

@@ -13,13 +13,13 @@
13 13
 	return node;
14 14
 }
15 15
 
16
--(BOOL)isContainer
16
+-(BOOL)isComponent
17 17
 {
18
-	return [self.type isEqualToString:@"Container"];
18
+	return [self.type isEqualToString:@"Component"];
19 19
 }
20
--(BOOL)isContainerStack
20
+-(BOOL)isStack
21 21
 {
22
-	return [self.type isEqualToString:@"ContainerStack"];
22
+	return [self.type isEqualToString:@"Stack"];
23 23
 }
24 24
 -(BOOL)isTabs
25 25
 {
@@ -29,10 +29,6 @@
29 29
 {
30 30
 	return [self.type isEqualToString:@"TopTabs"];
31 31
 }
32
--(BOOL)isTopTab
33
-{
34
-	return [self.type isEqualToString:@"TopTab"];
35
-}
36 32
 -(BOOL)isSideMenuRoot
37 33
 {
38 34
 	return [self.type isEqualToString:@"SideMenuRoot"];

+ 1
- 1
lib/ios/RNNModalManager.h View File

@@ -8,7 +8,7 @@
8 8
 
9 9
 -(instancetype)initWithStore:(RNNStore*)store;
10 10
 -(void)showModal:(UIViewController*)viewController completion:(RNNTransitionCompletionBlock)completion;
11
--(void)dismissModal:(NSString*)containerId;
11
+-(void)dismissModal:(NSString*)componentId;
12 12
 -(void)dismissAllModals;
13 13
 
14 14
 @end

+ 5
- 5
lib/ios/RNNModalManager.m View File

@@ -36,8 +36,8 @@
36 36
 	[self waitForContentToAppearAndThen:@selector(showModalAfterLoad:)];
37 37
 }
38 38
 
39
--(void)dismissModal:(NSString *)containerId {
40
-	[[_store pendingModalIdsToDismiss] addObject:containerId];
39
+-(void)dismissModal:(NSString *)componentId {
40
+	[[_store pendingModalIdsToDismiss] addObject:componentId];
41 41
 	[self removePendingNextModalIfOnTop];
42 42
 }
43 43
 
@@ -51,9 +51,9 @@
51 51
 
52 52
 
53 53
 -(void)removePendingNextModalIfOnTop {
54
-	NSString *containerId = [[_store pendingModalIdsToDismiss] lastObject];
54
+	NSString *componentId = [[_store pendingModalIdsToDismiss] lastObject];
55 55
 	
56
-	UIViewController *modalToDismiss = [_store findContainerForId:containerId];
56
+	UIViewController *modalToDismiss = [_store findComponentForId:componentId];
57 57
 	
58 58
 	if(!modalToDismiss) {
59 59
 		return;
@@ -63,7 +63,7 @@
63 63
 	
64 64
 	if (modalToDismiss == topPresentedVC || [[topPresentedVC childViewControllers] containsObject:modalToDismiss]) {
65 65
 		[modalToDismiss dismissViewControllerAnimated:YES completion:^{
66
-			[[_store pendingModalIdsToDismiss] removeObject:containerId];
66
+			[[_store pendingModalIdsToDismiss] removeObject:componentId];
67 67
 			[self removePendingNextModalIfOnTop];
68 68
 		}];
69 69
 	}

+ 1
- 1
lib/ios/RNNNavigationButtons.m View File

@@ -104,7 +104,7 @@
104 104
 }
105 105
 
106 106
 -(void)onButtonPress:(RNNUIBarButtonItem*)barButtonItem {
107
-	[self.viewController.eventEmitter sendOnNavigationButtonPressed:self.viewController.containerId buttonId:barButtonItem.buttonId];
107
+	[self.viewController.eventEmitter sendOnNavigationButtonPressed:self.viewController.componentId buttonId:barButtonItem.buttonId];
108 108
 }
109 109
 
110 110
 @end

+ 12
- 12
lib/ios/RNNNavigationOptions.m View File

@@ -17,19 +17,19 @@ const NSInteger TOP_BAR_TRANSPARENT_TAG = 78264803;
17 17
 	return [self initWithDict:@{}];
18 18
 }
19 19
 
20
--(instancetype)initWithDict:(NSDictionary *)navigationOptions {
20
+-(instancetype)initWithDict:(NSDictionary *)options {
21 21
 	self = [super init];
22
-	self.statusBarHidden = [navigationOptions objectForKey:@"statusBarHidden"];
23
-	self.screenBackgroundColor = [navigationOptions objectForKey:@"screenBackgroundColor"];
24
-	self.backButtonTransition = [navigationOptions objectForKey:@"backButtonTransition"];
25
-	self.orientation = [navigationOptions objectForKey:@"orientation"];
26
-	self.topBar = [[RNNTopBarOptions alloc] initWithDict:[navigationOptions objectForKey:@"topBar"]];
27
-	self.topTab = [[RNNTopTabOptions alloc] initWithDict:[navigationOptions objectForKey:@"topTab"]];
28
-	self.bottomTabs = [[RNNBottomTabsOptions alloc] initWithDict:[navigationOptions objectForKey:@"bottomTabs"]];
29
-	self.sideMenu = [[RNNSideMenuOptions alloc] initWithDict:[navigationOptions objectForKey:@"sideMenu"]];
30
-	self.backgroundImage = [RCTConvert UIImage:[navigationOptions objectForKey:@"backgroundImage"]];
31
-	self.rootBackgroundImage = [RCTConvert UIImage:[navigationOptions objectForKey:@"rootBackgroundImage"]];
32
-	self.bottomTab = [[RNNBottomTabOptions alloc] initWithDict:[navigationOptions objectForKey:@"bottomTab"]];
22
+	self.statusBarHidden = [options objectForKey:@"statusBarHidden"];
23
+	self.screenBackgroundColor = [options objectForKey:@"screenBackgroundColor"];
24
+	self.backButtonTransition = [options objectForKey:@"backButtonTransition"];
25
+	self.orientation = [options objectForKey:@"orientation"];
26
+	self.topBar = [[RNNTopBarOptions alloc] initWithDict:[options objectForKey:@"topBar"]];
27
+	self.topTab = [[RNNTopTabOptions alloc] initWithDict:[options objectForKey:@"topTab"]];
28
+	self.bottomTabs = [[RNNBottomTabsOptions alloc] initWithDict:[options objectForKey:@"bottomTabs"]];
29
+	self.sideMenu = [[RNNSideMenuOptions alloc] initWithDict:[options objectForKey:@"sideMenu"]];
30
+	self.backgroundImage = [RCTConvert UIImage:[options objectForKey:@"backgroundImage"]];
31
+	self.rootBackgroundImage = [RCTConvert UIImage:[options objectForKey:@"rootBackgroundImage"]];
32
+	self.bottomTab = [[RNNBottomTabOptions alloc] initWithDict:[options objectForKey:@"bottomTab"]];
33 33
     
34 34
 	return self;
35 35
 }

+ 4
- 4
lib/ios/RNNNavigationStackManager.h View File

@@ -10,9 +10,9 @@
10 10
 -(instancetype)initWithStore:(RNNStore*)store;
11 11
 
12 12
 
13
--(void)push:(UIViewController<RNNRootViewProtocol>*)newTop onTop:(NSString*)containerId completion:(RNNTransitionCompletionBlock)completion;
14
--(void)pop:(NSString*)containerId withAnimationData:(NSDictionary*)animationData;
15
--(void)popTo:(NSString*)containerId;
16
--(void)popToRoot:(NSString*)containerId;
13
+-(void)push:(UIViewController<RNNRootViewProtocol>*)newTop onTop:(NSString*)componentId completion:(RNNTransitionCompletionBlock)completion;
14
+-(void)pop:(NSString*)componentId withAnimationData:(NSDictionary*)animationData;
15
+-(void)popTo:(NSString*)componentId;
16
+-(void)popToRoot:(NSString*)componentId;
17 17
 
18 18
 @end

+ 10
- 10
lib/ios/RNNNavigationStackManager.m View File

@@ -15,8 +15,8 @@ dispatch_queue_t RCTGetUIManagerQueue(void);
15 15
 	return self;
16 16
 }
17 17
 
18
--(void)push:(UIViewController<RNNRootViewProtocol> *)newTop onTop:(NSString *)containerId completion:(RNNTransitionCompletionBlock)completion {
19
-	UIViewController *vc = [_store findContainerForId:containerId];
18
+-(void)push:(UIViewController<RNNRootViewProtocol> *)newTop onTop:(NSString *)componentId completion:(RNNTransitionCompletionBlock)completion {
19
+	UIViewController *vc = [_store findComponentForId:componentId];
20 20
 	[self preparePush:newTop onTopVC:vc completion:completion];
21 21
 	[self waitForContentToAppearAndThen:@selector(pushAfterLoad:)];
22 22
 }
@@ -60,8 +60,8 @@ dispatch_queue_t RCTGetUIManagerQueue(void);
60 60
 	self.fromVC = nil;
61 61
 }
62 62
 
63
--(void)pop:(NSString *)containerId withAnimationData:(NSDictionary *)animationData {
64
-	UIViewController* vc = [_store findContainerForId:containerId];
63
+-(void)pop:(NSString *)componentId withAnimationData:(NSDictionary *)animationData {
64
+	UIViewController* vc = [_store findComponentForId:componentId];
65 65
 	UINavigationController* nvc = [vc navigationController];
66 66
 	if ([nvc topViewController] == vc) {
67 67
 		if (animationData) {
@@ -78,11 +78,11 @@ dispatch_queue_t RCTGetUIManagerQueue(void);
78 78
 		[vcs removeObject:vc];
79 79
 		[nvc setViewControllers:vcs animated:YES];
80 80
 	}
81
-	[_store removeContainer:containerId];
81
+	[_store removeComponent:componentId];
82 82
 }
83 83
 
84
--(void)popTo:(NSString*)containerId {
85
-	UIViewController *vc = [_store findContainerForId:containerId];
84
+-(void)popTo:(NSString*)componentId {
85
+	UIViewController *vc = [_store findComponentForId:componentId];
86 86
 	
87 87
 	if (vc) {
88 88
 		UINavigationController *nvc = [vc navigationController];
@@ -93,8 +93,8 @@ dispatch_queue_t RCTGetUIManagerQueue(void);
93 93
 	}
94 94
 }
95 95
 
96
--(void) popToRoot:(NSString*)containerId {
97
-	UIViewController* vc = [_store findContainerForId:containerId];
96
+-(void) popToRoot:(NSString*)componentId {
97
+	UIViewController* vc = [_store findComponentForId:componentId];
98 98
 	UINavigationController* nvc = [vc navigationController];
99 99
 	NSArray* poppedVCs = [nvc popToRootViewControllerAnimated:YES];
100 100
 	[self removePopedViewControllers:poppedVCs];
@@ -102,7 +102,7 @@ dispatch_queue_t RCTGetUIManagerQueue(void);
102 102
 
103 103
 -(void)removePopedViewControllers:(NSArray*)viewControllers {
104 104
 	for (UIViewController *popedVC in viewControllers) {
105
-		[_store removeContainerByViewControllerInstance:popedVC];
105
+		[_store removeComponentByViewControllerInstance:popedVC];
106 106
 	}
107 107
 }
108 108
 

+ 1
- 1
lib/ios/RNNReactRootViewCreator.m View File

@@ -30,7 +30,7 @@
30 30
 	
31 31
 	UIView *view = [[RNNReactRootView alloc] initWithBridge:_bridge
32 32
 										 moduleName:name
33
-								  initialProperties:@{@"containerId": rootViewId}];
33
+								  initialProperties:@{@"componentId": rootViewId}];
34 34
 	return view;
35 35
 }
36 36
 

+ 3
- 3
lib/ios/RNNRootViewController.h View File

@@ -11,15 +11,15 @@
11 11
 
12 12
 @interface RNNRootViewController : UIViewController	<RNNRootViewProtocol>
13 13
 
14
-@property (nonatomic, strong) RNNNavigationOptions* navigationOptions;
14
+@property (nonatomic, strong) RNNNavigationOptions* options;
15 15
 @property (nonatomic, strong) RNNAnimator* animator;
16 16
 @property (nonatomic, strong) RNNEventEmitter *eventEmitter;
17
-@property (nonatomic, strong) NSString* containerId;
17
+@property (nonatomic, strong) NSString* componentId;
18 18
 @property (nonatomic, strong) RNNTopTabsViewController* topTabsViewController;
19 19
 
20 20
 -(instancetype)initWithName:(NSString*)name
21 21
 				withOptions:(RNNNavigationOptions*)options
22
-			withContainerId:(NSString*)containerId
22
+			withComponentId:(NSString*)componentId
23 23
 			rootViewCreator:(id<RNNRootViewCreator>)creator
24 24
 			   eventEmitter:(RNNEventEmitter*)eventEmitter
25 25
 		   animator:(RNNAnimator*)animator;

+ 18
- 18
lib/ios/RNNRootViewController.m View File

@@ -4,7 +4,7 @@
4 4
 #import "RNNAnimator.h"
5 5
 
6 6
 @interface RNNRootViewController()
7
-@property (nonatomic, strong) NSString* containerName;
7
+@property (nonatomic, strong) NSString* componentName;
8 8
 @property (nonatomic) BOOL _statusBarHidden;
9 9
 
10 10
 @end
@@ -13,17 +13,17 @@
13 13
 
14 14
 -(instancetype)initWithName:(NSString*)name
15 15
 				withOptions:(RNNNavigationOptions*)options
16
-			withContainerId:(NSString*)containerId
16
+			withComponentId:(NSString*)componentId
17 17
 			rootViewCreator:(id<RNNRootViewCreator>)creator
18 18
 			   eventEmitter:(RNNEventEmitter*)eventEmitter
19 19
 				   animator:(RNNAnimator *)animator {
20 20
 	self = [super init];
21
-	self.containerId = containerId;
22
-	self.containerName = name;
23
-	self.navigationOptions = options;
21
+	self.componentId = componentId;
22
+	self.componentName = name;
23
+	self.options = options;
24 24
 	self.eventEmitter = eventEmitter;
25 25
 	self.animator = animator;
26
-	self.view = [creator createRootView:self.containerName rootViewId:self.containerId];
26
+	self.view = [creator createRootView:self.componentName rootViewId:self.componentId];
27 27
 	
28 28
 	[[NSNotificationCenter defaultCenter] addObserver:self
29 29
 											 selector:@selector(onJsReload)
@@ -37,7 +37,7 @@
37 37
 	
38 38
 -(void)viewWillAppear:(BOOL)animated{
39 39
 	[super viewWillAppear:animated];
40
-	[self.navigationOptions applyOn:self];
40
+	[self.options applyOn:self];
41 41
 }
42 42
 
43 43
 - (void)viewDidLoad {
@@ -45,43 +45,43 @@
45 45
 }
46 46
 
47 47
 -(BOOL)isCustomTransitioned {
48
-	return self.animator;
48
+	return self.animator != nil;
49 49
 }
50 50
 
51 51
 - (BOOL)prefersStatusBarHidden {
52
-	if ([self.navigationOptions.statusBarHidden boolValue]) {
52
+	if ([self.options.statusBarHidden boolValue]) {
53 53
 		return YES;
54
-	} else if ([self.navigationOptions.statusBarHideWithTopBar boolValue]) {
54
+	} else if ([self.options.statusBarHideWithTopBar boolValue]) {
55 55
 		return self.navigationController.isNavigationBarHidden;
56 56
 	}
57 57
 	return NO;
58 58
 }
59 59
 
60 60
 - (UIInterfaceOrientationMask)supportedInterfaceOrientations {
61
-	return self.navigationOptions.supportedOrientations;
61
+	return self.options.supportedOrientations;
62 62
 }
63 63
 
64 64
 - (BOOL)hidesBottomBarWhenPushed
65 65
 {
66
-	if (self.navigationOptions.bottomTabs && self.navigationOptions.bottomTabs.hidden) {
67
-		return [self.navigationOptions.bottomTabs.hidden boolValue];
66
+	if (self.options.bottomTabs && self.options.bottomTabs.hidden) {
67
+		return [self.options.bottomTabs.hidden boolValue];
68 68
 	}
69 69
 	return NO;
70 70
 }
71 71
 
72 72
 -(void)viewDidAppear:(BOOL)animated {
73 73
 	[super viewDidAppear:animated];
74
-	[self.eventEmitter sendContainerDidAppear:self.containerId];
74
+	[self.eventEmitter sendComponentDidAppear:self.componentId];
75 75
 }
76 76
 
77 77
 -(void)viewDidDisappear:(BOOL)animated {
78 78
 	[super viewDidDisappear:animated];
79
-	[self.eventEmitter sendContainerDidDisappear:self.containerId];
79
+	[self.eventEmitter sendComponentDidDisappear:self.componentId];
80 80
 }
81 81
 
82 82
 - (void)navigationController:(UINavigationController *)navigationController didShowViewController:(UIViewController *)viewController animated:(BOOL)animated{
83 83
 	RNNRootViewController* vc =  (RNNRootViewController*)viewController;
84
-	if (![vc.navigationOptions.backButtonTransition isEqualToString:@"custom"]){
84
+	if (![vc.options.backButtonTransition isEqualToString:@"custom"]){
85 85
 		navigationController.delegate = nil;
86 86
 	}
87 87
 }
@@ -104,11 +104,11 @@
104 104
 }
105 105
 
106 106
 -(void)applyTabBarItem {
107
-	[self.navigationOptions.bottomTab applyOn:self];
107
+	[self.options.bottomTab applyOn:self];
108 108
 }
109 109
 
110 110
 -(void)applyTopTabsOptions {
111
-	[self.navigationOptions.topTab applyOn:self];
111
+	[self.options.topTab applyOn:self];
112 112
 }
113 113
 
114 114
 /**

+ 5
- 5
lib/ios/RNNStore.h View File

@@ -7,12 +7,12 @@ typedef void (^RNNTransitionCompletionBlock)(void);
7 7
 
8 8
 @interface RNNStore : NSObject
9 9
 
10
--(UIViewController*) findContainerForId:(NSString*)containerId;
11
--(void) setContainer:(UIViewController*)viewController containerId:(NSString*)containerId;
12
--(void) removeContainer:(NSString*)containerId;
13
--(void) removeContainerByViewControllerInstance:(UIViewController*)containerInstance;
10
+-(UIViewController*) findComponentForId:(NSString*)componentId;
11
+-(void) setComponent:(UIViewController*)viewController componentId:(NSString*)componentId;
12
+-(void) removeComponent:(NSString*)componentId;
13
+-(void) removeComponentByViewControllerInstance:(UIViewController*)componentInstance;
14 14
 
15
--(NSString*)containerKeyForInstance:(UIViewController*)instance;
15
+-(NSString*)componentKeyForInstance:(UIViewController*)instance;
16 16
 
17 17
 -(void) setReadyToReceiveCommands:(BOOL)isReady;
18 18
 -(BOOL) isReadyToReceiveCommands;

+ 17
- 17
lib/ios/RNNStore.m View File

@@ -6,7 +6,7 @@
6 6
 @end
7 7
 
8 8
 @implementation RNNStore {
9
-	NSMapTable* _containerStore;
9
+	NSMapTable* _componentStore;
10 10
 	NSMutableArray* _pendingModalIdsToDismiss;
11 11
 	BOOL _isReadyToReceiveCommands;
12 12
 }
@@ -14,32 +14,32 @@
14 14
 -(instancetype)init {
15 15
 	self = [super init];
16 16
 	_isReadyToReceiveCommands = false;
17
-	_containerStore = [NSMapTable strongToWeakObjectsMapTable];
17
+	_componentStore = [NSMapTable strongToWeakObjectsMapTable];
18 18
 	_pendingModalIdsToDismiss = [NSMutableArray new];
19 19
 	return self;
20 20
 }
21 21
 
22
--(UIViewController *)findContainerForId:(NSString *)containerId {
23
-	return [_containerStore objectForKey:containerId];
22
+-(UIViewController *)findComponentForId:(NSString *)componentId {
23
+	return [_componentStore objectForKey:componentId];
24 24
 }
25 25
 
26
-- (void)setContainer:(UIViewController*)viewController containerId:(NSString*)containerId {
27
-	UIViewController *existingVewController = [self findContainerForId:containerId];
26
+- (void)setComponent:(UIViewController*)viewController componentId:(NSString*)componentId {
27
+	UIViewController *existingVewController = [self findComponentForId:componentId];
28 28
 	if (existingVewController) {
29
-		@throw [NSException exceptionWithName:@"MultipleContainerId" reason:[@"Container id already exists " stringByAppendingString:containerId] userInfo:nil];
29
+		@throw [NSException exceptionWithName:@"MultipleComponentId" reason:[@"Component id already exists " stringByAppendingString:componentId] userInfo:nil];
30 30
 	}
31 31
 	
32
-	[_containerStore setObject:viewController forKey:containerId];
32
+	[_componentStore setObject:viewController forKey:componentId];
33 33
 }
34 34
 
35
-- (void)removeContainer:(NSString*)containerId {
36
-	[_containerStore removeObjectForKey:containerId];
35
+- (void)removeComponent:(NSString*)componentId {
36
+	[_componentStore removeObjectForKey:componentId];
37 37
 }
38 38
 
39
-- (void)removeContainerByViewControllerInstance:(UIViewController*)containerInstance {
40
-	NSString *foundKey = [self containerKeyForInstance:containerInstance];
39
+- (void)removeComponentByViewControllerInstance:(UIViewController*)componentInstance {
40
+	NSString *foundKey = [self componentKeyForInstance:componentInstance];
41 41
 	if (foundKey) {
42
-		[self removeContainer:foundKey];
42
+		[self removeComponent:foundKey];
43 43
 	}
44 44
 }
45 45
 
@@ -58,12 +58,12 @@
58 58
 -(void)clean {
59 59
 	_isReadyToReceiveCommands = false;
60 60
 	[_pendingModalIdsToDismiss removeAllObjects];
61
-	[_containerStore removeAllObjects];
61
+	[_componentStore removeAllObjects];
62 62
 }
63 63
 
64
--(NSString*)containerKeyForInstance:(UIViewController*)instance {
65
-	for (NSString *key in _containerStore) {
66
-		UIViewController *value = [_containerStore objectForKey:key];
64
+-(NSString*)componentKeyForInstance:(UIViewController*)instance {
65
+	for (NSString *key in _componentStore) {
66
+		UIViewController *value = [_componentStore objectForKey:key];
67 67
 		if (value == instance) {
68 68
 			return key;
69 69
 		}

+ 1
- 1
lib/ios/RNNTabBarController.h View File

@@ -5,6 +5,6 @@
5 5
 @interface RNNTabBarController : UITabBarController <RNNRootViewProtocol>
6 6
 
7 7
 - (void)setTabBarHidden:(BOOL)hidden animated:(BOOL)animated;
8
-- (void)setSelectedIndexByContainerID:(NSString *)containerID;
8
+- (void)setSelectedIndexByComponentID:(NSString *)componentID;
9 9
 
10 10
 @end

+ 2
- 2
lib/ios/RNNTabBarController.m View File

@@ -21,13 +21,13 @@
21 21
 	}];
22 22
 }
23 23
 
24
-- (void)setSelectedIndexByContainerID:(NSString *)containerID {
24
+- (void)setSelectedIndexByComponentID:(NSString *)componentID {
25 25
 	for (id child in self.childViewControllers) {
26 26
 		RNNRootViewController* vc = child;
27 27
 		if ([child isKindOfClass:[UINavigationController class]]) {
28 28
 			vc = ((UINavigationController *)child).childViewControllers.firstObject;
29 29
 		}
30
-		if ([vc.containerId isEqualToString:containerID]) {
30
+		if ([vc.componentId isEqualToString:componentID]) {
31 31
 			[self setSelectedIndex:[self.childViewControllers indexOfObject:child]];
32 32
 		}
33 33
 	}

+ 3
- 3
lib/ios/ReactNativeNavigationTests/RNNCommandsHandlerTest.m View File

@@ -66,7 +66,7 @@
66 66
 	[initialOptions.topBar setTitle:@"the title"];
67 67
 	RNNRootViewController* vc = [[RNNRootViewController alloc] initWithName:@"name"
68 68
 																withOptions:initialOptions
69
-															withContainerId:@"containerId"
69
+															withComponentId:@"componentId"
70 70
 															rootViewCreator:[[RNNTestRootViewCreator alloc] init]
71 71
 															   eventEmitter:nil
72 72
 																   animator:nil];
@@ -75,12 +75,12 @@
75 75
 	XCTAssertTrue([vc.navigationItem.title isEqual:@"the title"]);
76 76
 
77 77
 	[self.store setReadyToReceiveCommands:true];
78
-	[self.store setContainer:vc containerId:@"containerId"];
78
+	[self.store setComponent:vc componentId:@"componentId"];
79 79
 	
80 80
 	NSDictionary* dictFromJs = @{@"topBar": @{@"backgroundColor" :@(0xFFFF0000)}};
81 81
 	UIColor* expectedColor = [UIColor colorWithRed:1 green:0 blue:0 alpha:1];
82 82
 
83
-	[self.uut setOptions:@"containerId" options:dictFromJs completion:^{
83
+	[self.uut setOptions:@"componentId" options:dictFromJs completion:^{
84 84
 		XCTAssertTrue([vc.navigationItem.title isEqual:@"the title"]);
85 85
 		XCTAssertTrue([nav.navigationBar.barTintColor isEqual:expectedColor]);
86 86
 	}];

+ 18
- 18
lib/ios/ReactNativeNavigationTests/RNNControllerFactoryTest.m View File

@@ -33,33 +33,33 @@
33 33
 }
34 34
 
35 35
 
36
-- (void)testCreateLayout_ContainerLayout {
36
+- (void)testCreateLayout_ComponentLayout {
37 37
 	
38 38
 	id ans = [self.factory createLayoutAndSaveToStore:
39 39
 			  @{@"id": @"cntId",
40
-				@"type": @"Container",
40
+				@"type": @"Component",
41 41
 				@"data": @{},
42 42
 				@"children": @[]}];
43 43
 	XCTAssertTrue([ans isMemberOfClass:[RNNRootViewController class]]);
44 44
 }
45 45
 
46
-- (void)testCreateLayout_ContainerStackLayout {
46
+- (void)testCreateLayout_ComponentStackLayout {
47 47
 	id ans = [self.factory createLayoutAndSaveToStore:
48 48
 			  @{@"id": @"cntId",
49
-				@"type": @"ContainerStack",
49
+				@"type": @"Stack",
50 50
 				@"data": @{},
51 51
 				@"children": @[]}];
52 52
 	XCTAssertTrue([ans isMemberOfClass:[RNNNavigationController class]]);
53 53
 }
54 54
 
55
-- (void)testCreateLayout_ContainerStackLayoutRecursive {
55
+- (void)testCreateLayout_ComponentStackLayoutRecursive {
56 56
 	RNNNavigationController* ans = (RNNNavigationController*) [self.factory createLayoutAndSaveToStore:
57 57
 															 @{@"id": @"cntId",
58
-															   @"type": @"ContainerStack",
58
+															   @"type": @"Stack",
59 59
 															   @"data": @{},
60 60
 															   @"children": @[
61 61
 																	   @{@"id": @"cntId_2",
62
-																		 @"type": @"Container",
62
+																		 @"type": @"Component",
63 63
 																		 @"data": @{},
64 64
 																		 @"children": @[]}]}];
65 65
 	
@@ -76,11 +76,11 @@
76 76
 														  @"data": @{},
77 77
 														  @"children": @[
78 78
 																  @{@"id": @"cntId_2",
79
-																	@"type": @"ContainerStack",
79
+																	@"type": @"Stack",
80 80
 																	@"data": @{},
81 81
 																	@"children": @[
82 82
 																			@{@"id": @"cntId_3",
83
-																			  @"type": @"Container",
83
+																			  @"type": @"Component",
84 84
 																			  @"data": @{},
85 85
 																			  @"children": @[]}]}]}];
86 86
 	
@@ -96,7 +96,7 @@
96 96
 }
97 97
 
98 98
 
99
-- (void)testCreateLayout_ContainerSideMenuLayoutCenterLeftRight {
99
+- (void)testCreateLayout_ComponentSideMenuLayoutCenterLeftRight {
100 100
 	RNNSideMenuController *ans = (RNNSideMenuController*) [self.factory createLayoutAndSaveToStore:
101 101
 														   @{@"id": @"cntId",
102 102
 															 @"type": @"SideMenuRoot",
@@ -107,7 +107,7 @@
107 107
 																	   @"data": @{},
108 108
 																	   @"children": @[
109 109
 																			   @{@"id": @"cntId_3",
110
-																				 @"type": @"Container",
110
+																				 @"type": @"Component",
111 111
 																				 @"data": @{},
112 112
 																				 @"children": @[]}]},
113 113
 																	 @{@"id": @"cntI_4",
@@ -115,7 +115,7 @@
115 115
 																	   @"data": @{},
116 116
 																	   @"children": @[
117 117
 																			   @{@"id": @"cntId_5",
118
-																				 @"type": @"Container",
118
+																				 @"type": @"Component",
119 119
 																				 @"data": @{},
120 120
 																				 @"children": @[]}]},
121 121
 																	 @{@"id": @"cntI_6",
@@ -123,7 +123,7 @@
123 123
 																	   @"data": @{},
124 124
 																	   @"children": @[
125 125
 																			   @{@"id": @"cntId_7",
126
-																				 @"type": @"Container",
126
+																				 @"type": @"Component",
127 127
 																				 @"data": @{},
128 128
 																				 @"children": @[]}]}]}];
129 129
 	XCTAssertTrue([ans isMemberOfClass:[RNNSideMenuController class]]);
@@ -145,15 +145,15 @@
145 145
 
146 146
 
147 147
 
148
-- (void)testCreateLayout_addContainerToStore {
149
-	NSString *containerId = @"cntId";
148
+- (void)testCreateLayout_addComponentToStore {
149
+	NSString *componentId = @"cntId";
150 150
 	UIViewController *ans = [self.factory createLayoutAndSaveToStore:
151
-							 @{@"id": containerId,
152
-							   @"type": @"Container",
151
+							 @{@"id": componentId,
152
+							   @"type": @"Component",
153 153
 							   @"data": @{},
154 154
 							   @"children": @[]}];
155 155
 	
156
-	UIViewController *storeAns = [self.store findContainerForId:containerId];
156
+	UIViewController *storeAns = [self.store findComponentForId:componentId];
157 157
 	XCTAssertEqualObjects(ans, storeAns);
158 158
 }
159 159
 

+ 12
- 12
lib/ios/ReactNativeNavigationTests/RNNNavigationStackManagerTest.m View File

@@ -44,9 +44,9 @@
44 44
 	NSArray *vcArray = @[self.vc1, self.vc2, self.vc3];
45 45
 	[self.nvc setViewControllers:vcArray];
46 46
 	
47
-	[self.store setContainer:self.vc1 containerId:@"vc1"];
48
-	[self.store setContainer:self.vc2 containerId:@"vc2"];
49
-	[self.store setContainer:self.vc3 containerId:@"vc3"];
47
+	[self.store setComponent:self.vc1 componentId:@"vc1"];
48
+	[self.store setComponent:self.vc2 componentId:@"vc2"];
49
+	[self.store setComponent:self.vc3 componentId:@"vc3"];
50 50
 	
51 51
 	
52 52
 }
@@ -54,18 +54,18 @@
54 54
 
55 55
 - (void)testPop_removeTopVCFromStore {
56 56
 	[self.uut pop:@"vc3" withAnimationData:(NSDictionary*)nil];
57
-	XCTAssertNil([self.store findContainerForId:@"vc3"]);
58
-	XCTAssertNotNil([self.store findContainerForId:@"vc2"]);
59
-	XCTAssertNotNil([self.store findContainerForId:@"vc1"]);
57
+	XCTAssertNil([self.store findComponentForId:@"vc3"]);
58
+	XCTAssertNotNil([self.store findComponentForId:@"vc2"]);
59
+	XCTAssertNotNil([self.store findComponentForId:@"vc1"]);
60 60
 }
61 61
 
62 62
 - (void)testPopToSpecificVC_removeAllPopedVCFromStore {
63 63
 	self.nvc.willReturnVCs = @[self.vc2, self.vc3];
64 64
 	[self.uut popTo:@"vc1"];
65 65
 	
66
-	XCTAssertNil([self.store findContainerForId:@"vc2"]);
67
-	XCTAssertNil([self.store findContainerForId:@"vc3"]);
68
-	XCTAssertNotNil([self.store findContainerForId:@"vc1"]);
66
+	XCTAssertNil([self.store findComponentForId:@"vc2"]);
67
+	XCTAssertNil([self.store findComponentForId:@"vc3"]);
68
+	XCTAssertNotNil([self.store findComponentForId:@"vc1"]);
69 69
 	
70 70
 }
71 71
 
@@ -73,9 +73,9 @@
73 73
 	self.nvc.willReturnVCs = @[self.vc2, self.vc3];
74 74
 	[self.uut popToRoot:@"vc3"];
75 75
 	
76
-	XCTAssertNil([self.store findContainerForId:@"vc2"]);
77
-	XCTAssertNil([self.store findContainerForId:@"vc3"]);
78
-	XCTAssertNotNil([self.store findContainerForId:@"vc1"]);
76
+	XCTAssertNil([self.store findComponentForId:@"vc2"]);
77
+	XCTAssertNil([self.store findComponentForId:@"vc3"]);
78
+	XCTAssertNotNil([self.store findComponentForId:@"vc1"]);
79 79
 
80 80
 }
81 81
 

+ 3
- 3
lib/ios/ReactNativeNavigationTests/RNNRootViewControllerTest.m View File

@@ -12,7 +12,7 @@
12 12
 
13 13
 @property (nonatomic, strong) id<RNNRootViewCreator> creator;
14 14
 @property (nonatomic, strong) NSString* pageName;
15
-@property (nonatomic, strong) NSString* containerId;
15
+@property (nonatomic, strong) NSString* componentId;
16 16
 @property (nonatomic, strong) id emitter;
17 17
 @property (nonatomic, strong) RNNNavigationOptions* options;
18 18
 @property (nonatomic, strong) RNNRootViewController* uut;
@@ -24,10 +24,10 @@
24 24
 	[super setUp];
25 25
 	self.creator = [[RNNTestRootViewCreator alloc] init];
26 26
 	self.pageName = @"somename";
27
-	self.containerId = @"cntId";
27
+	self.componentId = @"cntId";
28 28
 	self.emitter = nil;
29 29
 	self.options = [RNNNavigationOptions new];
30
-	self.uut = [[RNNRootViewController alloc] initWithName:self.pageName withOptions:self.options withContainerId:self.containerId rootViewCreator:self.creator eventEmitter:self.emitter animator:nil];
30
+	self.uut = [[RNNRootViewController alloc] initWithName:self.pageName withOptions:self.options withComponentId:self.componentId rootViewCreator:self.creator eventEmitter:self.emitter animator:nil];
31 31
 }
32 32
 
33 33
 -(void)testTopBarBackgroundColor_validColor{

+ 31
- 31
lib/ios/ReactNativeNavigationTests/RNNStoreTest.m View File

@@ -17,86 +17,86 @@
17 17
 }
18 18
 
19 19
 
20
-- (void)testFindContainerForId_setAndGetsimpleContainerId {
21
-	NSString *containerId1 = @"cntId1";
22
-	NSString *containerId2 = @"cntId2";
20
+- (void)testFindComponentForId_setAndGetsimpleComponentId {
21
+	NSString *componentId1 = @"cntId1";
22
+	NSString *componentId2 = @"cntId2";
23 23
 	
24 24
 	UIViewController *vc1 = [UIViewController new];
25 25
 	UIViewController *vc2 = [UIViewController new];
26 26
 	
27
-	[self.store setContainer:vc1 containerId:containerId1];
28
-	[self.store setContainer:vc2 containerId:containerId2];
27
+	[self.store setComponent:vc1 componentId:componentId1];
28
+	[self.store setComponent:vc2 componentId:componentId2];
29 29
 	
30
-	UIViewController *ans = [self.store findContainerForId:containerId1];
30
+	UIViewController *ans = [self.store findComponentForId:componentId1];
31 31
 	
32 32
 	XCTAssertEqualObjects(vc1, ans);
33 33
 	XCTAssertNotEqualObjects(vc2, ans);
34 34
 }
35 35
 
36
-- (void)testSetContainer_setNilContainerId {
37
-	NSString *containerId1 = nil;
36
+- (void)testSetComponent_setNilComponentId {
37
+	NSString *componentId1 = nil;
38 38
 	UIViewController *vc1 = [UIViewController new];
39
-	[self.store setContainer:vc1 containerId:containerId1];
40
-	XCTAssertNil([self.store findContainerForId:containerId1]);
39
+	[self.store setComponent:vc1 componentId:componentId1];
40
+	XCTAssertNil([self.store findComponentForId:componentId1]);
41 41
 	
42 42
 }
43 43
 
44
-- (void)testSetContainer_setDoubleContainerId {
45
-	NSString *containerId1 = @"cntId1";
44
+- (void)testSetComponent_setDoubleComponentId {
45
+	NSString *componentId1 = @"cntId1";
46 46
 	
47 47
 	UIViewController *vc1 = [UIViewController new];
48 48
 	UIViewController *vc2 = [UIViewController new];
49 49
 	
50
-	[self.store setContainer:vc1 containerId:containerId1];
50
+	[self.store setComponent:vc1 componentId:componentId1];
51 51
 	
52
-	UIViewController *ans = [self.store findContainerForId:containerId1];
52
+	UIViewController *ans = [self.store findComponentForId:componentId1];
53 53
 	XCTAssertEqualObjects(vc1, ans);
54
-	XCTAssertThrows([self.store setContainer:vc2 containerId:containerId1]);
54
+	XCTAssertThrows([self.store setComponent:vc2 componentId:componentId1]);
55 55
 }
56 56
 
57
-- (void)testRemoveContainer_removeExistContainer {
58
-	NSString *containerId1 = @"cntId1";
57
+- (void)testRemoveComponent_removeExistComponent {
58
+	NSString *componentId1 = @"cntId1";
59 59
 	UIViewController *vc1 = [UIViewController new];
60 60
 	
61
-	[self.store setContainer:vc1 containerId:containerId1];
61
+	[self.store setComponent:vc1 componentId:componentId1];
62 62
 	
63
-	UIViewController *ans = [self.store findContainerForId:containerId1];
63
+	UIViewController *ans = [self.store findComponentForId:componentId1];
64 64
 	XCTAssertEqualObjects(vc1, ans);
65 65
 	
66
-	[self.store removeContainer:containerId1];
67
-	XCTAssertNil([self.store findContainerForId:containerId1]);
66
+	[self.store removeComponent:componentId1];
67
+	XCTAssertNil([self.store findComponentForId:componentId1]);
68 68
 }
69 69
 
70 70
 -(void)testPopWillRemoveVcFromStore {
71 71
 	NSString *vcId = @"cnt_vc_2";
72 72
 	
73
-	[self setContainerAndRelease:vcId];
73
+	[self setComponentAndRelease:vcId];
74 74
 	
75 75
 	
76
-	XCTAssertNil([self.store findContainerForId:vcId]);
76
+	XCTAssertNil([self.store findComponentForId:vcId]);
77 77
 }
78 78
 
79 79
 
80
--(void)testRemoveContainerByInstance {
81
-	NSString *containerId1 = @"cntId1";
80
+-(void)testRemoveComponentByInstance {
81
+	NSString *componentId1 = @"cntId1";
82 82
 	UIViewController *vc1 = [UIViewController new];
83 83
 	
84
-	[self.store setContainer:vc1 containerId:containerId1];
85
-	[self.store removeContainerByViewControllerInstance:vc1];
84
+	[self.store setComponent:vc1 componentId:componentId1];
85
+	[self.store removeComponentByViewControllerInstance:vc1];
86 86
 	
87
-	XCTAssertNil([self.store findContainerForId:@"cntId1"]);
87
+	XCTAssertNil([self.store findComponentForId:@"cntId1"]);
88 88
 }
89 89
 
90 90
 
91 91
 #pragma mark - private
92 92
 
93 93
 
94
--(void)setContainerAndRelease:(NSString*)vcId {
94
+-(void)setComponentAndRelease:(NSString*)vcId {
95 95
 	@autoreleasepool {
96 96
 		UIViewController *vc2 = [UIViewController new];
97
-		[self.store setContainer:vc2 containerId:vcId];
97
+		[self.store setComponent:vc2 componentId:vcId];
98 98
 		
99
-		XCTAssertNotNil([self.store findContainerForId:vcId]);
99
+		XCTAssertNotNil([self.store findComponentForId:vcId]);
100 100
 	}
101 101
 }
102 102
 

+ 36
- 39
lib/src/Navigation.js View File

@@ -1,17 +1,14 @@
1 1
 const NativeCommandsSender = require('./adapters/NativeCommandsSender');
2 2
 const NativeEventsReceiver = require('./adapters/NativeEventsReceiver');
3 3
 const UniqueIdProvider = require('./adapters/UniqueIdProvider');
4
-const Store = require('./containers/Store');
5
-const ContainerRegistry = require('./containers/ContainerRegistry');
4
+const Store = require('./components/Store');
5
+const ComponentRegistry = require('./components/ComponentRegistry');
6 6
 const Commands = require('./commands/Commands');
7 7
 const LayoutTreeParser = require('./commands/LayoutTreeParser');
8 8
 const LayoutTreeCrawler = require('./commands/LayoutTreeCrawler');
9 9
 const PrivateEventsListener = require('./events/PrivateEventsListener');
10 10
 const PublicEventsRegistry = require('./events/PublicEventsRegistry');
11 11
 const Element = require('./adapters/Element');
12
-const Root = require('./params/containers/Root');
13
-const Container = require('./params/containers/Container');
14
-const NavigationOptions = require('./params/options/NavigationOptions');
15 12
 
16 13
 /** @constructor */
17 14
 class Navigation {
@@ -19,7 +16,7 @@ class Navigation {
19 16
     this.store = new Store();
20 17
     this.nativeEventsReceiver = new NativeEventsReceiver();
21 18
     this.uniqueIdProvider = new UniqueIdProvider();
22
-    this.containerRegistry = new ContainerRegistry(this.store);
19
+    this.componentRegistry = new ComponentRegistry(this.store);
23 20
     this.layoutTreeParser = new LayoutTreeParser();
24 21
     this.layoutTreeCrawler = new LayoutTreeCrawler(this.uniqueIdProvider, this.store);
25 22
     this.nativeCommandsSender = new NativeCommandsSender();
@@ -31,37 +28,37 @@ class Navigation {
31 28
   }
32 29
 
33 30
   /**
34
-   * Every screen component in your app must be registered with a unique name. The component itself is a traditional React component extending React.Component.
35
-   * @param {string} containerName Unique container name
36
-   * @param {function} getContainerFunc generator function, typically `() => require('./myContainer')`
31
+   * Every navigation component in your app must be registered with a unique name. The component itself is a traditional React component extending React.Component.
32
+   * @param {string} componentName Unique component name
33
+   * @param {function} getComponentClassFunc generator function, typically `() => require('./myComponent')`
37 34
    */
38
-  registerContainer(containerName, getContainerFunc) {
39
-    this.containerRegistry.registerContainer(containerName, getContainerFunc);
35
+  registerComponent(componentName, getComponentClassFunc) {
36
+    this.componentRegistry.registerComponent(componentName, getComponentClassFunc);
40 37
   }
41 38
 
42 39
   /**
43
-   * Reset the navigation stack to a new screen (the stack root is changed).
40
+   * Reset the navigation stack to a new component (the stack root is changed).
44 41
    * @param {Root} root
45 42
    */
46 43
   setRoot(params) {
47
-    return this.commands.setRoot(new Root(params));
44
+    return this.commands.setRoot(params);
48 45
   }
49 46
 
50 47
   /**
51 48
    * Set default options to all screens. Useful for declaring a consistent style across the app.
52
-   * @param {options:NavigationOptions} options
49
+   * @param {options:Options} options
53 50
    */
54 51
   setDefaultOptions(options) {
55 52
     this.commands.setDefaultOptions(options);
56 53
   }
57 54
 
58 55
   /**
59
-   * Change a containers navigation options
60
-   * @param {string} containerId The container's id.
61
-   * @param {options:NavigationOptions} options
56
+   * Change a components navigation options
57
+   * @param {string} componentId The component's id.
58
+   * @param {options:Options} options
62 59
    */
63
-  setOptions(containerId, options) {
64
-    this.commands.setOptions(containerId, new NavigationOptions(options));
60
+  setOptions(componentId, options) {
61
+    this.commands.setOptions(componentId, options);
65 62
   }
66 63
 
67 64
   /**
@@ -73,11 +70,11 @@ class Navigation {
73 70
   }
74 71
 
75 72
   /**
76
-   * Dismiss a modal by containerId. The dismissed modal can be anywhere in the stack.
77
-   * @param {string} containerId The container's id.
73
+   * Dismiss a modal by componentId. The dismissed modal can be anywhere in the stack.
74
+   * @param {string} componentId The component's id.
78 75
    */
79
-  dismissModal(containerId) {
80
-    return this.commands.dismissModal(containerId);
76
+  dismissModal(componentId) {
77
+    return this.commands.dismissModal(componentId);
81 78
   }
82 79
 
83 80
   /**
@@ -89,36 +86,36 @@ class Navigation {
89 86
 
90 87
   /**
91 88
    * Push a new screen into this screen's navigation stack.
92
-   * @param {string} containerId The container's id.
93
-   * @param {Container} container
89
+   * @param {string} componentId The component's id.
90
+   * @param {Component} component
94 91
    */
95
-  push(containerId, container) {
96
-    return this.commands.push(containerId, new Container(container));
92
+  push(componentId, component) {
93
+    return this.commands.push(componentId, component);
97 94
   }
98 95
 
99 96
   /**
100
-   * Pop a container from the stack, regardless of it's position.
101
-   * @param {string} containerId The container's id.
97
+   * Pop a component from the stack, regardless of it's position.
98
+   * @param {string} componentId The component's id.
102 99
    * @param {*} params
103 100
    */
104
-  pop(containerId, params) {
105
-    return this.commands.pop(containerId, params);
101
+  pop(componentId, params) {
102
+    return this.commands.pop(componentId, params);
106 103
   }
107 104
 
108 105
   /**
109
-   * Pop the stack to a given container
110
-   * @param {string} containerId The container's id.
106
+   * Pop the stack to a given component
107
+   * @param {string} componentId The component's id.
111 108
    */
112
-  popTo(containerId) {
113
-    return this.commands.popTo(containerId);
109
+  popTo(componentId) {
110
+    return this.commands.popTo(componentId);
114 111
   }
115 112
 
116 113
   /**
117
-   * Pop the container's stack to root.
118
-   * @param {*} containerId
114
+   * Pop the component's stack to root.
115
+   * @param {*} componentId
119 116
    */
120
-  popToRoot(containerId) {
121
-    return this.commands.popToRoot(containerId);
117
+  popToRoot(componentId) {
118
+    return this.commands.popToRoot(componentId);
122 119
   }
123 120
 
124 121
   /**

+ 13
- 13
lib/src/adapters/NativeCommandsSender.js View File

@@ -13,25 +13,25 @@ class NativeCommandsSender {
13 13
     this.nativeCommandsModule.setDefaultOptions(options);
14 14
   }
15 15
 
16
-  setOptions(containerId, options) {
17
-    this.nativeCommandsModule.setOptions(containerId, options);
16
+  setOptions(componentId, options) {
17
+    this.nativeCommandsModule.setOptions(componentId, options);
18 18
   }
19 19
 
20
-  async push(onContainerId, layout) {
21
-    const pushedContainerId = await this.nativeCommandsModule.push(onContainerId, layout);
22
-    return pushedContainerId;
20
+  async push(onComponentId, layout) {
21
+    const pushedComponentId = await this.nativeCommandsModule.push(onComponentId, layout);
22
+    return pushedComponentId;
23 23
   }
24 24
 
25
-  pop(containerId, options) {
26
-    return this.nativeCommandsModule.pop(containerId, options);
25
+  pop(componentId, options) {
26
+    return this.nativeCommandsModule.pop(componentId, options);
27 27
   }
28 28
 
29
-  popTo(containerId) {
30
-    return this.nativeCommandsModule.popTo(containerId);
29
+  popTo(componentId) {
30
+    return this.nativeCommandsModule.popTo(componentId);
31 31
   }
32 32
 
33
-  popToRoot(containerId) {
34
-    return this.nativeCommandsModule.popToRoot(containerId);
33
+  popToRoot(componentId) {
34
+    return this.nativeCommandsModule.popToRoot(componentId);
35 35
   }
36 36
 
37 37
   async showModal(layout) {
@@ -39,8 +39,8 @@ class NativeCommandsSender {
39 39
     return completed;
40 40
   }
41 41
 
42
-  dismissModal(containerId) {
43
-    return this.nativeCommandsModule.dismissModal(containerId);
42
+  dismissModal(componentId) {
43
+    return this.nativeCommandsModule.dismissModal(componentId);
44 44
   }
45 45
 
46 46
   dismissAllModals() {

+ 6
- 6
lib/src/adapters/NativeEventsReceiver.js View File

@@ -5,19 +5,19 @@ class NativeEventsReceiver {
5 5
     this.emitter = new NativeEventEmitter(NativeModules.RNNEventEmitter);
6 6
   }
7 7
 
8
-  containerDidAppear(callback) {
9
-    this.emitter.addListener('RNN.containerDidAppear', callback);
8
+  registerComponentDidAppear(callback) {
9
+    this.emitter.addListener('RNN.componentDidAppear', callback);
10 10
   }
11 11
 
12
-  containerDidDisappear(callback) {
13
-    this.emitter.addListener('RNN.containerDidDisappear', callback);
12
+  registerComponentDidDisappear(callback) {
13
+    this.emitter.addListener('RNN.componentDidDisappear', callback);
14 14
   }
15 15
 
16
-  appLaunched(callback) {
16
+  registerAppLaunched(callback) {
17 17
     this.emitter.addListener('RNN.appLaunched', callback);
18 18
   }
19 19
 
20
-  navigationButtonPressed(callback) {
20
+  registerNavigationButtonPressed(callback) {
21 21
     this.emitter.addListener('RNN.navigationButtonPressed', callback);
22 22
   }
23 23
 }

+ 27
- 27
lib/src/commands/Commands.js View File

@@ -10,7 +10,7 @@ class Commands {
10 10
 
11 11
   setRoot(simpleApi) {
12 12
     const input = _.cloneDeep(simpleApi);
13
-    const layout = this.layoutTreeParser.parseFromSimpleJSON(input);
13
+    const layout = this.layoutTreeParser.parse(input);
14 14
     this.layoutTreeCrawler.crawl(layout);
15 15
     return this.nativeCommandsSender.setRoot(layout);
16 16
   }
@@ -21,15 +21,15 @@ class Commands {
21 21
     this.nativeCommandsSender.setDefaultOptions(input);
22 22
   }
23 23
 
24
-  setOptions(containerId, options) {
24
+  setOptions(componentId, options) {
25 25
     const input = _.cloneDeep(options);
26 26
     OptionsProcessor.processOptions(input);
27
-    this.nativeCommandsSender.setOptions(containerId, input);
27
+    this.nativeCommandsSender.setOptions(componentId, input);
28 28
   }
29 29
 
30 30
   showModal(simpleApi) {
31 31
     const input = _.cloneDeep(simpleApi);
32
-    const layout = this.layoutTreeParser.parseFromSimpleJSON(input);
32
+    const layout = this.layoutTreeParser.parse(input);
33 33
     this.layoutTreeCrawler.crawl(layout);
34 34
     return this.nativeCommandsSender.showModal(layout);
35 35
   }
@@ -42,39 +42,39 @@ class Commands {
42 42
     return this.nativeCommandsSender.dismissAllModals();
43 43
   }
44 44
 
45
-  push(onContainerId, containerData) {
46
-    const input = _.cloneDeep(containerData);
45
+  push(onComponentId, componentData) {
46
+    const input = _.cloneDeep(componentData);
47 47
     OptionsProcessor.processOptions(input);
48
-    const layout = this.layoutTreeParser.parseFromSimpleJSON(input);
48
+    const layout = this.layoutTreeParser.parse(input);
49 49
     this.layoutTreeCrawler.crawl(layout);
50
-    return this.nativeCommandsSender.push(onContainerId, layout);
50
+    return this.nativeCommandsSender.push(onComponentId, layout);
51 51
   }
52 52
 
53
-  pop(containerId, options) {
54
-    return this.nativeCommandsSender.pop(containerId, options);
53
+  pop(componentId, options) {
54
+    return this.nativeCommandsSender.pop(componentId, options);
55 55
   }
56 56
 
57
-  popTo(containerId) {
58
-    return this.nativeCommandsSender.popTo(containerId);
57
+  popTo(componentId) {
58
+    return this.nativeCommandsSender.popTo(componentId);
59 59
   }
60 60
 
61
-  popToRoot(containerId) {
62
-    return this.nativeCommandsSender.popToRoot(containerId);
61
+  popToRoot(componentId) {
62
+    return this.nativeCommandsSender.popToRoot(componentId);
63 63
   }
64 64
 
65
-  showOverlay(type, options) {
66
-    let promise;
67
-    if (type === 'custom') {
68
-      const layout = this.layoutTreeParser.createDialogContainer({ name: options });
69
-      this.layoutTreeCrawler.crawl(layout);
70
-      promise = this.nativeCommandsSender.showOverlay(type, layout);
71
-    } else {
72
-      const input = _.cloneDeep(options);
73
-      OptionsProcessor.processOptions(input);
74
-      promise = this.nativeCommandsSender.showOverlay(type, input);
75
-    }
76
-    return promise;
77
-  }
65
+  // showOverlay(type, options) {
66
+    // let promise;
67
+    // if (type === 'custom') {
68
+    //   const layout = this.layoutTreeParser.createDialogComponent({ name: options });
69
+    //   this.layoutTreeCrawler.crawl(layout);
70
+    //   promise = this.nativeCommandsSender.showOverlay(type, layout);
71
+    // } else {
72
+    //   const input = _.cloneDeep(options);
73
+    //   OptionsProcessor.processOptions(input);
74
+    //   promise = this.nativeCommandsSender.showOverlay(type, input);
75
+    // }
76
+    // return promise;
77
+  // }
78 78
 
79 79
   dismissOverlay() {
80 80
     return this.nativeCommandsSender.dismissOverlay();

+ 75
- 80
lib/src/commands/Commands.test.js View File

@@ -1,7 +1,6 @@
1
-const SimpleLayouts = require('./SimpleLayouts');
2 1
 const LayoutTreeParser = require('./LayoutTreeParser');
3 2
 const LayoutTreeCrawler = require('./LayoutTreeCrawler');
4
-const Store = require('../containers/Store');
3
+const Store = require('../components/Store');
5 4
 const UniqueIdProvider = require('../adapters/UniqueIdProvider.mock');
6 5
 const NativeCommandsSender = require('../adapters/NativeCommandsSender.mock');
7 6
 const Commands = require('./Commands');
@@ -21,44 +20,41 @@ describe('Commands', () => {
21 20
   describe('setRoot', () => {
22 21
     it('sends setRoot to native after parsing into a correct layout tree', () => {
23 22
       uut.setRoot({
24
-        container: {
23
+        component: {
25 24
           name: 'com.example.MyScreen'
26 25
         }
27 26
       });
28 27
       expect(mockCommandsSender.setRoot).toHaveBeenCalledTimes(1);
29 28
       expect(mockCommandsSender.setRoot).toHaveBeenCalledWith({
30
-        type: 'ContainerStack',
31
-        id: 'ContainerStack+UNIQUE_ID',
32
-        data: {},
33
-        children: [
34
-          {
35
-            type: 'Container',
36
-            id: 'Container+UNIQUE_ID',
37
-            children: [],
38
-            data: {
39
-              name: 'com.example.MyScreen',
40
-              navigationOptions: {}
41
-            }
42
-          }
43
-        ]
29
+        type: 'Component',
30
+        id: 'Component+UNIQUE_ID',
31
+        children: [],
32
+        data: {
33
+          name: 'com.example.MyScreen',
34
+          options: {}
35
+        }
44 36
       });
45 37
     });
46 38
 
47 39
     it('deep clones input to avoid mutation errors', () => {
48 40
       const obj = {};
49
-      uut.setRoot({ container: { name: 'bla', inner: obj } });
50
-      expect(mockCommandsSender.setRoot.mock.calls[0][0].children[0].data.inner).not.toBe(obj);
41
+      uut.setRoot({ component: { name: 'bla', inner: obj } });
42
+      expect(mockCommandsSender.setRoot.mock.calls[0][0].data.inner).not.toBe(obj);
51 43
     });
52 44
 
53
-    it('passProps into containers', () => {
54
-      expect(store.getPropsForContainerId('Container+UNIQUE_ID')).toEqual({});
55
-      uut.setRoot(SimpleLayouts.singleScreenWithAditionalParams);
56
-      expect(store.getPropsForContainerId('Container+UNIQUE_ID')).toEqual(SimpleLayouts.passProps);
45
+    it('passProps into components', () => {
46
+      const passProps = {
47
+        fn: () => 'Hello'
48
+      };
49
+      expect(store.getPropsForComponentId('Component+UNIQUE_ID')).toEqual({});
50
+      uut.setRoot({ component: { name: 'asd', passProps } });
51
+      expect(store.getPropsForComponentId('Component+UNIQUE_ID')).toEqual(passProps);
52
+      expect(store.getPropsForComponentId('Component+UNIQUE_ID').fn()).toEqual('Hello');
57 53
     });
58 54
 
59 55
     it('returns a promise with the resolved layout', async () => {
60 56
       mockCommandsSender.setRoot.mockReturnValue(Promise.resolve('the resolved layout'));
61
-      const result = await uut.setRoot({ container: { name: 'com.example.MyScreen' } });
57
+      const result = await uut.setRoot({ component: { name: 'com.example.MyScreen' } });
62 58
       expect(result).toEqual('the resolved layout');
63 59
     });
64 60
   });
@@ -66,14 +62,14 @@ describe('Commands', () => {
66 62
   describe('setOptions', () => {
67 63
     it('deep clones input to avoid mutation errors', () => {
68 64
       const obj = { title: 'test' };
69
-      uut.setOptions('theContainerId', obj);
65
+      uut.setOptions('theComponentId', obj);
70 66
       expect(mockCommandsSender.setOptions.mock.calls[0][1]).not.toBe(obj);
71 67
     });
72 68
 
73
-    it('passes options for container', () => {
74
-      uut.setOptions('theContainerId', { title: '1' });
69
+    it('passes options for component', () => {
70
+      uut.setOptions('theComponentId', { title: '1' });
75 71
       expect(mockCommandsSender.setOptions).toHaveBeenCalledTimes(1);
76
-      expect(mockCommandsSender.setOptions).toHaveBeenCalledWith('theContainerId', { title: '1' });
72
+      expect(mockCommandsSender.setOptions).toHaveBeenCalledWith('theComponentId', { title: '1' });
77 73
     });
78 74
   });
79 75
 
@@ -88,47 +84,45 @@ describe('Commands', () => {
88 84
   describe('showModal', () => {
89 85
     it('sends command to native after parsing into a correct layout tree', () => {
90 86
       uut.showModal({
91
-        container: {
87
+        component: {
92 88
           name: 'com.example.MyScreen'
93 89
         }
94 90
       });
95 91
       expect(mockCommandsSender.showModal).toHaveBeenCalledTimes(1);
96 92
       expect(mockCommandsSender.showModal).toHaveBeenCalledWith({
97
-        type: 'ContainerStack',
98
-        id: 'ContainerStack+UNIQUE_ID',
99
-        data: {},
100
-        children: [{
101
-          type: 'Container',
102
-          id: 'Container+UNIQUE_ID',
103
-          data: {
104
-            name: 'com.example.MyScreen',
105
-            navigationOptions: {}
106
-          },
107
-          children: []
108
-        }]
93
+        type: 'Component',
94
+        id: 'Component+UNIQUE_ID',
95
+        data: {
96
+          name: 'com.example.MyScreen',
97
+          options: {}
98
+        },
99
+        children: []
109 100
       });
110 101
     });
111 102
 
112 103
     it('deep clones input to avoid mutation errors', () => {
113 104
       const obj = {};
114
-      uut.showModal({ container: { name: 'name', inner: obj } });
105
+      uut.showModal({ component: { name: 'name', inner: obj } });
115 106
       expect(mockCommandsSender.showModal.mock.calls[0][0].data.inner).not.toBe(obj);
116 107
     });
117 108
 
118
-    it('passProps into containers', () => {
119
-      expect(store.getPropsForContainerId('Container+UNIQUE_ID')).toEqual({});
109
+    it('passProps into components', () => {
110
+      const passProps = {
111
+        fn: () => 'hello'
112
+      };
113
+      expect(store.getPropsForComponentId('Component+UNIQUE_ID')).toEqual({});
120 114
       uut.showModal({
121
-        container: {
115
+        component: {
122 116
           name: 'com.example.MyScreen',
123
-          passProps: SimpleLayouts.passProps
117
+          passProps
124 118
         }
125 119
       });
126
-      expect(store.getPropsForContainerId('Container+UNIQUE_ID')).toEqual(SimpleLayouts.passProps);
120
+      expect(store.getPropsForComponentId('Component+UNIQUE_ID')).toEqual(passProps);
127 121
     });
128 122
 
129 123
     it('returns a promise with the resolved layout', async () => {
130 124
       mockCommandsSender.showModal.mockReturnValue(Promise.resolve('the resolved layout'));
131
-      const result = await uut.showModal({ container: { name: 'com.example.MyScreen' } });
125
+      const result = await uut.showModal({ component: { name: 'com.example.MyScreen' } });
132 126
       expect(result).toEqual('the resolved layout');
133 127
     });
134 128
   });
@@ -164,25 +158,25 @@ describe('Commands', () => {
164 158
   describe('push', () => {
165 159
     it('deep clones input to avoid mutation errors', () => {
166 160
       const obj = {};
167
-      uut.push('theContainerId', { name: 'name', inner: { foo: obj } });
168
-      expect(mockCommandsSender.push.mock.calls[0][1].data.inner.foo).not.toBe(obj);
161
+      uut.push('theComponentId', { component: { name: 'name', passProps: { foo: obj } } });
162
+      expect(mockCommandsSender.push.mock.calls[0][1].data.passProps.foo).not.toBe(obj);
169 163
     });
170 164
 
171 165
     it('resolves with the parsed layout', async () => {
172 166
       mockCommandsSender.push.mockReturnValue(Promise.resolve('the resolved layout'));
173
-      const result = await uut.push('theContainerId', { name: 'com.example.MyScreen' });
167
+      const result = await uut.push('theComponentId', { component: { name: 'com.example.MyScreen' } });
174 168
       expect(result).toEqual('the resolved layout');
175 169
     });
176 170
 
177 171
     it('parses into correct layout node and sends to native', () => {
178
-      uut.push('theContainerId', { name: 'com.example.MyScreen' });
172
+      uut.push('theComponentId', { component: { name: 'com.example.MyScreen' } });
179 173
       expect(mockCommandsSender.push).toHaveBeenCalledTimes(1);
180
-      expect(mockCommandsSender.push).toHaveBeenCalledWith('theContainerId', {
181
-        type: 'Container',
182
-        id: 'Container+UNIQUE_ID',
174
+      expect(mockCommandsSender.push).toHaveBeenCalledWith('theComponentId', {
175
+        type: 'Component',
176
+        id: 'Component+UNIQUE_ID',
183 177
         data: {
184 178
           name: 'com.example.MyScreen',
185
-          navigationOptions: {}
179
+          options: {}
186 180
         },
187 181
         children: []
188 182
       });
@@ -190,60 +184,61 @@ describe('Commands', () => {
190 184
   });
191 185
 
192 186
   describe('pop', () => {
193
-    it('pops a container, passing containerId', () => {
194
-      uut.pop('theContainerId');
187
+    it('pops a component, passing componentId', () => {
188
+      uut.pop('theComponentId');
195 189
       expect(mockCommandsSender.pop).toHaveBeenCalledTimes(1);
196
-      expect(mockCommandsSender.pop).toHaveBeenCalledWith('theContainerId', undefined);
190
+      expect(mockCommandsSender.pop).toHaveBeenCalledWith('theComponentId', undefined);
197 191
     });
198
-    it('pops a container, passing containerId and options', () => {
192
+    it('pops a component, passing componentId and options', () => {
199 193
       const options = {
200 194
         customTransition: {
201 195
           animations: [
202 196
             { type: 'sharedElement', fromId: 'title2', toId: 'title1', startDelay: 0, springVelocity: 0.2, duration: 0.5 }
203 197
           ],
204 198
           duration: 0.8
205
-        } };
206
-      uut.pop('theContainerId', options);
199
+        }
200
+      };
201
+      uut.pop('theComponentId', options);
207 202
       expect(mockCommandsSender.pop).toHaveBeenCalledTimes(1);
208
-      expect(mockCommandsSender.pop).toHaveBeenCalledWith('theContainerId', options);
203
+      expect(mockCommandsSender.pop).toHaveBeenCalledWith('theComponentId', options);
209 204
     });
210 205
 
211
-    it('pop returns a promise that resolves to containerId', async () => {
212
-      mockCommandsSender.pop.mockReturnValue(Promise.resolve('theContainerId'));
213
-      const result = await uut.pop('theContainerId');
214
-      expect(result).toEqual('theContainerId');
206
+    it('pop returns a promise that resolves to componentId', async () => {
207
+      mockCommandsSender.pop.mockReturnValue(Promise.resolve('theComponentId'));
208
+      const result = await uut.pop('theComponentId');
209
+      expect(result).toEqual('theComponentId');
215 210
     });
216 211
   });
217 212
 
218 213
   describe('popTo', () => {
219
-    it('pops all containers until the passed Id is top', () => {
220
-      uut.popTo('theContainerId');
214
+    it('pops all components until the passed Id is top', () => {
215
+      uut.popTo('theComponentId');
221 216
       expect(mockCommandsSender.popTo).toHaveBeenCalledTimes(1);
222
-      expect(mockCommandsSender.popTo).toHaveBeenCalledWith('theContainerId');
217
+      expect(mockCommandsSender.popTo).toHaveBeenCalledWith('theComponentId');
223 218
     });
224 219
 
225 220
     it('returns a promise that resolves to targetId', async () => {
226
-      mockCommandsSender.popTo.mockReturnValue(Promise.resolve('theContainerId'));
227
-      const result = await uut.popTo('theContainerId');
228
-      expect(result).toEqual('theContainerId');
221
+      mockCommandsSender.popTo.mockReturnValue(Promise.resolve('theComponentId'));
222
+      const result = await uut.popTo('theComponentId');
223
+      expect(result).toEqual('theComponentId');
229 224
     });
230 225
   });
231 226
 
232 227
   describe('popToRoot', () => {
233
-    it('pops all containers to root', () => {
234
-      uut.popToRoot('theContainerId');
228
+    it('pops all components to root', () => {
229
+      uut.popToRoot('theComponentId');
235 230
       expect(mockCommandsSender.popToRoot).toHaveBeenCalledTimes(1);
236
-      expect(mockCommandsSender.popToRoot).toHaveBeenCalledWith('theContainerId');
231
+      expect(mockCommandsSender.popToRoot).toHaveBeenCalledWith('theComponentId');
237 232
     });
238 233
 
239 234
     it('returns a promise that resolves to targetId', async () => {
240
-      mockCommandsSender.popToRoot.mockReturnValue(Promise.resolve('theContainerId'));
241
-      const result = await uut.popToRoot('theContainerId');
242
-      expect(result).toEqual('theContainerId');
235
+      mockCommandsSender.popToRoot.mockReturnValue(Promise.resolve('theComponentId'));
236
+      const result = await uut.popToRoot('theComponentId');
237
+      expect(result).toEqual('theComponentId');
243 238
     });
244 239
   });
245 240
 
246
-  describe('showOverlay', () => {
241
+  xdescribe('showOverlay', () => {
247 242
     it('deep clones input to avoid mutation errors', () => {
248 243
       const obj = { title: 'test' };
249 244
       uut.showOverlay('alert', obj);

+ 125
- 0
lib/src/commands/LayoutExamples.js View File

@@ -0,0 +1,125 @@
1
+const passProps = {
2
+  strProp: 'string prop',
3
+  numProp: 12345,
4
+  objProp: { inner: { foo: 'bar' } },
5
+  fnProp: () => 'Hello from a function'
6
+};
7
+
8
+const options = {
9
+  topBar: {
10
+    title: 'Hello1'
11
+  }
12
+};
13
+
14
+const singleComponent = {
15
+  component: {
16
+    name: 'MyReactComponent',
17
+    options,
18
+    passProps
19
+  }
20
+};
21
+
22
+const stackWithTopBar = {
23
+  stack: {
24
+    children: [
25
+      {
26
+        component: {
27
+          name: 'MyReactComponent1'
28
+        }
29
+      },
30
+      {
31
+        component: {
32
+          name: 'MyReactComponent2',
33
+          options
34
+        }
35
+      }
36
+    ],
37
+    options
38
+  }
39
+};
40
+
41
+const bottomTabs = {
42
+  bottomTabs: {
43
+    children: [
44
+      stackWithTopBar,
45
+      stackWithTopBar,
46
+      {
47
+        component: {
48
+          name: 'MyReactComponent1'
49
+        }
50
+      }
51
+    ]
52
+  }
53
+};
54
+
55
+const sideMenu = {
56
+  sideMenu: {
57
+    left: singleComponent,
58
+    center: stackWithTopBar,
59
+    right: singleComponent
60
+  }
61
+};
62
+
63
+const topTabs = {
64
+  topTabs: {
65
+    children: [
66
+      singleComponent,
67
+      singleComponent,
68
+      singleComponent,
69
+      singleComponent,
70
+      stackWithTopBar
71
+    ],
72
+    options
73
+  }
74
+};
75
+
76
+const complexLayout = {
77
+  sideMenu: {
78
+    left: singleComponent,
79
+    center: {
80
+      bottomTabs: {
81
+        children: [
82
+          stackWithTopBar,
83
+          stackWithTopBar,
84
+          {
85
+            stack: {
86
+              children: [
87
+                {
88
+                  topTabs: {
89
+                    children: [
90
+                      stackWithTopBar,
91
+                      stackWithTopBar,
92
+                      {
93
+                        topTabs: {
94
+                          options,
95
+                          children: [
96
+                            singleComponent,
97
+                            singleComponent,
98
+                            singleComponent,
99
+                            singleComponent,
100
+                            stackWithTopBar
101
+                          ]
102
+                        }
103
+                      }
104
+                    ]
105
+                  }
106
+                }
107
+              ]
108
+            }
109
+          }
110
+        ]
111
+      }
112
+    }
113
+  }
114
+};
115
+
116
+module.exports = {
117
+  passProps,
118
+  options,
119
+  singleComponent,
120
+  stackWithTopBar,
121
+  bottomTabs,
122
+  sideMenu,
123
+  topTabs,
124
+  complexLayout
125
+};

+ 15
- 15
lib/src/commands/LayoutTreeCrawler.js View File

@@ -14,28 +14,28 @@ class LayoutTreeCrawler {
14 14
     node.id = this.uniqueIdProvider.generate(node.type);
15 15
     node.data = node.data || {};
16 16
     node.children = node.children || [];
17
-    if ([LayoutTypes.Container, LayoutTypes.TopTab].includes(node.type)) {
18
-      this._handleContainer(node);
17
+    if (_.isEqual(node.type, LayoutTypes.Component)) {
18
+      this._handleComponent(node);
19 19
     }
20 20
     _.forEach(node.children, this.crawl);
21 21
   }
22 22
 
23
-  _handleContainer(node) {
24
-    this._assertContainerDataName(node);
23
+  _handleComponent(node) {
24
+    this._assertComponentDataName(node);
25 25
     this._savePropsToStore(node);
26
-    this._applyStaticNavigationOptions(node);
27
-    OptionsProcessor.processOptions(node.data.navigationOptions);
26
+    this._applyStaticOptions(node);
27
+    OptionsProcessor.processOptions(node.data.options);
28 28
   }
29 29
 
30 30
   _savePropsToStore(node) {
31
-    this.store.setPropsForContainerId(node.id, node.data.passProps);
31
+    this.store.setPropsForComponentId(node.id, node.data.passProps);
32 32
   }
33 33
 
34
-  _applyStaticNavigationOptions(node) {
35
-    const clazz = this.store.getOriginalContainerClassForName(node.data.name) || {};
36
-    const staticOptions = _.cloneDeep(clazz.navigationOptions) || {};
37
-    const passedOptions = _.cloneDeep(node.data.navigationOptions) || {};
38
-    node.data.navigationOptions = _.merge({}, staticOptions, passedOptions);
34
+  _applyStaticOptions(node) {
35
+    const clazz = this.store.getOriginalComponentClassForName(node.data.name) || {};
36
+    const staticOptions = _.cloneDeep(clazz.options) || {};
37
+    const passedOptions = node.data.options || {};
38
+    node.data.options = _.merge({}, staticOptions, passedOptions);
39 39
   }
40 40
 
41 41
   _assertKnownLayoutType(type) {
@@ -44,9 +44,9 @@ class LayoutTreeCrawler {
44 44
     }
45 45
   }
46 46
 
47
-  _assertContainerDataName(container) {
48
-    if (!container.data.name) {
49
-      throw new Error('Missing container data.name');
47
+  _assertComponentDataName(component) {
48
+    if (!component.data.name) {
49
+      throw new Error('Missing component data.name');
50 50
     }
51 51
   }
52 52
 }

+ 67
- 67
lib/src/commands/LayoutTreeCrawler.test.js View File

@@ -1,6 +1,6 @@
1 1
 const LayoutTypes = require('./LayoutTypes');
2 2
 const LayoutTreeCrawler = require('./LayoutTreeCrawler');
3
-const Store = require('../containers/Store');
3
+const Store = require('../components/Store');
4 4
 const UniqueIdProvider = require('../adapters/UniqueIdProvider.mock');
5 5
 
6 6
 describe('LayoutTreeCrawler', () => {
@@ -13,55 +13,55 @@ describe('LayoutTreeCrawler', () => {
13 13
   });
14 14
 
15 15
   it('crawls a layout tree and adds unique id to each node', () => {
16
-    const node = { type: LayoutTypes.ContainerStack, children: [{ type: LayoutTypes.BottomTabs }] };
16
+    const node = { type: LayoutTypes.Stack, children: [{ type: LayoutTypes.BottomTabs }] };
17 17
     uut.crawl(node);
18
-    expect(node.id).toEqual('ContainerStack+UNIQUE_ID');
18
+    expect(node.id).toEqual('Stack+UNIQUE_ID');
19 19
     expect(node.children[0].id).toEqual('BottomTabs+UNIQUE_ID');
20 20
   });
21 21
 
22 22
   it('crawls a layout tree and ensures data exists', () => {
23
-    const node = { type: LayoutTypes.ContainerStack, children: [{ type: LayoutTypes.BottomTabs }] };
23
+    const node = { type: LayoutTypes.Stack, children: [{ type: LayoutTypes.BottomTabs }] };
24 24
     uut.crawl(node);
25 25
     expect(node.data).toEqual({});
26 26
     expect(node.children[0].data).toEqual({});
27 27
   });
28 28
 
29 29
   it('crawls a layout tree and ensures children exists', () => {
30
-    const node = { type: LayoutTypes.ContainerStack, children: [{ type: LayoutTypes.BottomTabs }] };
30
+    const node = { type: LayoutTypes.Stack, children: [{ type: LayoutTypes.BottomTabs }] };
31 31
     uut.crawl(node);
32 32
     expect(node.children[0].children).toEqual([]);
33 33
   });
34 34
 
35 35
   it('crawls a layout tree and asserts known layout type', () => {
36
-    const node = { type: LayoutTypes.ContainerStack, children: [{ type: 'Bob' }] };
36
+    const node = { type: LayoutTypes.Stack, children: [{ type: 'Bob' }] };
37 37
     expect(() => uut.crawl(node)).toThrow(new Error('Unknown layout type Bob'));
38 38
   });
39 39
 
40
-  it('saves passProps into store for Container nodes', () => {
40
+  it('saves passProps into store for Component nodes', () => {
41 41
     const node = {
42 42
       type: LayoutTypes.BottomTabs, children: [
43
-        { type: LayoutTypes.Container, data: { name: 'the name', passProps: { myProp: 123 } } }]
43
+        { type: LayoutTypes.Component, data: { name: 'the name', passProps: { myProp: 123 } } }]
44 44
     };
45
-    expect(store.getPropsForContainerId('Container+UNIQUE_ID')).toEqual({});
45
+    expect(store.getPropsForComponentId('Component+UNIQUE_ID')).toEqual({});
46 46
     uut.crawl(node);
47
-    expect(store.getPropsForContainerId('Container+UNIQUE_ID')).toEqual({ myProp: 123 });
47
+    expect(store.getPropsForComponentId('Component+UNIQUE_ID')).toEqual({ myProp: 123 });
48 48
   });
49 49
 
50
-  it('Containers: injects navigationOptions from original container class static property', () => {
50
+  it('Components: injects options from original component class static property', () => {
51 51
     const theStyle = {};
52
-    const MyContainer = class {
53
-      static get navigationOptions() {
52
+    const MyComponent = class {
53
+      static get options() {
54 54
         return theStyle;
55 55
       }
56 56
     };
57 57
 
58
-    const node = { type: LayoutTypes.Container, data: { name: 'theContainerName' } };
59
-    store.setOriginalContainerClassForName('theContainerName', MyContainer);
58
+    const node = { type: LayoutTypes.Component, data: { name: 'theComponentName' } };
59
+    store.setOriginalComponentClassForName('theComponentName', MyComponent);
60 60
     uut.crawl(node);
61
-    expect(node.data.navigationOptions).toEqual(theStyle);
61
+    expect(node.data.options).toEqual(theStyle);
62 62
   });
63 63
 
64
-  it('Containers: merges navigationOptions from container class static property with passed options, favoring passed options', () => {
64
+  it('Components: merges options from component class static property with passed options, favoring passed options', () => {
65 65
     const theStyle = {
66 66
       bazz: 123,
67 67
       inner: {
@@ -69,8 +69,8 @@ describe('LayoutTreeCrawler', () => {
69 69
       },
70 70
       opt: 'exists only in static'
71 71
     };
72
-    const MyContainer = class {
73
-      static get navigationOptions() {
72
+    const MyComponent = class {
73
+      static get options() {
74 74
         return theStyle;
75 75
       }
76 76
     };
@@ -83,12 +83,12 @@ describe('LayoutTreeCrawler', () => {
83 83
       }
84 84
     };
85 85
 
86
-    const node = { type: LayoutTypes.Container, data: { name: 'theContainerName', navigationOptions: passedOptions } };
87
-    store.setOriginalContainerClassForName('theContainerName', MyContainer);
86
+    const node = { type: LayoutTypes.Component, data: { name: 'theComponentName', options: passedOptions } };
87
+    store.setOriginalComponentClassForName('theComponentName', MyComponent);
88 88
 
89 89
     uut.crawl(node);
90 90
 
91
-    expect(node.data.navigationOptions).toEqual({
91
+    expect(node.data.options).toEqual({
92 92
       aaa: 'exists only in passed',
93 93
       bazz: 789,
94 94
       inner: {
@@ -98,113 +98,113 @@ describe('LayoutTreeCrawler', () => {
98 98
     });
99 99
   });
100 100
 
101
-  it('Containers: deepClones navigationOptions', () => {
101
+  it('Component: deepClones options', () => {
102 102
     const theStyle = {};
103
-    const MyContainer = class {
104
-      static get navigationOptions() {
103
+    const MyComponent = class {
104
+      static get options() {
105 105
         return theStyle;
106 106
       }
107 107
     };
108 108
 
109
-    const node = { type: LayoutTypes.Container, data: { name: 'theContainerName' } };
110
-    store.setOriginalContainerClassForName('theContainerName', MyContainer);
109
+    const node = { type: LayoutTypes.Component, data: { name: 'theComponentName' } };
110
+    store.setOriginalComponentClassForName('theComponentName', MyComponent);
111 111
     uut.crawl(node);
112
-    expect(node.data.navigationOptions).not.toBe(theStyle);
112
+    expect(node.data.options).not.toBe(theStyle);
113 113
   });
114 114
 
115
-  it('Containers: must contain data name', () => {
116
-    const node = { type: LayoutTypes.Container, data: {} };
117
-    expect(() => uut.crawl(node)).toThrow(new Error('Missing container data.name'));
115
+  it('Components: must contain data name', () => {
116
+    const node = { type: LayoutTypes.Component, data: {} };
117
+    expect(() => uut.crawl(node)).toThrow(new Error('Missing component data.name'));
118 118
   });
119 119
 
120
-  it('Containers: navigationOptions default obj', () => {
121
-    const MyContainer = class { };
120
+  it('Components: options default obj', () => {
121
+    const MyComponent = class { };
122 122
 
123
-    const node = { type: LayoutTypes.Container, data: { name: 'theContainerName' } };
124
-    store.setOriginalContainerClassForName('theContainerName', MyContainer);
123
+    const node = { type: LayoutTypes.Component, data: { name: 'theComponentName' } };
124
+    store.setOriginalComponentClassForName('theComponentName', MyComponent);
125 125
     uut.crawl(node);
126
-    expect(node.data.navigationOptions).toEqual({});
126
+    expect(node.data.options).toEqual({});
127 127
   });
128 128
 
129 129
   describe('navigation options', () => {
130
-    let navigationOptions;
130
+    let options;
131 131
     let node;
132 132
 
133 133
     beforeEach(() => {
134
-      navigationOptions = {};
135
-      node = { type: LayoutTypes.Container, data: { name: 'theContainerName', navigationOptions } };
134
+      options = {};
135
+      node = { type: LayoutTypes.Component, data: { name: 'theComponentName', options } };
136 136
     });
137 137
 
138 138
     it('processes colors into numeric AARRGGBB', () => {
139
-      navigationOptions.someKeyColor = 'red';
139
+      options.someKeyColor = 'red';
140 140
       uut.crawl(node);
141
-      expect(node.data.navigationOptions.someKeyColor).toEqual(0xffff0000);
141
+      expect(node.data.options.someKeyColor).toEqual(0xffff0000);
142 142
     });
143 143
 
144 144
     it('processes colors into numeric AARRGGBB', () => {
145
-      navigationOptions.someKeyColor = 'yellow';
145
+      options.someKeyColor = 'yellow';
146 146
       uut.crawl(node);
147
-      expect(node.data.navigationOptions.someKeyColor).toEqual(0xffffff00);
147
+      expect(node.data.options.someKeyColor).toEqual(0xffffff00);
148 148
     });
149 149
 
150 150
     it('processes numeric colors', () => {
151
-      navigationOptions.someKeyColor = '#123456';
151
+      options.someKeyColor = '#123456';
152 152
       uut.crawl(node);
153
-      expect(node.data.navigationOptions.someKeyColor).toEqual(0xff123456);
153
+      expect(node.data.options.someKeyColor).toEqual(0xff123456);
154 154
     });
155 155
 
156 156
     it('processes numeric colors with rrggbbAA', () => {
157
-      navigationOptions.someKeyColor = 0x123456ff; // wut
157
+      options.someKeyColor = 0x123456ff; // wut
158 158
       uut.crawl(node);
159
-      expect(node.data.navigationOptions.someKeyColor).toEqual(0xff123456);
159
+      expect(node.data.options.someKeyColor).toEqual(0xff123456);
160 160
     });
161 161
 
162 162
     it('process colors with rgb functions', () => {
163
-      navigationOptions.someKeyColor = 'rgb(255, 0, 255)';
163
+      options.someKeyColor = 'rgb(255, 0, 255)';
164 164
       uut.crawl(node);
165
-      expect(node.data.navigationOptions.someKeyColor).toEqual(0xffff00ff);
165
+      expect(node.data.options.someKeyColor).toEqual(0xffff00ff);
166 166
     });
167 167
 
168 168
     it('process colors with special words', () => {
169
-      navigationOptions.someKeyColor = 'fuchsia';
169
+      options.someKeyColor = 'fuchsia';
170 170
       uut.crawl(node);
171
-      expect(node.data.navigationOptions.someKeyColor).toEqual(0xffff00ff);
171
+      expect(node.data.options.someKeyColor).toEqual(0xffff00ff);
172 172
     });
173 173
 
174 174
     it('process colors with hsla functions', () => {
175
-      navigationOptions.someKeyColor = 'hsla(360, 100%, 100%, 1.0)';
175
+      options.someKeyColor = 'hsla(360, 100%, 100%, 1.0)';
176 176
       uut.crawl(node);
177
-      expect(node.data.navigationOptions.someKeyColor).toEqual(0xffffffff);
177
+      expect(node.data.options.someKeyColor).toEqual(0xffffffff);
178 178
     });
179 179
 
180 180
     it('unknown colors return undefined', () => {
181
-      navigationOptions.someKeyColor = 'wut';
181
+      options.someKeyColor = 'wut';
182 182
       uut.crawl(node);
183
-      expect(node.data.navigationOptions.someKeyColor).toEqual(undefined);
183
+      expect(node.data.options.someKeyColor).toEqual(undefined);
184 184
     });
185 185
 
186 186
     it('any keys ending with Color', () => {
187
-      navigationOptions.otherKeyColor = 'red';
188
-      navigationOptions.yetAnotherColor = 'blue';
189
-      navigationOptions.andAnotherColor = 'rgb(0, 255, 0)';
187
+      options.otherKeyColor = 'red';
188
+      options.yetAnotherColor = 'blue';
189
+      options.andAnotherColor = 'rgb(0, 255, 0)';
190 190
       uut.crawl(node);
191
-      expect(node.data.navigationOptions.otherKeyColor).toEqual(0xffff0000);
192
-      expect(node.data.navigationOptions.yetAnotherColor).toEqual(0xff0000ff);
193
-      expect(node.data.navigationOptions.andAnotherColor).toEqual(0xff00ff00);
191
+      expect(node.data.options.otherKeyColor).toEqual(0xffff0000);
192
+      expect(node.data.options.yetAnotherColor).toEqual(0xff0000ff);
193
+      expect(node.data.options.andAnotherColor).toEqual(0xff00ff00);
194 194
     });
195 195
 
196 196
     it('keys ending with Color case sensitive', () => {
197
-      navigationOptions.otherKey_color = 'red'; // eslint-disable-line camelcase
197
+      options.otherKey_color = 'red'; // eslint-disable-line camelcase
198 198
       uut.crawl(node);
199
-      expect(node.data.navigationOptions.otherKey_color).toEqual('red');
199
+      expect(node.data.options.otherKey_color).toEqual('red');
200 200
     });
201 201
 
202 202
     it('any nested recursive keys ending with Color', () => {
203
-      navigationOptions.innerObj = { theKeyColor: 'red' };
204
-      navigationOptions.innerObj.innerMostObj = { anotherColor: 'yellow' };
203
+      options.innerObj = { theKeyColor: 'red' };
204
+      options.innerObj.innerMostObj = { anotherColor: 'yellow' };
205 205
       uut.crawl(node);
206
-      expect(node.data.navigationOptions.innerObj.theKeyColor).toEqual(0xffff0000);
207
-      expect(node.data.navigationOptions.innerObj.innerMostObj.anotherColor).toEqual(0xffffff00);
206
+      expect(node.data.options.innerObj.theKeyColor).toEqual(0xffff0000);
207
+      expect(node.data.options.innerObj.innerMostObj.anotherColor).toEqual(0xffffff00);
208 208
     });
209 209
   });
210 210
 });

+ 54
- 60
lib/src/commands/LayoutTreeParser.js View File

@@ -2,97 +2,91 @@ const _ = require('lodash');
2 2
 const LayoutTypes = require('./LayoutTypes');
3 3
 
4 4
 class LayoutTreeParser {
5
+  constructor() {
6
+    this.parse = this.parse.bind(this);
7
+  }
8
+
5 9
   /**
6
-   * returns correct layout tree of {type, children, data?}
10
+   * returns correct layout tree of nodes which are { type, data, children }
7 11
    */
8
-  parseFromSimpleJSON(simpleJsonApi) {
9
-    if (simpleJsonApi.sideMenu) {
10
-      return this._createSideMenu(simpleJsonApi);
11
-    }
12
-    if (simpleJsonApi.bottomTabs) {
13
-      return this._createTabs(simpleJsonApi.bottomTabs);
14
-    }
15
-    if (simpleJsonApi.topTabs) {
16
-      return this._createTopTabs(simpleJsonApi);
17
-    }
18
-    if (simpleJsonApi.name) {
19
-      return this._createContainer(simpleJsonApi);
12
+  parse(api) {
13
+    if (api.topTabs) {
14
+      return this._topTabs(api.topTabs);
15
+    } else if (api.sideMenu) {
16
+      return this._sideMenu(api.sideMenu);
17
+    } else if (api.bottomTabs) {
18
+      return this._bottomTabs(api.bottomTabs);
19
+    } else if (api.stack) {
20
+      return this._stack(api.stack);
21
+    } else if (api.component) {
22
+      return this._component(api.component);
20 23
     }
21
-    return this._createContainerStackWithContainerData(simpleJsonApi.container);
24
+    throw new Error(`unknown LayoutType "${_.keys(api)}"`);
22 25
   }
23 26
 
24
-  createDialogContainer(data) {
25
-    return {
26
-      type: LayoutTypes.CustomDialog,
27
-      data,
28
-      children: []
29
-    };
30
-  }
31
-
32
-  _createTabs(tabs) {
33
-    return {
34
-      type: LayoutTypes.BottomTabs,
35
-      children: _.map(tabs, (t) => this._createContainerStackWithContainerData(t.container))
36
-    };
37
-  }
38
-
39
-  _createTopTabs(node) {
27
+  _topTabs(api) {
40 28
     return {
41 29
       type: LayoutTypes.TopTabs,
42
-      data: _.pick(node, 'navigationOptions'),
43
-      children: _.map(node.topTabs, (t) => this._createTopTab(t))
44
-    };
45
-  }
46
-
47
-  _createTopTab(data) {
48
-    return {
49
-      type: LayoutTypes.TopTab,
50
-      data,
51
-      children: []
30
+      data: { options: api.options },
31
+      children: _.map(api.children, this.parse)
52 32
     };
53 33
   }
54 34
 
55
-  _createContainerStackWithContainerData(containerData) {
56
-    return {
57
-      type: LayoutTypes.ContainerStack,
58
-      children: [this._createContainer(containerData)]
59
-    };
60
-  }
61
-
62
-  _createSideMenu(layout) {
35
+  _sideMenu(api) {
63 36
     return {
64 37
       type: LayoutTypes.SideMenuRoot,
65
-      children: this._createSideMenuChildren(layout)
38
+      data: { options: api.options },
39
+      children: this._sideMenuChildren(api)
66 40
     };
67 41
   }
68 42
 
69
-  _createSideMenuChildren(layout) {
43
+  _sideMenuChildren(api) {
44
+    if (!api.center) {
45
+      throw new Error(`sideMenu.center is required`);
46
+    }
70 47
     const children = [];
71
-    if (layout.sideMenu.left) {
48
+    if (api.left) {
72 49
       children.push({
73 50
         type: LayoutTypes.SideMenuLeft,
74
-        children: [this._createContainer(layout.sideMenu.left.container)]
51
+        data: {},
52
+        children: [this.parse(api.left)]
75 53
       });
76 54
     }
77 55
     children.push({
78 56
       type: LayoutTypes.SideMenuCenter,
79
-      children: [
80
-        layout.bottomTabs ? this._createTabs(layout.bottomTabs) : this._createContainerStackWithContainerData(layout.container)
81
-      ]
57
+      data: {},
58
+      children: [this.parse(api.center)]
82 59
     });
83
-    if (layout.sideMenu.right) {
60
+    if (api.right) {
84 61
       children.push({
85 62
         type: LayoutTypes.SideMenuRight,
86
-        children: [this._createContainer(layout.sideMenu.right.container)]
63
+        data: {},
64
+        children: [this.parse(api.right)]
87 65
       });
88 66
     }
89 67
     return children;
90 68
   }
91 69
 
92
-  _createContainer(data) {
70
+  _bottomTabs(api) {
71
+    return {
72
+      type: LayoutTypes.BottomTabs,
73
+      data: { options: api.options },
74
+      children: _.map(api.children, this.parse)
75
+    };
76
+  }
77
+
78
+  _stack(api) {
79
+    return {
80
+      type: LayoutTypes.Stack,
81
+      data: { name: api.name, options: api.options },
82
+      children: _.map(api.children, this.parse)
83
+    };
84
+  }
85
+
86
+  _component(api) {
93 87
     return {
94
-      type: LayoutTypes.Container,
95
-      data,
88
+      type: LayoutTypes.Component,
89
+      data: { name: api.name, options: api.options, passProps: api.passProps },
96 90
       children: []
97 91
     };
98 92
   }

+ 99
- 302
lib/src/commands/LayoutTreeParser.test.js View File

@@ -1,5 +1,7 @@
1
-const SimpleLayouts = require('./SimpleLayouts');
2 1
 const LayoutTreeParser = require('./LayoutTreeParser');
2
+const LayoutTypes = require('./LayoutTypes');
3
+const _ = require('lodash');
4
+const Examples = require('./LayoutExamples');
3 5
 
4 6
 describe('LayoutTreeParser', () => {
5 7
   let uut;
@@ -8,325 +10,120 @@ describe('LayoutTreeParser', () => {
8 10
     uut = new LayoutTreeParser();
9 11
   });
10 12
 
11
-  describe('parseFromSimpleJSON', () => {
12
-    it('parses single screen', () => {
13
-      expect(uut.parseFromSimpleJSON(SimpleLayouts.singleScreenApp))
14
-        .toEqual({
15
-          type: 'ContainerStack',
16
-          children: [
17
-            {
18
-              type: 'Container',
19
-              data: {
20
-                name: 'com.example.MyScreen'
21
-              },
22
-              children: []
23
-            }
24
-          ]
25
-        });
13
+  describe('parses into { type, data, children }', () => {
14
+    it('unknown type', () => {
15
+      expect(() => uut.parse({ wut: {} })).toThrow(new Error('unknown LayoutType "wut"'));
26 16
     });
27 17
 
28
-    it('parses single screen with props', () => {
29
-      expect(uut.parseFromSimpleJSON(SimpleLayouts.singleScreenWithAditionalParams))
30
-        .toEqual({
31
-          type: 'ContainerStack',
32
-          children: [
33
-            {
34
-              type: 'Container',
35
-              children: [],
36
-              data: {
37
-                name: 'com.example.MyScreen',
38
-                passProps: SimpleLayouts.passProps,
39
-                style: {},
40
-                buttons: {}
41
-              }
42
-            }
43
-          ]
44
-        });
45
-      const parsedPropsFn = uut.parseFromSimpleJSON(SimpleLayouts.singleScreenWithAditionalParams)
46
-        .children[0].data.passProps.fnProp;
47
-      expect(parsedPropsFn).toBe(SimpleLayouts.passProps.fnProp);
48
-      expect(parsedPropsFn()).toEqual('Hello from a function');
18
+    it('single component', () => {
19
+      expect(uut.parse(Examples.singleComponent)).toEqual({
20
+        type: LayoutTypes.Component,
21
+        data: { name: 'MyReactComponent', options: Examples.options, passProps: Examples.passProps },
22
+        children: []
23
+      });
49 24
     });
50 25
 
51
-    it('parses tab based', () => {
52
-      expect(uut.parseFromSimpleJSON(SimpleLayouts.tabBasedApp))
53
-        .toEqual({
54
-          type: 'BottomTabs',
55
-          children: [
56
-            {
57
-              type: 'ContainerStack',
58
-              children: [
59
-                {
60
-                  type: 'Container',
61
-                  children: [],
62
-                  data: {
63
-                    name: 'com.example.ATab'
64
-                  }
65
-                }
66
-              ]
67
-            },
68
-            {
69
-              type: 'ContainerStack',
70
-              children: [
71
-                {
72
-                  type: 'Container',
73
-                  children: [],
74
-                  data: {
75
-                    name: 'com.example.SecondTab'
76
-                  }
77
-                }
78
-              ]
79
-            },
80
-            {
81
-              type: 'ContainerStack',
82
-              children: [
83
-                {
84
-                  type: 'Container',
85
-                  children: [],
86
-                  data: {
87
-                    name: 'com.example.ATab'
88
-                  }
89
-                }
90
-              ]
91
-            }
92
-          ]
93
-        });
26
+    it('pass props', () => {
27
+      const result = uut.parse({
28
+        component: {
29
+          name: 'MyScreen',
30
+          passProps: Examples.passProps
31
+        }
32
+      });
33
+      expect(result).toEqual({
34
+        type: LayoutTypes.Component,
35
+        data: { name: 'MyScreen', passProps: Examples.passProps },
36
+        children: []
37
+      });
38
+      expect(result.data.passProps).toBe(Examples.passProps);
39
+      expect(result.data.passProps.fnProp()).toEqual('Hello from a function');
94 40
     });
95 41
 
96
-    it('parses side menus', () => {
97
-      expect(uut.parseFromSimpleJSON(SimpleLayouts.singleWithSideMenu))
98
-        .toEqual({
99
-          type: 'SideMenuRoot',
100
-          children: [
101
-            {
102
-              type: 'SideMenuLeft',
103
-              children: [
104
-                {
105
-                  type: 'Container',
106
-                  data: {
107
-                    name: 'com.example.SideMenu'
108
-                  },
109
-                  children: []
110
-                }
111
-              ]
112
-            },
113
-            {
114
-              type: 'SideMenuCenter',
115
-              children: [
116
-                {
117
-                  type: 'ContainerStack',
118
-                  children: [
119
-                    {
120
-                      type: 'Container',
121
-                      data: {
122
-                        name: 'com.example.MyScreen'
123
-                      },
124
-                      children: []
125
-                    }
126
-                  ]
127
-                }
128
-              ]
129
-            }
130
-          ]
131
-        });
42
+    it('stack of components with top bar', () => {
43
+      expect(uut.parse(Examples.stackWithTopBar)).toEqual({
44
+        type: LayoutTypes.Stack,
45
+        data: {
46
+          options: Examples.options
47
+        },
48
+        children: [
49
+          {
50
+            type: LayoutTypes.Component,
51
+            data: { name: 'MyReactComponent1' },
52
+            children: []
53
+          },
54
+          {
55
+            type: LayoutTypes.Component,
56
+            data: { name: 'MyReactComponent2', options: Examples.options },
57
+            children: []
58
+          }
59
+        ]
60
+      });
132 61
     });
133 62
 
134
-    it('parses side menu right', () => {
135
-      expect(uut.parseFromSimpleJSON(SimpleLayouts.singleWithRightSideMenu))
136
-        .toEqual({
137
-          type: 'SideMenuRoot',
138
-          children: [
139
-            {
140
-              type: 'SideMenuCenter',
141
-              children: [
142
-                {
143
-                  type: 'ContainerStack',
144
-                  children: [
145
-                    {
146
-                      type: 'Container',
147
-                      data: {
148
-                        name: 'com.example.MyScreen'
149
-                      },
150
-                      children: []
151
-                    }
152
-                  ]
153
-                }
154
-              ]
155
-            },
156
-            {
157
-              type: 'SideMenuRight',
158
-              children: [
159
-                {
160
-                  type: 'Container',
161
-                  data: {
162
-                    name: 'com.example.SideMenu'
163
-                  },
164
-                  children: []
165
-                }
166
-              ]
167
-            }
168
-          ]
169
-        });
63
+    it('bottom tabs', () => {
64
+      const result = uut.parse(Examples.bottomTabs);
65
+      expect(_.keys(result)).toEqual(['type', 'data', 'children']);
66
+      expect(result.type).toEqual(LayoutTypes.BottomTabs);
67
+      expect(result.data).toEqual({});
68
+      expect(result.children.length).toEqual(3);
69
+      expect(result.children[0].type).toEqual(LayoutTypes.Stack);
70
+      expect(result.children[1].type).toEqual(LayoutTypes.Stack);
71
+      expect(result.children[2].type).toEqual(LayoutTypes.Component);
170 72
     });
171 73
 
172
-    it('parses both side menus', () => {
173
-      expect(uut.parseFromSimpleJSON(SimpleLayouts.singleWithBothMenus))
174
-        .toEqual({
175
-          type: 'SideMenuRoot',
176
-          children: [
177
-            {
178
-              type: 'SideMenuLeft',
179
-              children: [
180
-                {
181
-                  type: 'Container',
182
-                  data: {
183
-                    name: 'com.example.Menu1'
184
-                  },
185
-                  children: []
186
-                }
187
-              ]
188
-            },
189
-            {
190
-              type: 'SideMenuCenter',
191
-              children: [
192
-                {
193
-                  type: 'ContainerStack',
194
-                  children: [
195
-                    {
196
-                      type: 'Container',
197
-                      data: {
198
-                        name: 'com.example.MyScreen'
199
-                      },
200
-                      children: []
201
-                    }
202
-                  ]
203
-                }
204
-              ]
205
-            },
206
-            {
207
-              type: 'SideMenuRight',
208
-              children: [
209
-                {
210
-                  type: 'Container',
211
-                  data: {
212
-                    name: 'com.example.Menu2'
213
-                  },
214
-                  children: []
215
-                }
216
-              ]
217
-            }
218
-          ]
219
-        });
74
+    it('side menus', () => {
75
+      const result = uut.parse(Examples.sideMenu);
76
+      expect(_.keys(result)).toEqual(['type', 'data', 'children']);
77
+      expect(result.type).toEqual(LayoutTypes.SideMenuRoot);
78
+      expect(result.data).toEqual({});
79
+      expect(result.children.length).toEqual(3);
80
+      expect(result.children[0].type).toEqual(LayoutTypes.SideMenuLeft);
81
+      expect(result.children[1].type).toEqual(LayoutTypes.SideMenuCenter);
82
+      expect(result.children[2].type).toEqual(LayoutTypes.SideMenuRight);
83
+      expect(result.children[0].children.length).toEqual(1);
84
+      expect(result.children[0].children[0].type).toEqual(LayoutTypes.Component);
85
+      expect(result.children[1].children.length).toEqual(1);
86
+      expect(result.children[1].children[0].type).toEqual(LayoutTypes.Stack);
87
+      expect(result.children[2].children.length).toEqual(1);
88
+      expect(result.children[2].children[0].type).toEqual(LayoutTypes.Component);
220 89
     });
221 90
 
222
-    it('parses bottomTabs with side menus', () => {
223
-      expect(uut.parseFromSimpleJSON(SimpleLayouts.tabBasedWithBothSideMenus))
224
-        .toEqual({
225
-          type: 'SideMenuRoot',
226
-          children: [
227
-            {
228
-              type: 'SideMenuLeft',
229
-              children: [
230
-                {
231
-                  type: 'Container',
232
-                  data: {
233
-                    name: 'com.example.Menu1'
234
-                  },
235
-                  children: []
236
-                }
237
-              ]
238
-            },
239
-            {
240
-              type: 'SideMenuCenter',
241
-              children: [
242
-                {
243
-                  type: 'BottomTabs',
244
-                  children: [
245
-                    {
246
-                      type: 'ContainerStack',
247
-                      children: [
248
-                        {
249
-                          type: 'Container',
250
-                          data: {
251
-                            name: 'com.example.FirstTab'
252
-                          },
253
-                          children: []
254
-                        }
255
-                      ]
256
-                    },
257
-                    {
258
-                      type: 'ContainerStack',
259
-                      children: [
260
-                        {
261
-                          type: 'Container',
262
-                          data: {
263
-                            name: 'com.example.SecondTab'
264
-                          },
265
-                          children: []
266
-                        }
267
-                      ]
268
-                    }
269
-                  ]
270
-                }
271
-              ]
272
-            },
273
-            {
274
-              type: 'SideMenuRight',
275
-              children: [
276
-                {
277
-                  type: 'Container',
278
-                  data: {
279
-                    name: 'com.example.Menu2'
280
-                  },
281
-                  children: []
282
-                }
283
-              ]
284
-            }
285
-          ]
286
-        });
91
+    it('side menu center is require', () => {
92
+      expect(() => uut.parse({ sideMenu: {} })).toThrow(new Error('sideMenu.center is required'));
287 93
     });
288 94
 
289
-    it('parses bottomTabs with side menus', () => {
290
-      expect(uut.parseFromSimpleJSON(SimpleLayouts.singleScreenWithTopTabs))
291
-        .toEqual({
292
-          type: 'TopTabs',
293
-          children: [
294
-            {
295
-              type: 'TopTab',
296
-              data: {
297
-                name: 'navigation.playground.TextScreen'
298
-              },
299
-              children: []
300
-            },
301
-            {
302
-              type: 'TopTab',
303
-              data: {
304
-                name: 'navigation.playground.TextScreen'
305
-              },
306
-              children: []
307
-            },
308
-            {
309
-              type: 'TopTab',
310
-              data: {
311
-                name: 'navigation.playground.TextScreen'
312
-              },
313
-              children: []
314
-            }
315
-          ],
316
-          data: {}
317
-        });
95
+    it('top tabs', () => {
96
+      const result = uut.parse(Examples.topTabs);
97
+      expect(_.keys(result)).toEqual(['type', 'data', 'children']);
98
+      expect(result.type).toEqual(LayoutTypes.TopTabs);
99
+      expect(result.data).toEqual({ options: Examples.options });
100
+      expect(result.children.length).toEqual(5);
101
+      expect(result.children[0].type).toEqual(LayoutTypes.Component);
102
+      expect(result.children[1].type).toEqual(LayoutTypes.Component);
103
+      expect(result.children[2].type).toEqual(LayoutTypes.Component);
104
+      expect(result.children[3].type).toEqual(LayoutTypes.Component);
105
+      expect(result.children[4].type).toEqual(LayoutTypes.Stack);
318 106
     });
319
-  });
320 107
 
321
-  describe('createContainer', () => {
322
-    it('creates container object with passed data', () => {
323
-      expect(uut.parseFromSimpleJSON({ name: 'theContainer', foo: 'bar' })).toEqual({ type: 'Container', data: { name: 'theContainer', foo: 'bar' }, children: [] });
108
+    it('complex layout example', () => {
109
+      const result = uut.parse(Examples.complexLayout);
110
+      expect(result.type).toEqual('SideMenuRoot');
111
+      expect(result.children[1].type).toEqual('SideMenuCenter');
112
+      expect(result.children[1].children[0].type).toEqual('BottomTabs');
113
+      expect(result.children[1].children[0].children[2].type).toEqual('Stack');
114
+      expect(result.children[1].children[0].children[2].children[0].type).toEqual('TopTabs');
115
+      expect(result.children[1].children[0].children[2].children[0].children[2].type).toEqual('TopTabs');
116
+      expect(result.children[1].children[0].children[2].children[0].children[2].children[4].type).toEqual('Stack');
117
+      expect(result.children[1].children[0].children[2].children[0].children[2].data).toEqual({ options: { topBar: { title: 'Hello1' } } });
324 118
     });
325 119
   });
326 120
 
327
-  describe('createDialogContainer', () => {
328
-    it('creates dialog container object with passed data', () => {
329
-      expect(uut.createDialogContainer({ foo: 'bar' })).toEqual({ type: 'CustomDialog', data: { foo: 'bar' }, children: [] });
330
-    });
121
+  it('options for all containing types', () => {
122
+    const options = {};
123
+    expect(uut.parse({ component: { options } }).data.options).toBe(options);
124
+    expect(uut.parse({ stack: { options } }).data.options).toBe(options);
125
+    expect(uut.parse({ bottomTabs: { options } }).data.options).toBe(options);
126
+    expect(uut.parse({ topTabs: { options } }).data.options).toBe(options);
127
+    expect(uut.parse({ sideMenu: { options, center: { component: {} } } }).data.options).toBe(options);
331 128
   });
332 129
 });

+ 3
- 5
lib/src/commands/LayoutTypes.js View File

@@ -1,12 +1,10 @@
1 1
 module.exports = {
2
-  Container: 'Container',
3
-  ContainerStack: 'ContainerStack',
2
+  Component: 'Component',
3
+  Stack: 'Stack',
4 4
   BottomTabs: 'BottomTabs',
5 5
   SideMenuRoot: 'SideMenuRoot',
6 6
   SideMenuCenter: 'SideMenuCenter',
7 7
   SideMenuLeft: 'SideMenuLeft',
8 8
   SideMenuRight: 'SideMenuRight',
9
-  CustomDialog: 'CustomDialog',
10
-  TopTabs: 'TopTabs',
11
-  TopTab: 'TopTab'
9
+  TopTabs: 'TopTabs'
12 10
 };

+ 4
- 4
lib/src/commands/OptionsProcessor.js View File

@@ -3,14 +3,14 @@ const { processColor } = require('react-native');
3 3
 const resolveAssetSource = require('react-native/Libraries/Image/resolveAssetSource');
4 4
 
5 5
 class OptionsProcessor {
6
-  static processOptions(navigationOptions) {
7
-    _.forEach(navigationOptions, (value, key) => {
6
+  static processOptions(options) {
7
+    _.forEach(options, (value, key) => {
8 8
       if (value) {
9 9
         if (_.endsWith(key, 'Color')) {
10
-          navigationOptions[key] = processColor(value);
10
+          options[key] = processColor(value);
11 11
         }
12 12
         if (_.isEqual(key, 'icon') || _.endsWith(key, 'Icon') || _.endsWith(key, 'Image')) {
13
-          navigationOptions[key] = resolveAssetSource(navigationOptions[key]);
13
+          options[key] = resolveAssetSource(options[key]);
14 14
         }
15 15
         if (_.isObject(value) || _.isArray(value)) {
16 16
           OptionsProcessor.processOptions(value);

+ 56
- 58
lib/src/commands/OptionsProcessor.test.js View File

@@ -1,113 +1,111 @@
1 1
 const OptionsProcessor = require('./OptionsProcessor');
2
-const NavigationOptions = require('./../params/options/NavigationOptions');
3 2
 
4 3
 describe('navigation options', () => {
5
-  let navigationOptions;
4
+  let options;
6 5
 
7 6
   beforeEach(() => {
8
-    navigationOptions = {};
7
+    options = {};
9 8
   });
10 9
 
11 10
   it('processes colors into numeric AARRGGBB', () => {
12
-    navigationOptions.someKeyColor = 'red';
13
-    OptionsProcessor.processOptions(navigationOptions);
14
-    expect(navigationOptions.someKeyColor).toEqual(0xffff0000);
11
+    options.someKeyColor = 'red';
12
+    OptionsProcessor.processOptions(options);
13
+    expect(options.someKeyColor).toEqual(0xffff0000);
15 14
 
16
-    navigationOptions.someKeyColor = 'yellow';
17
-    OptionsProcessor.processOptions(navigationOptions);
18
-    expect(navigationOptions.someKeyColor).toEqual(0xffffff00);
15
+    options.someKeyColor = 'yellow';
16
+    OptionsProcessor.processOptions(options);
17
+    expect(options.someKeyColor).toEqual(0xffffff00);
19 18
   });
20 19
 
21 20
   it('processes numeric colors', () => {
22
-    navigationOptions.someKeyColor = '#123456';
23
-    OptionsProcessor.processOptions(navigationOptions);
24
-    expect(navigationOptions.someKeyColor).toEqual(0xff123456);
21
+    options.someKeyColor = '#123456';
22
+    OptionsProcessor.processOptions(options);
23
+    expect(options.someKeyColor).toEqual(0xff123456);
25 24
 
26
-    navigationOptions.someKeyColor = 0x123456ff; // wut
27
-    OptionsProcessor.processOptions(navigationOptions);
28
-    expect(navigationOptions.someKeyColor).toEqual(0xff123456);
25
+    options.someKeyColor = 0x123456ff; // wut
26
+    OptionsProcessor.processOptions(options);
27
+    expect(options.someKeyColor).toEqual(0xff123456);
29 28
   });
30 29
 
31 30
   it('process colors with rgb functions', () => {
32
-    navigationOptions.someKeyColor = 'rgb(255, 0, 255)';
33
-    OptionsProcessor.processOptions(navigationOptions);
34
-    expect(navigationOptions.someKeyColor).toEqual(0xffff00ff);
31
+    options.someKeyColor = 'rgb(255, 0, 255)';
32
+    OptionsProcessor.processOptions(options);
33
+    expect(options.someKeyColor).toEqual(0xffff00ff);
35 34
   });
36 35
 
37 36
   it('process colors with special words', () => {
38
-    navigationOptions.someKeyColor = 'fuchsia';
39
-    OptionsProcessor.processOptions(navigationOptions);
40
-    expect(navigationOptions.someKeyColor).toEqual(0xffff00ff);
37
+    options.someKeyColor = 'fuchsia';
38
+    OptionsProcessor.processOptions(options);
39
+    expect(options.someKeyColor).toEqual(0xffff00ff);
41 40
   });
42 41
 
43 42
   it('process colors with hsla functions', () => {
44
-    navigationOptions.someKeyColor = 'hsla(360, 100%, 100%, 1.0)';
45
-    OptionsProcessor.processOptions(navigationOptions);
43
+    options.someKeyColor = 'hsla(360, 100%, 100%, 1.0)';
44
+    OptionsProcessor.processOptions(options);
46 45
 
47
-    expect(navigationOptions.someKeyColor).toEqual(0xffffffff);
46
+    expect(options.someKeyColor).toEqual(0xffffffff);
48 47
   });
49 48
 
50 49
   it('unknown colors return undefined', () => {
51
-    navigationOptions.someKeyColor = 'wut';
52
-    OptionsProcessor.processOptions(navigationOptions);
53
-    expect(navigationOptions.someKeyColor).toEqual(undefined);
50
+    options.someKeyColor = 'wut';
51
+    OptionsProcessor.processOptions(options);
52
+    expect(options.someKeyColor).toEqual(undefined);
54 53
   });
55 54
 
56 55
   it('any keys ending with Color', () => {
57
-    navigationOptions.otherKeyColor = 'red';
58
-    navigationOptions.yetAnotherColor = 'blue';
59
-    navigationOptions.andAnotherColor = 'rgb(0, 255, 0)';
60
-    OptionsProcessor.processOptions(navigationOptions);
61
-    expect(navigationOptions.otherKeyColor).toEqual(0xffff0000);
62
-    expect(navigationOptions.yetAnotherColor).toEqual(0xff0000ff);
63
-    expect(navigationOptions.andAnotherColor).toEqual(0xff00ff00);
56
+    options.otherKeyColor = 'red';
57
+    options.yetAnotherColor = 'blue';
58
+    options.andAnotherColor = 'rgb(0, 255, 0)';
59
+    OptionsProcessor.processOptions(options);
60
+    expect(options.otherKeyColor).toEqual(0xffff0000);
61
+    expect(options.yetAnotherColor).toEqual(0xff0000ff);
62
+    expect(options.andAnotherColor).toEqual(0xff00ff00);
64 63
   });
65 64
 
66 65
   it('keys ending with Color case sensitive', () => {
67
-    navigationOptions.otherKey_color = 'red'; // eslint-disable-line camelcase
68
-    OptionsProcessor.processOptions(navigationOptions);
69
-    expect(navigationOptions.otherKey_color).toEqual('red');
66
+    options.otherKey_color = 'red'; // eslint-disable-line camelcase
67
+    OptionsProcessor.processOptions(options);
68
+    expect(options.otherKey_color).toEqual('red');
70 69
   });
71 70
 
72 71
   it('any nested recursive keys ending with Color', () => {
73
-    navigationOptions.topBar = { textColor: 'red' };
74
-    navigationOptions.topBar.innerMostObj = { anotherColor: 'yellow' };
75
-    OptionsProcessor.processOptions(navigationOptions);
76
-    expect(navigationOptions.topBar.textColor).toEqual(0xffff0000);
77
-    expect(navigationOptions.topBar.innerMostObj.anotherColor).toEqual(0xffffff00);
72
+    options.topBar = { textColor: 'red' };
73
+    options.topBar.innerMostObj = { anotherColor: 'yellow' };
74
+    OptionsProcessor.processOptions(options);
75
+    expect(options.topBar.textColor).toEqual(0xffff0000);
76
+    expect(options.topBar.innerMostObj.anotherColor).toEqual(0xffffff00);
78 77
   });
79 78
 
80 79
   it('resolve image sources with name/ending with icon', () => {
81
-    navigationOptions.icon = 'require("https://wix.github.io/react-native-navigation/_images/logo.png");';
82
-    navigationOptions.topBar = {
80
+    options.icon = 'require("https://wix.github.io/react-native-navigation/_images/logo.png");';
81
+    options.topBar = {
83 82
       myIcon: 'require("https://wix.github.io/react-native-navigation/_images/logo.png");',
84 83
       myOtherValue: 'value'
85 84
     };
86
-    OptionsProcessor.processOptions(navigationOptions);
85
+    OptionsProcessor.processOptions(options);
87 86
 
88 87
     // As we can't import external images and we don't want to add an image here
89 88
     // I assign the icons to strings (what the require would generally look like)
90 89
     // and expect the value to be resovled, in this case it doesn't find anything and returns null
91
-    expect(navigationOptions.icon).toEqual(null);
92
-    expect(navigationOptions.topBar.myIcon).toEqual(null);
93
-    expect(navigationOptions.topBar.myOtherValue).toEqual('value');
90
+    expect(options.icon).toEqual(null);
91
+    expect(options.topBar.myIcon).toEqual(null);
92
+    expect(options.topBar.myOtherValue).toEqual('value');
94 93
   });
95 94
 
96
-  it('processes NavigationOptions jsDoc object', () => {
97
-    navigationOptions.someKeyColor = 'rgb(255, 0, 255)';
98
-    navigationOptions.topBar = { textColor: 'red' };
99
-    navigationOptions.topBar.innerMostObj = { anotherColor: 'yellow' };
100
-    const navigationOptionsObj = new NavigationOptions(navigationOptions);
95
+  it('processes Options object', () => {
96
+    options.someKeyColor = 'rgb(255, 0, 255)';
97
+    options.topBar = { textColor: 'red' };
98
+    options.topBar.innerMostObj = { anotherColor: 'yellow' };
101 99
 
102
-    OptionsProcessor.processOptions(navigationOptionsObj);
100
+    OptionsProcessor.processOptions({ o: options });
103 101
 
104
-    expect(navigationOptionsObj.topBar.textColor).toEqual(0xffff0000);
102
+    expect(options.topBar.textColor).toEqual(0xffff0000);
105 103
   });
106 104
 
107 105
   it('undefined value return undefined ', () => {
108
-    navigationOptions.someImage = undefined;
109
-    OptionsProcessor.processOptions(navigationOptions);
106
+    options.someImage = undefined;
107
+    OptionsProcessor.processOptions(options);
110 108
 
111
-    expect(navigationOptions.someImage).toEqual(undefined);
109
+    expect(options.someImage).toEqual(undefined);
112 110
   });
113 111
 });

+ 0
- 138
lib/src/commands/SimpleLayouts.js View File

@@ -1,138 +0,0 @@
1
-const singleScreenApp = {
2
-  container: {
3
-    name: 'com.example.MyScreen'
4
-  }
5
-};
6
-
7
-const passProps = {
8
-  strProp: 'string prop',
9
-  numProp: 12345,
10
-  objProp: { inner: { foo: 'bar' } },
11
-  fnProp: () => 'Hello from a function'
12
-};
13
-
14
-const singleScreenWithAditionalParams = {
15
-  container: {
16
-    name: 'com.example.MyScreen',
17
-    passProps,
18
-    style: {},
19
-    buttons: {}
20
-  }
21
-};
22
-
23
-const tabBasedApp = {
24
-  bottomTabs: [
25
-    {
26
-      container: {
27
-        name: 'com.example.ATab'
28
-      }
29
-    },
30
-    {
31
-      container: {
32
-        name: 'com.example.SecondTab'
33
-      }
34
-    },
35
-    {
36
-      container: {
37
-        name: 'com.example.ATab'
38
-      }
39
-    }
40
-  ]
41
-};
42
-
43
-const singleWithSideMenu = {
44
-  container: {
45
-    name: 'com.example.MyScreen'
46
-  },
47
-  sideMenu: {
48
-    left: {
49
-      container: {
50
-        name: 'com.example.SideMenu'
51
-      }
52
-    }
53
-  }
54
-};
55
-
56
-const singleWithRightSideMenu = {
57
-  container: {
58
-    name: 'com.example.MyScreen'
59
-  },
60
-  sideMenu: {
61
-    right: {
62
-      container: {
63
-        name: 'com.example.SideMenu'
64
-      }
65
-    }
66
-  }
67
-};
68
-
69
-const singleWithBothMenus = {
70
-  container: {
71
-    name: 'com.example.MyScreen'
72
-  },
73
-  sideMenu: {
74
-    left: {
75
-      container: {
76
-        name: 'com.example.Menu1'
77
-      }
78
-    },
79
-    right: {
80
-      container: {
81
-        name: 'com.example.Menu2'
82
-      }
83
-    }
84
-  }
85
-};
86
-
87
-const tabBasedWithBothSideMenus = {
88
-  bottomTabs: [
89
-    {
90
-      container: {
91
-        name: 'com.example.FirstTab'
92
-      }
93
-    },
94
-    {
95
-      container: {
96
-        name: 'com.example.SecondTab'
97
-      }
98
-    }
99
-  ],
100
-  sideMenu: {
101
-    left: {
102
-      container: {
103
-        name: 'com.example.Menu1'
104
-      }
105
-    },
106
-    right: {
107
-      container: {
108
-        name: 'com.example.Menu2'
109
-      }
110
-    }
111
-  }
112
-};
113
-
114
-const singleScreenWithTopTabs = {
115
-  topTabs: [
116
-    {
117
-      name: 'navigation.playground.TextScreen'
118
-    },
119
-    {
120
-      name: 'navigation.playground.TextScreen'
121
-    },
122
-    {
123
-      name: 'navigation.playground.TextScreen'
124
-    }
125
-  ]
126
-};
127
-
128
-module.exports = {
129
-  singleScreenApp,
130
-  passProps,
131
-  singleScreenWithAditionalParams,
132
-  tabBasedApp,
133
-  singleWithSideMenu,
134
-  singleWithRightSideMenu,
135
-  singleWithBothMenus,
136
-  tabBasedWithBothSideMenus,
137
-  singleScreenWithTopTabs
138
-};

+ 0
- 0
lib/src/components/ComponentRegistry.js View File


Some files were not shown because too many files changed in this diff