Browse Source

screenId into outer state

Daniel Zlotin 7 years ago
parent
commit
e16e6773ad

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

21
       if (!props.screenId) {
21
       if (!props.screenId) {
22
         throw new Error(`Screen ${containerKey} does not have a screenId!`);
22
         throw new Error(`Screen ${containerKey} does not have a screenId!`);
23
       }
23
       }
24
-      this.screenId = props.screenId;
25
       this.state = {
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
     componentWillReceiveProps(nextProps) {
30
     componentWillReceiveProps(nextProps) {
31
       this.setState({
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
     render() {
36
     render() {
37
       return (
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
-import _ from 'lodash';
2
 import {AppRegistry, Text} from 'react-native';
1
 import {AppRegistry, Text} from 'react-native';
3
 import React, {Component} from 'react';
2
 import React, {Component} from 'react';
4
 import renderer from 'react-test-renderer';
3
 import renderer from 'react-test-renderer';