Daniel Zlotin 8 years ago
parent
commit
e5205483e3

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

2
 import {AppRegistry, Text} from 'react-native';
2
 import {AppRegistry, Text} from 'react-native';
3
 import React, {Component} from 'react';
3
 import React, {Component} from 'react';
4
 import renderer from 'react-test-renderer';
4
 import renderer from 'react-test-renderer';
5
+import * as PropStore from './PropsStore';
5
 
6
 
6
 class MyContainer extends Component {
7
 class MyContainer extends Component {
7
   render() {
8
   render() {
87
         renderer.create(<NavigationContainer/>);
88
         renderer.create(<NavigationContainer/>);
88
       }).toThrow(new Error('Screen example.MyContainer.key does not have a screenId!'));
89
       }).toThrow(new Error('Screen example.MyContainer.key does not have a screenId!'));
89
     });
90
     });
91
+
92
+    it('pulls props from the PropsStore and injects them into the inner container', () => {
93
+      const props = {myProp: 1, otherProp: 'hello', yetAnotherProp: {a: 2}};
94
+      PropStore.setPropsForScreenId('my_screen_1', props);
95
+      // TODO
96
+    });
90
   });
97
   });
91
 });
98
 });

+ 10
- 0
src2/containers/ContainerStore.js View File

1
+const state = {
2
+  containersByKey: {}
3
+};
1
 
4
 
5
+export function saveContainerClass(containerKey, containerClass) {
6
+  state.containersByKey[containerKey] = containerClass;
7
+}
8
+
9
+export function getContainerClass(containerKey) {
10
+  return state.containersByKey[containerKey];
11
+}

+ 15
- 1
src2/containers/ContainerStore.test.js View File

1
 describe('ContainerStore', () => {
1
 describe('ContainerStore', () => {
2
-  it('holds containers', () => {
2
+  let uut;
3
+
4
+  beforeEach(() => {
5
+    uut = require('./ContainerStore');
6
+  });
7
+
8
+  class Component {
9
+    //
10
+  }
11
+  class MyComponent extends Component {
3
     //
12
     //
13
+  }
14
+
15
+  it('holds containers classes by containerKey', () => {
16
+    uut.saveContainerClass('example.mykey', MyComponent);
17
+    expect(uut.getContainerClass('example.mykey')).toEqual(MyComponent);
4
   });
18
   });
5
 });
19
 });

+ 15
- 11
yarn.lock View File

985
     node-int64 "^0.4.0"
985
     node-int64 "^0.4.0"
986
 
986
 
987
 buffer-crc32@~0.2.3:
987
 buffer-crc32@~0.2.3:
988
-  version "0.2.6"
989
-  resolved "https://registry.yarnpkg.com/buffer-crc32/-/buffer-crc32-0.2.6.tgz#612b318074fc6c4c30504b297247a1f91641253b"
988
+  version "0.2.13"
989
+  resolved "https://registry.yarnpkg.com/buffer-crc32/-/buffer-crc32-0.2.13.tgz#0d333e3f00eac50aa1454abd30ef8c2a5d9a7242"
990
 
990
 
991
 buffer-shims@^1.0.0:
991
 buffer-shims@^1.0.0:
992
   version "1.0.0"
992
   version "1.0.0"
1641
   version "0.1.1"
1641
   version "0.1.1"
1642
   resolved "https://registry.yarnpkg.com/dom-walk/-/dom-walk-0.1.1.tgz#672226dc74c8f799ad35307df936aba11acd6018"
1642
   resolved "https://registry.yarnpkg.com/dom-walk/-/dom-walk-0.1.1.tgz#672226dc74c8f799ad35307df936aba11acd6018"
1643
 
1643
 
1644
-domelementtype@1, domelementtype@~1.1.1:
1644
+domelementtype@1:
1645
+  version "1.3.0"
1646
+  resolved "https://registry.yarnpkg.com/domelementtype/-/domelementtype-1.3.0.tgz#b17aed82e8ab59e52dd9c19b1756e0fc187204c2"
1647
+
1648
+domelementtype@~1.1.1:
1645
   version "1.1.3"
1649
   version "1.1.3"
1646
   resolved "https://registry.yarnpkg.com/domelementtype/-/domelementtype-1.1.3.tgz#bd28773e2642881aec51544924299c5cd822185b"
