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
 package com.reactnativenavigation.e2e.androide2e;
1
 package com.reactnativenavigation.e2e.androide2e;
2
 
2
 
3
 import android.support.test.uiautomator.By;
3
 import android.support.test.uiautomator.By;
4
+import android.support.test.uiautomator.UiObjectNotFoundException;
4
 
5
 
5
 import org.junit.Test;
6
 import org.junit.Test;
6
 
7
 
11
 		elementByText("PUSH OPTIONS SCREEN").click();
12
 		elementByText("PUSH OPTIONS SCREEN").click();
12
         elementByText("SHOW OVERLAY").click();
13
         elementByText("SHOW OVERLAY").click();
13
 		assertExists(By.text("Test view"));
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
 ```js
12
 ```js
13
 Navigation.events().onAppLaunched(() => {
13
 Navigation.events().onAppLaunched(() => {
14
   Navigation.setRoot({
14
   Navigation.setRoot({
15
-    container: {
15
+    component: {
16
       name: 'navigation.playground.WelcomeScreen'
16
       name: 'navigation.playground.WelcomeScreen'
17
     }
17
     }
18
   });
18
   });
19
 });
19
 });
20
 ```
20
 ```
21
 
21
 
22
-### registerContainer(screenID, generator)
22
+### registerComponent(screenID, generator)
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.
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
 ```js
25
 ```js
26
-Navigation.registerContainer(`navigation.playground.WelcomeScreen`, () => WelcomeScreen);
26
+Navigation.registerComponent(`navigation.playground.WelcomeScreen`, () => WelcomeScreen);
27
 ```
27
 ```
28
 
28
 
29
 ### setRoot({params})
29
 ### setRoot({params})
31
 
31
 
32
 ```js
32
 ```js
33
 Navigation.setRoot({
33
 Navigation.setRoot({
34
-  container: {
35
-    name: 'navigation.playground.WelcomeScreen'
36
-  },
37
   sideMenu: {
34
   sideMenu: {
38
     left: {
35
     left: {
39
-      container: {
36
+      component: {
40
         name: 'navigation.playground.TextScreen',
37
         name: 'navigation.playground.TextScreen',
41
         passProps: {
38
         passProps: {
42
           text: 'This is a left side menu screen'
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
     right: {
48
     right: {
47
-      container: {
49
+      component: {
48
         name: 'navigation.playground.TextScreen',
50
         name: 'navigation.playground.TextScreen',
49
         passProps: {
51
         passProps: {
50
           text: 'This is a right side menu screen'
52
           text: 'This is a right side menu screen'
58
 
60
 
59
 ```js
61
 ```js
60
 Navigation.setRoot({
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
 ## Screen API
86
 ## Screen API

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

66
         <Button title="Custom Transition" onPress={this.onClickCustomTranstition} />
66
         <Button title="Custom Transition" onPress={this.onClickCustomTranstition} />
67
         <Button title="Show custom alert" testID={testIDs.SHOW_CUSTOM_ALERT_BUTTON} onPress={this.onClickAlert} />
67
         <Button title="Show custom alert" testID={testIDs.SHOW_CUSTOM_ALERT_BUTTON} onPress={this.onClickAlert} />
68
         <Button title="Show snackbar" testID={testIDs.SHOW_SNACKBAR_BUTTON} onPress={this.onClickSnackbar} />
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
         <Button title="Push Default Options Screen" testID={testIDs.PUSH_DEFAULT_OPTIONS_BUTTON} onPress={this.onClickPushDefaultOptionsScreen} />
71
         <Button title="Push Default Options Screen" testID={testIDs.PUSH_DEFAULT_OPTIONS_BUTTON} onPress={this.onClickPushDefaultOptionsScreen} />
72
         <Text style={styles.footer}>{`this.props.containerId = ${this.props.containerId}`}</Text>
72
         <Text style={styles.footer}>{`this.props.containerId = ${this.props.containerId}`}</Text>
73
       </View>
73
       </View>