Browse Source

changed this.props.id to this.props.containerId (#1327)

* changed this.props.id to this.props.containerId

* fixed js tests

* refactor
bogobogo 7 years ago
parent
commit
6b0ce5ba90

+ 1
- 1
lib/android/app/src/main/java/com/reactnativenavigation/layout/ReactRootViewController.java View File

60
 	protected View createView() {
60
 	protected View createView() {
61
 		reactRootView = new ReactRootView(getActivity());
61
 		reactRootView = new ReactRootView(getActivity());
62
 		Bundle opts = new Bundle();
62
 		Bundle opts = new Bundle();
63
-		opts.putString("id", getId());
63
+		opts.putString("containerId", getId());
64
 		reactRootView.startReactApplication(this.reactInstanceManager, this.name, opts);
64
 		reactRootView.startReactApplication(this.reactInstanceManager, this.name, opts);
65
 		reactRootView.setEventListener(new ReactRootView.ReactRootViewEventListener() {
65
 		reactRootView.setEventListener(new ReactRootView.ReactRootViewEventListener() {
66
 			@Override
66
 			@Override

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

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

+ 1
- 1
lib/src/containers/ContainerRegistry.test.js View File

40
   it('resulting in a normal component', () => {
40
   it('resulting in a normal component', () => {
41
     uut.registerContainer('example.MyContainer.name', () => MyContainer);
41
     uut.registerContainer('example.MyContainer.name', () => MyContainer);
42
     const Container = AppRegistry.registerComponent.mock.calls[0][1]();
42
     const Container = AppRegistry.registerComponent.mock.calls[0][1]();
43
-    const tree = renderer.create(<Container id="123" />);
43
+    const tree = renderer.create(<Container containerId="123" />);
44
     expect(tree.toJSON().children).toEqual(['Hello, World!']);
44
     expect(tree.toJSON().children).toEqual(['Hello, World!']);
45
   });
45
   });
46
 });
46
 });

+ 11
- 11
lib/src/containers/ContainerWrapper.js View File

7
       constructor(props) {
7
       constructor(props) {
8
         super(props);
8
         super(props);
9
         this._saveContainerRef = this._saveContainerRef.bind(this);
9
         this._saveContainerRef = this._saveContainerRef.bind(this);
10
-        this._assertId(props);
10
+        this._assertContainerId(props);
11
         this._createState(props);
11
         this._createState(props);
12
       }
12
       }
13
 
13
 
14
-      _assertId(props) {
15
-        if (!props.id) {
16
-          throw new Error(`Container ${containerName} does not have an id!`);
14
+      _assertContainerId(props) {
15
+        if (!props.containerId) {
16
+          throw new Error(`Container ${containerName} does not have a containerId!`);
17
         }
17
         }
18
       }
18
       }
19
 
19
 
20
       _createState(props) {
20
       _createState(props) {
21
         this.state = {
21
         this.state = {
22
-          id: props.id,
23
-          allProps: _.merge({}, props, store.getPropsForContainerId(props.id))
22
+          containerId: props.containerId,
23
+          allProps: _.merge({}, props, store.getPropsForContainerId(props.containerId))
24
         };
24
         };
25
       }
25
       }
26
 
26
 
29
       }
29
       }
30
 
30
 
31
       componentWillMount() {
31
       componentWillMount() {
32
-        store.setRefForId(this.state.id, this);
32
+        store.setRefForContainerId(this.state.containerId, this);
33
       }
33
       }
34
 
34
 
35
       componentWillUnmount() {
35
       componentWillUnmount() {
36
-        store.cleanId(this.state.id);
36
+        store.cleanId(this.state.containerId);
37
       }
37
       }
38
 
38
 
39
       onStart() {
39
       onStart() {
50
 
50
 
51
       componentWillReceiveProps(nextProps) {
51
       componentWillReceiveProps(nextProps) {
52
         this.setState({
52
         this.setState({
53
-          allProps: _.merge({}, nextProps, store.getPropsForContainerId(this.state.id))
53
+          allProps: _.merge({}, nextProps, store.getPropsForContainerId(this.state.containerId))
54
         });
54
         });
55
       }
55
       }
56
 
56
 
59
           <OriginalContainer
59
           <OriginalContainer
60
             ref={this._saveContainerRef}
60
             ref={this._saveContainerRef}
61
             {...this.state.allProps}
61
             {...this.state.allProps}
62
-            id={this.state.id}
63
-            key={this.state.id}
62
+            containerId={this.state.containerId}
63
+            key={this.state.containerId}
64
           />
64
           />
65
         );
65
         );
66
       }