1650
   resolved "https://registry.yarnpkg.com/domelementtype/-/domelementtype-1.1.3.tgz#bd28773e2642881aec51544924299c5cd822185b"
1647
 
1651
 
2615
     jsprim "^1.2.2"
2619
     jsprim "^1.2.2"
2616
     sshpk "^1.7.0"
2620
     sshpk "^1.7.0"
2617
 
2621
 
2618
-iconv-lite@0.4.11:
2622
+iconv-lite@0.4.11, iconv-lite@^0.4.5:
2619
   version "0.4.11"
2623
   version "0.4.11"
2620
   resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.11.tgz#2ecb42fd294744922209a2e7c404dac8793d8ade"
2624
   resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.11.tgz#2ecb42fd294744922209a2e7c404dac8793d8ade"
2621
 
2625
 
2623
   version "0.4.13"
2627
   version "0.4.13"
2624
   resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.13.tgz#1f88aba4ab0b1508e8312acc39345f36e992e2f2"
2628
   resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.13.tgz#1f88aba4ab0b1508e8312acc39345f36e992e2f2"
2625
 
2629
 
2626
-iconv-lite@^0.4.13, iconv-lite@^0.4.5, iconv-lite@~0.4.13:
2627
-  version "0.4.14"
2628
-  resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.14.tgz#0c4b78106835ecce149ffc7f1b588a9f23bf28e3"
2630
+iconv-lite@^0.4.13, iconv-lite@~0.4.13:
2631
+  version "0.4.15"
2632
+  resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.15.tgz#fe265a218ac6a57cfe854927e9d04c19825eddeb"
2629
 
2633
 
2630
 ignore@^3.2.0:
2634
 ignore@^3.2.0:
2631
   version "3.2.0"
2635
   version "3.2.0"
3773
     xtend "^4.0.0"
3777
     xtend "^4.0.0"
3774
 
3778
 
3775
 moment@2.x.x:
3779
 moment@2.x.x:
3776
-  version "2.16.0"
3777
-  resolved "https://registry.yarnpkg.com/moment/-/moment-2.16.0.tgz#f38f2c97c9889b0ee18fc6cc392e1e443ad2da8e"
3780
+  version "2.17.0"
3781
+  resolved "https://registry.yarnpkg.com/moment/-/moment-2.17.0.tgz#a4c292e02aac5ddefb29a6eed24f51938dd3b74f"
3778
 
3782
 
3779
 morgan@~1.6.1:
3783
 morgan@~1.6.1:
3780
   version "1.6.1"
3784
   version "1.6.1"
4410
     isarray "0.0.1"
4414
     isarray "0.0.1"
4411
     string_decoder "~0.10.x"
4415
     string_decoder "~0.10.x"
4412
 
4416
 
4413
-readable-stream@^2.0.0, "readable-stream@^2.0.0 || ^1.1.13", readable-stream@^2.0.2, readable-stream@^2.0.4, readable-stream@^2.0.5, readable-stream@~2.0.0, readable-stream@~2.0.5:
4417
+readable-stream@^2.0.0, "readable-stream@^2.0.0 || ^1.1.13", readable-stream@^2.0.1, readable-stream@^2.0.2, readable-stream@^2.0.4, readable-stream@^2.0.5, readable-stream@~2.0.0, readable-stream@~2.0.5:
4414
   version "2.0.6"
4418
   version "2.0.6"
4415
   resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.0.6.tgz#8f90341e68a53ccc928788dacfcd11b36eb9b78e"
4419
   resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.0.6.tgz#8f90341e68a53ccc928788dacfcd11b36eb9b78e"
4416
   dependencies:
4420
   dependencies:
4421
     string_decoder "~0.10.x"
4425
     string_decoder "~0.10.x"
4422
     util-deprecate "~1.0.1"
4426
     util-deprecate "~1.0.1"
4423
 
4427
 
4424
-readable-stream@^2.0.1, readable-stream@~2.1.4:
4428
+readable-stream@~2.1.4:
4425
   version "2.1.5"
4429
   version "2.1.5"
4426
   resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.1.5.tgz#66fa8b720e1438b364681f2ad1a63c618448c9d0"
4430
   resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.1.5.tgz#66fa8b720e1438b364681f2ad1a63c618448c9d0"
4427
   dependencies:
4431
   dependencies: