Daniel Zlotin 7 lat temu
rodzic
commit
e57c42b160

+ 1
- 1
AndroidE2E/app/src/androidTest/java/com/reactnativenavigation/e2e/androide2e/BaseTest.java Wyświetl plik

@@ -76,7 +76,7 @@ public abstract class BaseTest {
76 76
 	}
77 77
 
78 78
 	public void assertExists(BySelector selector) {
79
-		assertThat(device().wait(Until.hasObject(selector), TIMEOUT)).isTrue();
79
+		assertThat(device().wait(Until.hasObject(selector), TIMEOUT)).withFailMessage("expected %1$s to be visible", selector).isTrue();
80 80
 		assertThat(device().findObject(selector).getVisibleCenter().x).isPositive().isLessThan(device().getDisplayWidth());
81 81
 		assertThat(device().findObject(selector).getVisibleCenter().y).isPositive().isLessThan(device().getDisplayHeight());
82 82
 	}

+ 2
- 1
AndroidE2E/app/src/androidTest/java/com/reactnativenavigation/e2e/androide2e/ReactEventsTest.java Wyświetl plik

@@ -24,6 +24,7 @@ public class ReactEventsTest extends BaseTest {
24 24
 
25 25
 		device().pressKeyCode(KeyEvent.KEYCODE_R);
26 26
 		device().pressKeyCode(KeyEvent.KEYCODE_R);
27
+		device().waitForIdle();
27 28
 		assertMainShown();
28 29
 	}
29 30
 
@@ -35,7 +36,7 @@ public class ReactEventsTest extends BaseTest {
35 36
 		assertExists(By.text("Pushed Screen"));
36 37
 
37 38
 		device().pressKeyCode(KeyEvent.KEYCODE_R);
38
-		Thread.sleep(1000);
39
+		Thread.sleep(1500);
39 40
 		device().pressKeyCode(KeyEvent.KEYCODE_R);
40 41
 		assertExists(By.text("Pushed Screen"));
41 42
 	}

+ 2
- 2
e2e/ScreenStyleStatic.test.js Wyświetl plik

@@ -3,8 +3,8 @@ describe('screen style - static', () => {
3 3
     await device.relaunchApp();
4 4
   });
5 5
 
6
-  it('declare a navigationStyle on container component', async () => {
7
-    await element(by.label('Push')).tap();
6
+  it('declare a navigationOptions on container component', async () => {
7
+    await element(by.label('Push Options Screen')).tap();
8 8
     await expect(element(by.label('Static Title').and(by.type('UILabel')))).toBeVisible();
9 9
   });
10 10
 });

+ 2
- 2
e2e/TopLevelApi.test.js Wyświetl plik

@@ -20,7 +20,7 @@ describe('top level api', () => {
20 20
   });
21 21
 
