Quellcode durchsuchen

declaration files

Daniel Zlotin vor 6 Jahren
Ursprung
Commit
d391acb715

+ 1
- 3
lib/src/Navigation.ts Datei anzeigen

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

+ 5
- 6
lib/src/adapters/Element.tsx Datei anzeigen

@@ -2,14 +2,13 @@ import * as React from 'react';
2 2
 import * as PropTypes from 'prop-types';
3 3
 import { requireNativeComponent } from 'react-native';
4 4
 
5
-interface ElementProps {
6
-  elementId: PropTypes.Requireable<string>;
7
-  resizeMode: any;
8
-}
9
-
10 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 12
   static propTypes = {
14 13
     elementId: PropTypes.string.isRequired,
15 14
     resizeMode: PropTypes.string

+ 3
- 15
lib/src/commands/LayoutTreeCrawler.ts Datei anzeigen

@@ -9,22 +9,10 @@ export interface LayoutNode {
9 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 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 16
     this.crawl = this.crawl.bind(this);
29 17
   }
30 18
 

+ 0
- 1
lib/src/globals.d.ts Datei anzeigen

@@ -1 +0,0 @@
1
-declare module 'react-native/Libraries/Image/resolveAssetSource';

+ 3
- 1
lib/src/index.ts Datei anzeigen

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

+ 2
- 1
tsconfig.json Datei anzeigen

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