Ver código fonte

revert returning wrapped component

Daniel Zlotin 6 anos atrás
pai
commit
34df61e265

+ 0
- 6
lib/src/components/ComponentRegistry.test.tsx Ver arquivo

@@ -48,10 +48,4 @@ describe('ComponentRegistry', () => {
48 48
     const tree = renderer.create(<Component componentId='123' />);
49 49
     expect(tree.toJSON()!.children).toEqual(['Hello, World!']);
50 50
   });
51
-
52
-  it('returns the wrapped registered component', () => {
53
-    const result = uut.registerComponent('example.MyComponent.name', () => MyComponent);
54
-    expect(result).toBeDefined();
55
-    expect(result).toBe(mockRegistry.mock.calls[0][1]());
56
-  });
57 51
 });

+ 1
- 3
lib/src/components/ComponentRegistry.ts Ver arquivo

@@ -1,4 +1,3 @@
1
-import * as React from 'react';
2 1
 import { AppRegistry, ComponentProvider } from 'react-native';
3 2
 import { ComponentWrapper } from './ComponentWrapper';
4 3
 
@@ -9,11 +8,10 @@ export class ComponentRegistry {
9 8
     this.store = store;
10 9
   }
11 10
 
12
-  registerComponent(componentName: string, getComponentClassFunc: ComponentProvider): React.ComponentType<any> {
11
+  registerComponent(componentName: string, getComponentClassFunc: ComponentProvider): void {
13 12
     const OriginalComponentClass = getComponentClassFunc();
14 13
     const NavigationComponent = ComponentWrapper.wrap(componentName, OriginalComponentClass, this.store);
15 14
     this.store.setOriginalComponentClassForName(componentName, OriginalComponentClass);
16 15
     AppRegistry.registerComponent(componentName, () => NavigationComponent);
17
-    return NavigationComponent;
18 16
   }
19 17
 }