66
       }

+ 22
- 22
lib/src/containers/ContainerWrapper.test.js View File

34
     render() {
34
     render() {
35
       const Child = this.ChildClass;
35
       const Child = this.ChildClass;
36
       return (
36
       return (
37
-        <Child id="container1" {...this.state.propsFromState} />
37
+        <Child containerId="container1" {...this.state.propsFromState} />
38
       );
38
       );
39
     }
39
     }
40
   }
40
   }
43
     store = new Store();
43
     store = new Store();
44
   });
44
   });
45
 
45
 
46
-  it('must have id as prop', () => {
46
+  it('must have containerId as prop', () => {
47
     const NavigationContainer = ContainerWrapper.wrap(containerName, MyContainer, store);
47
     const NavigationContainer = ContainerWrapper.wrap(containerName, MyContainer, store);
48
     const orig = console.error; //eslint-disable-line
48
     const orig = console.error; //eslint-disable-line
49
     console.error = (a) => a; //eslint-disable-line
49
     console.error = (a) => a; //eslint-disable-line
50
     expect(() => {
50
     expect(() => {
51
       renderer.create(<NavigationContainer />);
51
       renderer.create(<NavigationContainer />);
52
-    }).toThrow(new Error('Container example.MyContainer does not have an id!'));
52
+    }).toThrow(new Error('Container example.MyContainer does not have a containerId!'));
53
     console.error = orig; //eslint-disable-line
53
     console.error = orig; //eslint-disable-line
54
   });
54
   });
55
 
55
 
56
   it('wraps the container', () => {
56
   it('wraps the container', () => {
57
     const NavigationContainer = ContainerWrapper.wrap(containerName, MyContainer, store);
57
     const NavigationContainer = ContainerWrapper.wrap(containerName, MyContainer, store);
58
     expect(NavigationContainer).not.toBeInstanceOf(MyContainer);
58
     expect(NavigationContainer).not.toBeInstanceOf(MyContainer);
59
-    const tree = renderer.create(<NavigationContainer id={'container1'} />);
59
+    const tree = renderer.create(<NavigationContainer containerId={'container1'} />);
60
     expect(tree.toJSON().children).toEqual(['Hello, World!']);
60
     expect(tree.toJSON().children).toEqual(['Hello, World!']);
61
     expect(myContainerRef).toBeInstanceOf(MyContainer);
61
     expect(myContainerRef).toBeInstanceOf(MyContainer);
62
   });
62
   });
63
 
63
 
64
   it('injects props from wrapper into original container', () => {
64
   it('injects props from wrapper into original container', () => {
65
     const NavigationContainer = ContainerWrapper.wrap(containerName, MyContainer, store);
65
     const NavigationContainer = ContainerWrapper.wrap(containerName, MyContainer, store);
66
-    renderer.create(<NavigationContainer id={'container1'} myProp={'yo'} />);
66
+    renderer.create(<NavigationContainer containerId={'container1'} myProp={'yo'} />);
67
     expect(myContainerRef.props.myProp).toEqual('yo');
67
     expect(myContainerRef.props.myProp).toEqual('yo');
68
   });
68
   });
69
 
69
 
78
   it('pulls props from the store and injects them into the inner container', () => {
78
   it('pulls props from the store and injects them into the inner container', () => {
79
     store.setPropsForContainerId('container123', { numberProp: 1, stringProp: 'hello', objectProp: { a: 2 } });
79
     store.setPropsForContainerId('container123', { numberProp: 1, stringProp: 'hello', objectProp: { a: 2 } });
80
     const NavigationContainer = ContainerWrapper.wrap(containerName, MyContainer, store);
80
     const NavigationContainer = ContainerWrapper.wrap(containerName, MyContainer, store);
81
-    renderer.create(<NavigationContainer id={'container123'} />);
82
-    expect(myContainerRef.props).toEqual({ id: 'container123', numberProp: 1, stringProp: 'hello', objectProp: { a: 2 } });
81
+    renderer.create(<NavigationContainer containerId={'container123'} />);
82
+    expect(myContainerRef.props).toEqual({ containerId: 'container123', numberProp: 1, stringProp: 'hello', objectProp: { a: 2 } });
83
   });
83
   });
84
 
84
 
85
   it('updates props from store into inner container', () => {
85
   it('updates props from store into inner container', () => {
96
   it('protects id from change', () => {
96
   it('protects id from change', () => {
97
     const NavigationContainer = ContainerWrapper.wrap(containerName, MyContainer, store);
97
     const NavigationContainer = ContainerWrapper.wrap(containerName, MyContainer, store);
98
     renderer.create(<TestParent ChildClass={NavigationContainer} />);
98
     renderer.create(<TestParent ChildClass={NavigationContainer} />);
99
-    expect(myContainerRef.props.id).toEqual('container1');
99
+    expect(myContainerRef.props.containerId).toEqual('container1');
100
     testParentRef.setState({ propsFromState: { id: 'ERROR' } });
100
     testParentRef.setState({ propsFromState: { id: 'ERROR' } });
101
-    expect(myContainerRef.props.id).toEqual('container1');
101
+    expect(myContainerRef.props.containerId).toEqual('container1');
102
   });
102
   });
103
 
103
 
104
   it('assignes key by id', () => {
104
   it('assignes key by id', () => {
105
     const NavigationContainer = ContainerWrapper.wrap(containerName, MyContainer, store);
105
     const NavigationContainer = ContainerWrapper.wrap(containerName, MyContainer, store);
106
-    renderer.create(<NavigationContainer id={'container1'} />);
107
-    expect(myContainerRef.props.id).toEqual('container1');
106
+    renderer.create(<NavigationContainer containerId={'container1'} />);
107
+    expect(myContainerRef.props.containerId).toEqual('container1');
108
     expect(myContainerRef._reactInternalInstance.key).toEqual('container1');
108
     expect(myContainerRef._reactInternalInstance.key).toEqual('container1');
109
   });
109
   });
110
 
110
 
111
   it('saves self ref into store', () => {
111
   it('saves self ref into store', () => {
112
     const NavigationContainer = ContainerWrapper.wrap(containerName, MyContainer, store);
112
     const NavigationContainer = ContainerWrapper.wrap(containerName, MyContainer, store);
113
-    const tree = renderer.create(<NavigationContainer id={'container1'} />);
114
-    expect(store.getRefForId('container1')).toBeDefined();
115
-    expect(store.getRefForId('container1')).toBe(tree.getInstance());
113
+    const tree = renderer.create(<NavigationContainer containerId={'container1'} />);
114
+    expect(store.getRefForContainerId('container1')).toBeDefined();
115
+    expect(store.getRefForContainerId('container1')).toBe(tree.getInstance());
116
   });
116
   });
117
 
117
 
118
   it('cleans ref from store on unMount', () => {
118
   it('cleans ref from store on unMount', () => {
119
     const NavigationContainer = ContainerWrapper.wrap(containerName, MyContainer, store);
119
     const NavigationContainer = ContainerWrapper.wrap(containerName, MyContainer, store);
120
-    const tree = renderer.create(<NavigationContainer id={'container1'} />);
121
-    expect(store.getRefForId('container1')).toBeDefined();
120
+    const tree = renderer.create(<NavigationContainer containerId={'container1'} />);
121
+    expect(store.getRefForContainerId('container1')).toBeDefined();
122
     tree.unmount();
122
     tree.unmount();
123
-    expect(store.getRefForId('container1')).toBeUndefined();
123
+    expect(store.getRefForContainerId('container1')).toBeUndefined();
124
   });
124
   });
125
 
125
 
126
   it('holds ref to OriginalContainer', () => {
126
   it('holds ref to OriginalContainer', () => {
127
     const NavigationContainer = ContainerWrapper.wrap(containerName, MyContainer, store);
127
     const NavigationContainer = ContainerWrapper.wrap(containerName, MyContainer, store);
128
-    const tree = renderer.create(<NavigationContainer id={'container1'} />);
128
+    const tree = renderer.create(<NavigationContainer containerId={'container1'} />);
129
     expect(tree.getInstance().originalContainerRef).toBe(myContainerRef);
129
     expect(tree.getInstance().originalContainerRef).toBe(myContainerRef);
130
   });
130
   });
131
 
131
 
132
   it('cleans ref to internal container on unount', () => {
132
   it('cleans ref to internal container on unount', () => {
133
     const NavigationContainer = ContainerWrapper.wrap(containerName, MyContainer, store);
133
     const NavigationContainer = ContainerWrapper.wrap(containerName, MyContainer, store);
134
-    const tree = renderer.create(<NavigationContainer id={'container1'} />);
134
+    const tree = renderer.create(<NavigationContainer containerId={'container1'} />);
135
     const instance = tree.getInstance();
135
     const instance = tree.getInstance();
136
     expect(instance.originalContainerRef).toBeInstanceOf(Component);
136
     expect(instance.originalContainerRef).toBeInstanceOf(Component);
137
     tree.unmount();
137
     tree.unmount();
154
 
154
 
155
     it('onStart and onStop are optional', () => {
155
     it('onStart and onStop are optional', () => {
156
       const NavigationContainer = ContainerWrapper.wrap(containerName, MyContainer, store);
156
       const NavigationContainer = ContainerWrapper.wrap(containerName, MyContainer, store);
157
-      const tree = renderer.create(<NavigationContainer id={'container1'} />);
157
+      const tree = renderer.create(<NavigationContainer containerId={'container1'} />);
158
       expect(() => tree.getInstance().onStart()).not.toThrow();
158
       expect(() => tree.getInstance().onStart()).not.toThrow();
159
       expect(() => tree.getInstance().onStop()).not.toThrow();
159
       expect(() => tree.getInstance().onStop()).not.toThrow();
160
     });
160
     });
161
 
161
 
162
     it('calls onStart on OriginalContainer', () => {
162
     it('calls onStart on OriginalContainer', () => {
163
       const NavigationContainer = ContainerWrapper.wrap(containerName, MyLifecycleContainer, store);
163
       const NavigationContainer = ContainerWrapper.wrap(containerName, MyLifecycleContainer, store);
164
-      const tree = renderer.create(<NavigationContainer id={'container1'} />);
164
+      const tree = renderer.create(<NavigationContainer containerId={'container1'} />);
165
       expect(onStartCallback).toHaveBeenCalledTimes(0);
165
       expect(onStartCallback).toHaveBeenCalledTimes(0);
166
       tree.getInstance().onStart();
166
       tree.getInstance().onStart();
167
       expect(onStartCallback).toHaveBeenCalledTimes(1);
167
       expect(onStartCallback).toHaveBeenCalledTimes(1);
169
 
169
 
170
     it('calls onSop on OriginalContainer', () => {
170
     it('calls onSop on OriginalContainer', () => {
171
       const NavigationContainer = ContainerWrapper.wrap(containerName, MyLifecycleContainer, store);
171
       const NavigationContainer = ContainerWrapper.wrap(containerName, MyLifecycleContainer, store);
172
-      const tree = renderer.create(<NavigationContainer id={'container1'} />);
172
+      const tree = renderer.create(<NavigationContainer containerId={'container1'} />);
173
       expect(onStopCallback).toHaveBeenCalledTimes(0);
173
       expect(onStopCallback).toHaveBeenCalledTimes(0);
174
       tree.getInstance().onStop();
174
       tree.getInstance().onStop();
175
       expect(onStopCallback).toHaveBeenCalledTimes(1);
175
       expect(onStopCallback).toHaveBeenCalledTimes(1);

+ 2
- 2
lib/src/containers/Lifecycle.js View File

6
   }
6
   }
7
 
7
 
8
   containerStart(id) {
8
   containerStart(id) {
9
-    const ref = this.store.getRefForId(id);
9
+    const ref = this.store.getRefForContainerId(id);
10
     if (ref && ref.onStart) {
10
     if (ref && ref.onStart) {
11
       ref.onStart();
11
       ref.onStart();
12
     }
12
     }
13
   }
13
   }
14
 
14
 
15
   containerStop(id) {
15
   containerStop(id) {
16
-    const ref = this.store.getRefForId(id);
16
+    const ref = this.store.getRefForContainerId(id);
17
     if (ref && ref.onStop) {
17
     if (ref && ref.onStop) {
18
       ref.onStop();
18
       ref.onStop();
19
     }
19
     }

+ 3
- 3
lib/src/containers/Lifecycle.test.js View File

11
       onStop: jest.fn()
11
       onStop: jest.fn()
12
     };
12
     };
13
     store = new Store();
13
     store = new Store();
14
-    store.setRefForId('myUniqueId', mockRef);
14
+    store.setRefForContainerId('myUniqueId', mockRef);
15
 
15
 
16
     uut = new Lifecycle(store);
16
     uut = new Lifecycle(store);
17
   });
17
   });
30
     it('skips unimplemented onStart', () => {
30
     it('skips unimplemented onStart', () => {
31
       mockRef = {};
31
       mockRef = {};
32
       expect(mockRef.onStart).toBeUndefined();
32
       expect(mockRef.onStart).toBeUndefined();
33
-      store.setRefForId('myUniqueId', mockRef);
33
+      store.setRefForContainerId('myUniqueId', mockRef);
34
       uut.containerStart('myUniqueId');
34
       uut.containerStart('myUniqueId');
35
     });
35
     });
36
   });
36
   });
49
     it('skips unimplemented onStop', () => {
49
     it('skips unimplemented onStop', () => {
50
       mockRef = {};
50
       mockRef = {};
51
       expect(mockRef.onStop).toBeUndefined();
51
       expect(mockRef.onStop).toBeUndefined();
52
-      store.setRefForId('myUniqueId', mockRef);
52
+      store.setRefForContainerId('myUniqueId', mockRef);
53
       uut.containerStop('myUniqueId');
53
       uut.containerStop('myUniqueId');
54
     });
54
     });
55
   });
55
   });

+ 2
- 2
lib/src/containers/Store.js View File

23
     return _.get(this.containersByName, containerName);
23
     return _.get(this.containersByName, containerName);
24
   }
24
   }
25
 
25
 
26
-  setRefForId(id, ref) {
26
+  setRefForContainerId(id, ref) {
27
     _.set(this.refsById, id, ref);
27
     _.set(this.refsById, id, ref);
28
   }
28
   }
29
 
29
 
30
-  getRefForId(id) {
30
+  getRefForContainerId(id) {
31
     return _.get(this.refsById, id);
31
     return _.get(this.refsById, id);
32
   }
32
   }
33
 
33
 

+ 5
- 5
lib/src/containers/Store.test.js View File

32
 
32
 
33
   it('holds container refs by id', () => {
33
   it('holds container refs by id', () => {
34
     const ref = {};
34
     const ref = {};
35
-    uut.setRefForId('refUniqueId', ref);
36
-    expect(uut.getRefForId('other')).toBeUndefined();
37
-    expect(uut.getRefForId('refUniqueId')).toBe(ref);
35
+    uut.setRefForContainerId('refUniqueId', ref);
36
+    expect(uut.getRefForContainerId('other')).toBeUndefined();
37
+    expect(uut.getRefForContainerId('refUniqueId')).toBe(ref);
38
   });
38
   });
39
 
39
 
40
   it('clean by id', () => {
40
   it('clean by id', () => {
41
-    uut.setRefForId('refUniqueId', {});
41
+    uut.setRefForContainerId('refUniqueId', {});
42
     uut.setPropsForContainerId('refUniqueId', { foo: 'bar' });
42
     uut.setPropsForContainerId('refUniqueId', { foo: 'bar' });
43
 
43
 
44
     uut.cleanId('refUniqueId');
44
     uut.cleanId('refUniqueId');
45
 
45
 
46
-    expect(uut.getRefForId('refUniqueId')).toBeUndefined();
46
+    expect(uut.getRefForContainerId('refUniqueId')).toBeUndefined();
47
     expect(uut.getPropsForContainerId('refUniqueId')).toEqual({});
47
     expect(uut.getPropsForContainerId('refUniqueId')).toEqual({});
48
   });
48
   });
