Sfoglia il codice sorgente

screenId into outer state

Daniel Zlotin 8 anni fa
parent
commit
e16e6773ad

+ 4
- 4
src2/containers/ContainerRegistry.js Vedi 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 Vedi 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';