22 22
   it('screen lifecycle', async () => {
23
-    await elementByLabel('Push lifecycle screen').tap();
23
+    await elementByLabel('Push Lifecycle Screen').tap();
24 24
     await expect(elementByLabel('onStart')).toBeVisible();
25 25
     await elementByLabel('Push to test onStop').tap();
26 26
     await expect(elementByLabel('Alert')).toBeVisible();
@@ -28,7 +28,7 @@ describe('top level api', () => {
28 28
   });
29 29
 
30 30
   it('unmount is called on pop', async () => {
31
-    await elementByLabel('Push lifecycle screen').tap();
31
+    await elementByLabel('Push Lifecycle Screen').tap();
32 32
     await expect(elementByLabel('onStart')).toBeVisible();
33 33
     await element(by.traits(['button']).and(by.label('Back'))).tap();
34 34
     await expect(elementByLabel('onStop')).toBeVisible();

+ 1
- 1
lib/android/app/src/main/java/com/reactnativenavigation/react/JsDevReloadHandler.java Wyświetl plik

@@ -33,6 +33,6 @@ public class JsDevReloadHandler {
33 33
 	}
34 34
 
35 35
 	private boolean lessThan500MillisSinceLastR() {
36
-		return firstRTimestamp != 0 && System.currentTimeMillis() - firstRTimestamp < 500;
36
+		return firstRTimestamp != 0 && System.currentTimeMillis() - firstRTimestamp < 1000;
37 37
 	}
38 38
 }

+ 3
- 3
lib/src/commands/Commands.test.js Wyświetl plik

@@ -38,7 +38,7 @@ describe('Commands', () => {
38 38
             children: [],
39 39
             data: {
40 40
               name: 'com.example.MyScreen',
41
-              navigationStyle: {}
41
+              navigationOptions: {}
42 42
             }
43 43
           }
44 44
         ]
@@ -81,7 +81,7 @@ describe('Commands', () => {
81 81
           id: "Container+UNIQUE_ID",
82 82
           data: {
83 83
             name: "com.example.MyScreen",
84
-            navigationStyle: {}
84
+            navigationOptions: {}
85 85
           },
86 86
           children: []
87 87
         }]
@@ -161,7 +161,7 @@ describe('Commands', () => {
161 161
         id: 'Container+UNIQUE_ID',
162 162
         data: {
163 163
           name: 'com.example.MyScreen',
164
-          navigationStyle: {}
164
+          navigationOptions: {}
165 165
         },
166 166
         children: []
167 167
       });

+ 1
- 1
lib/src/commands/LayoutTreeCrawler.js Wyświetl plik

@@ -23,7 +23,7 @@ export default class LayoutTreeCrawler {
23 23
     this._assertContainerDataName(node);
24 24
     this.store.setPropsForContainerId(node.id, node.data.passProps);
25 25
     const clazz = this.store.getOriginalContainerClassForName(node.data.name);
26
-    node.data.navigationStyle = _.cloneDeep(_.get(clazz, 'navigationStyle', {}));
26
+    node.data.navigationOptions = _.cloneDeep(_.get(clazz, 'navigationOptions', {}));
27 27
   }
28 28
 
29 29
   _assertKnownLayoutType(type) {

+ 8
- 8
lib/src/commands/LayoutTreeCrawler.test.js Wyświetl plik

@@ -47,28 +47,28 @@ describe('LayoutTreeCrawler', () => {
47 47
     expect(store.getPropsForContainerId('Container+UNIQUE_ID')).toEqual({ myProp: 123 });
48 48
   });
49 49
 
50
-  it('Containers: injects navigationStyle from original container class static property', () => {
50
+  it('Containers: injects navigationOptions from original container class static property', () => {
51 51
     const theStyle = {};
52 52
     const MyContainer = class {
53
-      static navigationStyle = theStyle;
53
+      static navigationOptions = theStyle;
54 54
     };
55 55
 
56 56
     const node = { type: LayoutTypes.Container, data: { name: 'theContainerName' } };
57 57
     store.setOriginalContainerClassForName('theContainerName', MyContainer);
58 58
     uut.crawl(node);
59
-    expect(node.data.navigationStyle).toEqual(theStyle);
59
+    expect(node.data.navigationOptions).toEqual(theStyle);
60 60
   });
61 61
 
62
-  it('Containers: deepClones navigationStyle', () => {
62
+  it('Containers: deepClones navigationOptions', () => {
63 63
     const theStyle = {};
64 64
     const MyContainer = class {
65
-      static navigationStyle = theStyle;
65
+      static navigationOptions = theStyle;
66 66
     };
67 67
 
68 68
     const node = { type: LayoutTypes.Container, data: { name: 'theContainerName' } };
69 69
     store.setOriginalContainerClassForName('theContainerName', MyContainer);
70 70
     uut.crawl(node);
71
-    expect(node.data.navigationStyle).not.toBe(theStyle);
71
+    expect(node.data.navigationOptions).not.toBe(theStyle);
72 72
   });
73 73
 
74 74
   it('Containers: must contain data name', () => {
@@ -76,12 +76,12 @@ describe('LayoutTreeCrawler', () => {
76 76
     expect(() => uut.crawl(node)).toThrow(new Error('Missing container data.name'));
77 77
   });
78 78
 
79
-  it('Containers: navigationStyle default obj', () => {
79
+  it('Containers: navigationOptions default obj', () => {
80 80
     const MyContainer = class { };
81 81
 
82 82
     const node = { type: LayoutTypes.Container, data: { name: 'theContainerName' } };
83 83
     store.setOriginalContainerClassForName('theContainerName', MyContainer);
84 84
     uut.crawl(node);
85
-    expect(node.data.navigationStyle).toEqual({});
85
+    expect(node.data.navigationOptions).toEqual({});
86 86
   });
87 87
 });

+ 1
- 1
playground/src/containers/OptionsScreen.js Wyświetl plik

@@ -60,4 +60,4 @@ const styles = {
60 60
   }
61 61
 };
62 62
 
63
-export default PushedScreen;
63
+export default OptionsScreen;

+ 9
- 1
playground/src/containers/WelcomeScreen.js Wyświetl plik

@@ -9,6 +9,7 @@ class WelcomeScreen extends Component {
9 9
     this.onClickPush = this.onClickPush.bind(this);
10 10
     this.onClickShowModal = this.onClickShowModal.bind(this);
11 11
     this.onClickLifecycleScreen = this.onClickLifecycleScreen.bind(this);
12
+    this.onClickPushOptionsScreen = this.onClickPushOptionsScreen.bind(this);
12 13
   }
13 14
 
14 15
   render() {
@@ -17,8 +18,9 @@ class WelcomeScreen extends Component {
17 18
         <Text style={styles.h1}>{`React Native Navigation!`}</Text>
18 19
         <Button title="Switch to tab based app" onPress={this.onClickSwitchToTabs} />
19 20
         <Button title="Switch to app with side menus" onPress={this.onClickSwitchToSideMenus} />
20
-        <Button title="Push lifecycle screen" onPress={this.onClickLifecycleScreen} />
21
+        <Button title="Push Lifecycle Screen" onPress={this.onClickLifecycleScreen} />
21 22
         <Button title="Push" onPress={this.onClickPush} />
23
+        <Button title="Push Options Screen" onPress={this.onClickPushOptionsScreen} />
22 24
         <Button title="Show Modal" onPress={this.onClickShowModal} />
23 25
         <Button title="Show Redbox" onPress={this.onClickShowRedbox} />
24 26
         <Text style={styles.footer}>{`this.props.id = ${this.props.id}`}</Text>
@@ -122,6 +124,12 @@ class WelcomeScreen extends Component {
122 124
   onClickShowRedbox() {
123 125
     undefined();
124 126
   }
127
+
128
+  onClickPushOptionsScreen() {
129
+    Navigation.push(this.props.id, {
130
+      name: 'navigation.playground.OptionsScreen'
131
+    });
132
+  }
125 133
 }
126 134
 
127 135
 export default WelcomeScreen;