49
 });
49
 });

+ 1
- 1
lib/src/events/PrivateEventsListener.test.js View File

18
     const mockRef = {
18
     const mockRef = {
19
       onStart: jest.fn()
19
       onStart: jest.fn()
20
     };
20
     };
21
-    store.setRefForId('myContainerId', mockRef);
21
+    store.setRefForContainerId('myContainerId', mockRef);
22
     uut.listenAndHandlePrivateEvents();
22
     uut.listenAndHandlePrivateEvents();
23
     expect(nativeEventsReceiver.containerStart).toHaveBeenCalledTimes(1);
23
     expect(nativeEventsReceiver.containerStart).toHaveBeenCalledTimes(1);
24
     const callbackFunction = nativeEventsReceiver.containerStart.mock.calls[0][0];
24
     const callbackFunction = nativeEventsReceiver.containerStart.mock.calls[0][0];

+ 2
- 2
playground/src/containers/LifecycleScreen.js View File

30
         <Text style={styles.h1}>{`Lifecycle Screen`}</Text>
30
         <Text style={styles.h1}>{`Lifecycle Screen`}</Text>
31
         <Text style={styles.h1}>{this.state.text}</Text>
31
         <Text style={styles.h1}>{this.state.text}</Text>
32
         <Button title="Push to test onStop" onPress={this.onClickPush} />
