Browse Source

Fix name collision so auto import works correctly (#4414)

Fix name collision so autocomplete works
Henrik Raitasola 6 years ago
parent
commit
9e97838526
3 changed files with 5 additions and 6 deletions
  1. 1
    1
      lib/src/Navigation.ts
  2. 1
    2
      lib/src/components/Store.ts
  3. 3
    3
      lib/src/index.ts

+ 1
- 1
lib/src/Navigation.ts View File

17
 import { Options } from './interfaces/Options';
17
 import { Options } from './interfaces/Options';
18
 import { ComponentWrapper } from './components/ComponentWrapper';
18
 import { ComponentWrapper } from './components/ComponentWrapper';
19
 
19
 
20
-export class Navigation {
20
+export class NavigationRoot {
21
   public readonly Element: React.ComponentType<{ elementId: any; resizeMode?: any; }>;
21
   public readonly Element: React.ComponentType<{ elementId: any; resizeMode?: any; }>;
22
   public readonly TouchablePreview: React.ComponentType<any>;
22
   public readonly TouchablePreview: React.ComponentType<any>;
23
   public readonly store: Store;
23
   public readonly store: Store;

+ 1
- 2
lib/src/components/Store.ts View File

12
     return _.get(this.propsById, componentId, {});
12
     return _.get(this.propsById, componentId, {});
13
   }
13
   }
14
 
14
 
15
-
16
   setComponentClassForName(componentName: string | number, ComponentClass) {
15
   setComponentClassForName(componentName: string | number, ComponentClass) {
17
     _.set(this.componentsByName, componentName.toString(), ComponentClass);
16
     _.set(this.componentsByName, componentName.toString(), ComponentClass);
18
   }
17
   }
20
   getComponentClassForName(componentName: string | number) {
19
   getComponentClassForName(componentName: string | number) {
21
     return _.get(this.componentsByName, componentName.toString());
20
     return _.get(this.componentsByName, componentName.toString());
22
   }
21
   }
23
-  
22
+
24
   cleanId(id: string) {
23
   cleanId(id: string) {
25
     _.unset(this.propsById, id);
24
     _.unset(this.propsById, id);
26
   }
25
   }

+ 3
- 3
lib/src/index.ts View File

1
-import { Navigation as NavigationClass } from './Navigation';
1
+import { NavigationRoot } from './Navigation';
2
 
2
 
3
-const singleton = new NavigationClass();
3
+const navigationSingleton = new NavigationRoot();
4
 
4
 
5
-export const Navigation = singleton;
5
+export const Navigation = navigationSingleton;
6
 export * from './adapters/Constants';
6
 export * from './adapters/Constants';
7
 export * from './interfaces/ComponentEvents';
7
 export * from './interfaces/ComponentEvents';
8
 export * from './interfaces/Events';
8
 export * from './interfaces/Events';