Browse Source

declaration files

Daniel Zlotin 6 years ago
parent
commit
d391acb715

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

11
 import { ComponentProvider } from 'react-native';
11
 import { ComponentProvider } from 'react-native';
12
 import { Element } from './adapters/Element';
12
 import { Element } from './adapters/Element';
13
 
13
 
14
-class Navigation {
14
+export class Navigation {
15
   public readonly Element;
15
   public readonly Element;
16
 
16
 
17
   private readonly store;
17
   private readonly store;
156
     return this.publicEventsRegistry;
156
     return this.publicEventsRegistry;
157
   }
157
   }
158
 }
158
 }
159
-
160
-export const singleton = new Navigation();

+ 5
- 6
lib/src/adapters/Element.tsx View File

2
 import * as PropTypes from 'prop-types';
2
 import * as PropTypes from 'prop-types';
3
 import { requireNativeComponent } from 'react-native';
3
 import { requireNativeComponent } from 'react-native';
4
 
4
 
5
-interface ElementProps {
6
-  elementId: PropTypes.Requireable<string>;
7
-  resizeMode: any;
8
-}
9
-
10
 let RNNElement: React.ComponentType<any>;
5
 let RNNElement: React.ComponentType<any>;
11
 
6
 
12
-export class Element extends React.Component<ElementProps, any> {
7
+export class Element extends React.Component<{
8
+  elementId: any;
9
+  resizeMode: any;
10
+}, any> {
11
+
13
   static propTypes = {
12
   static propTypes = {
14
     elementId: PropTypes.string.isRequired,
13
     elementId: PropTypes.string.isRequired,
15
     resizeMode: PropTypes.string
14
     resizeMode: PropTypes.string

+ 3
- 15
lib/src/commands/LayoutTreeCrawler.ts View File

9
   children: LayoutNode[];
9
   children: LayoutNode[];
10
 }
10
 }
11
 
11
 
12
-interface IdProvider {
13
-  generate: (str: string) => string;
14
-}
15
-
16
-interface Store {
17
-  setPropsForComponentId: (str: string, props: object) => void;
18
-  getOriginalComponentClassForName: (str: string) => any;
19
-}
20
-
21
 export class LayoutTreeCrawler {
12
 export class LayoutTreeCrawler {
22
-  private uniqueIdProvider: IdProvider;
23
-  private store: Store;
24
-
25
-  constructor(uniqueIdProvider: IdProvider, store: Store) {
26
-    this.uniqueIdProvider = uniqueIdProvider;
27
-    this.store = store;
13
+  constructor(
14
+    private readonly uniqueIdProvider: any,
15
+    private readonly store: any) {
28
     this.crawl = this.crawl.bind(this);
16
     this.crawl = this.crawl.bind(this);
29
   }
17
   }
30
 
18
 

+ 0
- 1
lib/src/globals.d.ts View File

1
-declare module 'react-native/Libraries/Image/resolveAssetSource';

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

1
-import { singleton } from './Navigation';
1
+import { Navigation as NavigationClass } from './Navigation';
2
+
3
+const singleton = new NavigationClass();
2
 
4
 
3
 export const Navigation = singleton;
5
 export const Navigation = singleton;

+ 2
- 1
tsconfig.json View File

5
     "allowJs": false,
5
     "allowJs": false,
6
     "target": "esnext",
6
     "target": "esnext",
7
     "module": "commonjs",
7
     "module": "commonjs",
8
-    "jsx": "react-native"
8
+    "jsx": "react-native",
9
+    "declaration": true
9
   },
10
   },
10
   "include": [
11
   "include": [
11
     "./lib/src/**/*"
12
     "./lib/src/**/*"