32
         <Button title="Push to test onStop" onPress={this.onClickPush} />
33
-        <Text style={styles.footer}>{`this.props.id = ${this.props.id}`}</Text>
33
+        <Text style={styles.footer}>{`this.props.containerId = ${this.props.containerId}`}</Text>
34
       </View>
34
       </View>
35
     );
35
     );
36
   }
36
   }
37
 
37
 
38
   onClickPush() {
38
   onClickPush() {
39
-    Navigation.push(this.props.id, {
39
+    Navigation.push(this.props.containerId, {
40
       name: 'navigation.playground.TextScreen'
40
       name: 'navigation.playground.TextScreen'
41
     });
41
     });
42
   }
42
   }

+ 3
- 3
playground/src/containers/ModalScreen.js View File

32
         {this.getPreviousModalId() ? (<Button title="Dismiss Previous Modal" onPress={this.onClickDismissPreviousModal} />) : undefined}
32
         {this.getPreviousModalId() ? (<Button title="Dismiss Previous Modal" onPress={this.onClickDismissPreviousModal} />) : undefined}
33
         {this.props.previousModalIds ? (<Button title="Dismiss ALL Previous Modals" onPress={this.onClickDismissAllPreviousModals} />) : undefined}
33
         {this.props.previousModalIds ? (<Button title="Dismiss ALL Previous Modals" onPress={this.onClickDismissAllPreviousModals} />) : undefined}
