Browse Source

Merge branch 'v2' into typescript

Daniel Zlotin 6 years ago
parent
commit
aa6bd18cf4

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

@@ -1,6 +1,7 @@
1 1
 package com.reactnativenavigation.e2e.androide2e;
2 2
 
3 3
 import android.support.test.uiautomator.By;
4
+import android.support.test.uiautomator.UiObjectNotFoundException;
4 5
 
5 6
 import org.junit.Test;
6 7
 
@@ -11,8 +12,22 @@ public class OverlayTest extends BaseTest {
11 12
 		elementByText("PUSH OPTIONS SCREEN").click();
12 13
         elementByText("SHOW OVERLAY").click();
13 14
 		assertExists(By.text("Test view"));
14
-		elementByText("OK").click();
15
-		assertExists(By.text("Overlay disappeared"));
16
-        elementByText("OK").click();
15
+        assetDismissed();
16
+	}
17
+
18
+    @Test
19
+	public void testOverlayNotInterceptingTouchEvents() throws Exception {
20
+		elementByText("PUSH OPTIONS SCREEN").click();
21
+        elementByText("SHOW TOUCH THROUGH OVERLAY").click();
22
+		assertExists(By.text("Test view"));
23
+        elementByText("DYNAMIC OPTIONS").click();
24
+        assertExists(By.text("Dynamic Title"));
25
+        assetDismissed();
17 26
 	}
27
+
28
+    private void assetDismissed() throws UiObjectNotFoundException {
29
+        elementByText("OK").click();
30
+        assertExists(By.text("Overlay disappeared"));
31
+        elementByText("OK").click();
32
+    }
18 33
 }

+ 31
- 27
docs/docs/usage.md View File

@@ -12,18 +12,18 @@ How to initiate your app.
12 12
 ```js
13 13
 Navigation.events().onAppLaunched(() => {
14 14
   Navigation.setRoot({
15
-    container: {
15
+    component: {
16 16
       name: 'navigation.playground.WelcomeScreen'
17 17
     }
18 18
   });
19 19
 });
20 20
 ```
21 21
 
22
-### registerContainer(screenID, generator)
22
+### registerComponent(screenID, generator)
23 23
 Every screen component in your app must be registered with a unique name. The component itself is a traditional React component extending React.Component.
24 24
 
25 25
 ```js
26
-Navigation.registerContainer(`navigation.playground.WelcomeScreen`, () => WelcomeScreen);
26
+Navigation.registerComponent(`navigation.playground.WelcomeScreen`, () => WelcomeScreen);
27 27
 ```
28 28
 
29 29
 ### setRoot({params})
@@ -31,20 +31,22 @@ Start a Single page app with two side menus:
31 31
 
32 32
 ```js
33 33
 Navigation.setRoot({
34
-  container: {
35
-    name: 'navigation.playground.WelcomeScreen'
36
-  },
37 34
   sideMenu: {
38 35
     left: {
39
-      container: {
36
+      component: {
40 37
         name: 'navigation.playground.TextScreen',
41 38
         passProps: {
42 39
           text: 'This is a left side menu screen'
43 40
         }
44 41
       }
45 42
     },
43
+    center: {
44
+      component: {
45
+        name: 'navigation.playground.WelcomeScreen'
46
+      },
47
+    },
46 48
     right: {
47
-      container: {
49
+      component: {
48 50
         name: 'navigation.playground.TextScreen',
49 51
         passProps: {
50 52
           text: 'This is a right side menu screen'
@@ -58,25 +60,27 @@ Start a tab based app:
58 60
 
59 61
 ```js
60 62
 Navigation.setRoot({
61
-  bottomTabs: [
62
-    {
63
-      container: {
64
-        name: 'navigation.playground.TextScreen',
65
-        passProps: {
66
-          text: 'This is tab 1',
67
-          myFunction: () => 'Hello from a function!'
68
-        }
69
-      }
70
-    },
71
-    {
72
-      container: {
73
-        name: 'navigation.playground.TextScreen',
74
-        passProps: {
75
-          text: 'This is tab 2'
76
-        }
77
-      }
78
-    }
79
-  ]
63
+  bottomTabs: {
64
+    children: [
65
+      {
66
+        component: {
67
+          name: 'navigation.playground.TextScreen',
68
+          passProps: {
69
+            text: 'This is tab 1',
70
+            myFunction: () => 'Hello from a function!',
71
+          },
72
+        },
73
+      },
74
+      {
75
+        component: {
76
+          name: 'navigation.playground.TextScreen',
77
+          passProps: {
78
+            text: 'This is tab 2',
79
+          },
80
+        },
81
+      },
82
+    ],
83
+  },
80 84
 });
81 85
 ```
82 86
 ## Screen API

+ 2
- 2
playground/src/screens/OptionsScreen.js View File

@@ -66,8 +66,8 @@ class OptionsScreen extends Component {
66 66
         <Button title="Custom Transition" onPress={this.onClickCustomTranstition} />
67 67
         <Button title="Show custom alert" testID={testIDs.SHOW_CUSTOM_ALERT_BUTTON} onPress={this.onClickAlert} />
68 68
         <Button title="Show snackbar" testID={testIDs.SHOW_SNACKBAR_BUTTON} onPress={this.onClickSnackbar} />
69
-        <Button title="Show overlay inter" testID={testIDs.SHOW_OVERLAY_BUTTON} onPress={() => this.onClickShowOverlay(true)} />
70
-        <Button title="Show touch through overlay notInter" testID={testIDs.SHOW_TOUCH_THROUGH_OVERLAY_BUTTON} onPress={() => this.onClickShowOverlay(false)} />
69
+        <Button title="Show overlay" testID={testIDs.SHOW_OVERLAY_BUTTON} onPress={() => this.onClickShowOverlay(true)} />
70
+        <Button title="Show touch through overlay" testID={testIDs.SHOW_TOUCH_THROUGH_OVERLAY_BUTTON} onPress={() => this.onClickShowOverlay(false)} />
71 71
         <Button title="Push Default Options Screen" testID={testIDs.PUSH_DEFAULT_OPTIONS_BUTTON} onPress={this.onClickPushDefaultOptionsScreen} />
72 72
         <Text style={styles.footer}>{`this.props.containerId = ${this.props.containerId}`}</Text>
73 73
       </View>