Browse Source

screenId into outer state

Daniel Zlotin 8 years ago
parent
commit
e16e6773ad
2 changed files with 4 additions and 5 deletions
  1. 4
    4
      src2/containers/ContainerRegistry.js
  2. 0
    1
      src2/containers/ContainerRegistry.test.js

+ 4
- 4
src2/containers/ContainerRegistry.js View File

@@ -21,21 +21,21 @@ function wrapContainer(containerKey, OriginalContainer) {
21 21
       if (!props.screenId) {
22 22
         throw new Error(`Screen ${containerKey} does not have a screenId!`);
23 23
       }
24
-      this.screenId = props.screenId;
25 24
       this.state = {
26
-        allProps: {...props, ...PropsStore.getPropsForScreenId(this.screenId)}
25
+        screenId: props.screenId,
26
+        allProps: {...props, ...PropsStore.getPropsForScreenId(props.screenId)}
27 27
       };
28 28
     }
29 29
 
30 30
     componentWillReceiveProps(nextProps) {
31 31
       this.setState({
32
-        allProps: {...nextProps, ...PropsStore.getPropsForScreenId(this.screenId)}
32
+        allProps: {...nextProps, ...PropsStore.getPropsForScreenId(this.state.screenId)}
33 33
       });
34 34
     }
35 35
 
36 36
     render() {
37 37
       return (
38
-        <OriginalContainer {...this.state.allProps} screenId={this.screenId}/>
38
+        <OriginalContainer {...this.state.allProps} screenId={this.state.screenId}/>
39 39
       );
40 40
     }
41 41
   };

+ 0
- 1
src2/containers/ContainerRegistry.test.js View File

@@ -1,4 +1,3 @@
1
-import _ from 'lodash';
2 1
 import {AppRegistry, Text} from 'react-native';
3 2
 import React, {Component} from 'react';
4 3
 import renderer from 'react-test-renderer';