34
         {this.props.previousModalIds ? (<Button title="Dismiss First In Stack" onPress={this.onClickDismissFirstInStack} />) : undefined}
34
         {this.props.previousModalIds ? (<Button title="Dismiss First In Stack" onPress={this.onClickDismissFirstInStack} />) : undefined}
35
-        <Text style={styles.footer}>{`this.props.id = ${this.props.id}`}</Text>
35
+        <Text style={styles.footer}>{`this.props.containerId = ${this.props.containerId}`}</Text>
36
 
36
 
37
       </View>
37
       </View>
38
     );
38
     );
44
         name: 'navigation.playground.ModalScreen',
44
         name: 'navigation.playground.ModalScreen',
45
         passProps: {
45
         passProps: {
46
           modalPosition: this.getModalPosition() + 1,
46
           modalPosition: this.getModalPosition() + 1,
47
-          previousModalIds: _.concat([], this.props.previousModalIds || [], this.props.id)
47
+          previousModalIds: _.concat([], this.props.previousModalIds || [], this.props.containerId)
48
         }
48
         }
49
       }
49
       }
50
     });
50
     });
51
   }
51
   }
52
 
52
 
53
   onClickDismissModal() {
53
   onClickDismissModal() {
54
-    Navigation.dismissModal(this.props.id);
54
+    Navigation.dismissModal(this.props.containerId);
55
   }
55
   }
56
 
56
 
57
   onClickDismissPreviousModal() {
57
   onClickDismissPreviousModal() {

+ 1
- 1
playground/src/containers/OptionsScreen.js View File

24
       <View style={styles.root}>
24
       <View style={styles.root}>
25
         <Text style={styles.h1}>{`Options Screen`}</Text>
25
         <Text style={styles.h1}>{`Options Screen`}</Text>
26
         <Button title="Dynamic Options" onPress={this.onClickDynamicOptions} />
26
         <Button title="Dynamic Options" onPress={this.onClickDynamicOptions} />
27
-        <Text style={styles.footer}>{`this.props.id = ${this.props.id}`}</Text>
27
+        <Text style={styles.footer}>{`this.props.containerId = ${this.props.containerId}`}</Text>
28
       </View>
28
       </View>
29
     );
29
     );
30
   }
30
   }

+ 5
- 5
playground/src/containers/PushedScreen.js View File

30
         <Button title="Pop Previous" onPress={this.onClickPopPrevious} />
30
         <Button title="Pop Previous" onPress={this.onClickPopPrevious} />
31
         <Button title="Pop To Root" onPress={this.onClickPopToRoot} />
31
         <Button title="Pop To Root" onPress={this.onClickPopToRoot} />
32
         {stackPosition > 2 && <Button title="Pop To Stack Position 1" onPress={this.onClickPopToFirstPosition} />}
32
         {stackPosition > 2 && <Button title="Pop To Stack Position 1" onPress={this.onClickPopToFirstPosition} />}
33
-        <Text style={styles.footer}>{`this.props.id = ${this.props.id}`}</Text>
33
+        <Text style={styles.footer}>{`this.props.containerId = ${this.props.containerId}`}</Text>
34
       </View>
34
       </View>
35
     );
35
     );
36
   }
36
   }
37
 
37
 
38
   onClickPush() {
38
   onClickPush() {
39
-    Navigation.push(this.props.id, {
39
+    Navigation.push(this.props.containerId, {
40
       name: 'navigation.playground.PushedScreen',
40
       name: 'navigation.playground.PushedScreen',
41
       passProps: {
41
       passProps: {
42
         stackPosition: this.getStackPosition() + 1,
42
         stackPosition: this.getStackPosition() + 1,
43
-        previousScreenIds: _.concat([], this.props.previousScreenIds || [], this.props.id)
43
+        previousScreenIds: _.concat([], this.props.previousScreenIds || [], this.props.containerId)
44
       }
44
       }
45
     });
45
     });
46
   }
46
   }
47
 
47
 
48
   onClickPop() {
48
   onClickPop() {
49
-    Navigation.pop(this.props.id);
49
+    Navigation.pop(this.props.containerId);
50
   }
50
   }
51
 
51
 
52
   onClickPopPrevious() {
52
   onClickPopPrevious() {
58
   }
58
   }
59
 
59
 
60
   onClickPopToRoot() {
60
   onClickPopToRoot() {
61
-    Navigation.popToRoot(this.props.id);
61
+    Navigation.popToRoot(this.props.containerId);
62
   }
62
   }
63
 
63
 
64
   getStackPosition() {
64
   getStackPosition() {

+ 1
- 1
playground/src/containers/TextScreen.js View File

11
       <View style={styles.root}>
11
       <View style={styles.root}>
12
         <Text style={styles.h1}>{this.props.text || 'Text Screen'}</Text>
12
         <Text style={styles.h1}>{this.props.text || 'Text Screen'}</Text>
13
         {this.renderTextFromFunctionInProps()}
13
         {this.renderTextFromFunctionInProps()}
14
-        <Text style={styles.footer}>{`this.props.id = ${this.props.id}`}</Text>
14
+        <Text style={styles.footer}>{`this.props.containerId = ${this.props.containerId}`}</Text>
15
       </View>
15
       </View>
16
     );
16
     );
17
   }
17
   }

+ 4
- 4
playground/src/containers/WelcomeScreen.js View File

23
         <Button title="Push Options Screen" onPress={this.onClickPushOptionsScreen} />
23
         <Button title="Push Options Screen" onPress={this.onClickPushOptionsScreen} />
24
         <Button title="Show Modal" onPress={this.onClickShowModal} />
24
         <Button title="Show Modal" onPress={this.onClickShowModal} />
25
         <Button title="Show Redbox" onPress={this.onClickShowRedbox} />
25
         <Button title="Show Redbox" onPress={this.onClickShowRedbox} />
26
-        <Text style={styles.footer}>{`this.props.id = ${this.props.id}`}</Text>
26
+        <Text style={styles.footer}>{`this.props.containerId = ${this.props.containerId}`}</Text>
27
       </View>
27
       </View>
28
     );
28
     );
29
   }
29
   }
102
   }
102
   }
103
 
103
 
104
   onClickPush() {
104
   onClickPush() {
105
-    Navigation.push(this.props.id, {
105
+    Navigation.push(this.props.containerId, {
106
       name: 'navigation.playground.PushedScreen'
106
       name: 'navigation.playground.PushedScreen'
107
     });
107
     });
108
   }
108
   }
109
 
109
 
110
   onClickLifecycleScreen() {
110
   onClickLifecycleScreen() {
111
-    Navigation.push(this.props.id, {
111
+    Navigation.push(this.props.containerId, {
112
       name: 'navigation.playground.LifecycleScreen'
112
       name: 'navigation.playground.LifecycleScreen'
113
     });
113
     });
114
   }
114
   }
126
   }
126
   }
127
 
127
 
128
   onClickPushOptionsScreen() {
128
   onClickPushOptionsScreen() {
129
-    Navigation.push(this.props.id, {
129
+    Navigation.push(this.props.containerId, {
130
       name: 'navigation.playground.OptionsScreen'
130
       name: 'navigation.playground.OptionsScreen'
131
     });
131
     });
132
   }
132
   }