Daniel Zlotin пре 7 година
родитељ
комит
3ee6634e71
6 измењених фајлова са 62 додато и 32 уклоњено
  1. 2
    1
      lib/src/Navigation.js
  2. 0
    20
      lib/src/adapters/Element.js
  3. 28
    0
      lib/src/adapters/Element.tsx
  4. 5
    5
      package.json
  5. 22
    0
      tsconfig-strict.json
  6. 5
    6
      tsconfig.json

+ 2
- 1
lib/src/Navigation.js Прегледај датотеку

8
 const LayoutTreeCrawler = require('./commands/LayoutTreeCrawler');
8
 const LayoutTreeCrawler = require('./commands/LayoutTreeCrawler');
9
 const PrivateEventsListener = require('./events/PrivateEventsListener');
9
 const PrivateEventsListener = require('./events/PrivateEventsListener');
10
 const PublicEventsRegistry = require('./events/PublicEventsRegistry');
10
 const PublicEventsRegistry = require('./events/PublicEventsRegistry');
11
-const Element = require('./adapters/Element');
11
+
12
+import { Element } from './adapters/Element';
12
 
13
 
13
 /** @constructor */
14
 /** @constructor */
14
 class Navigation {
15
 class Navigation {

+ 0
- 20
lib/src/adapters/Element.js Прегледај датотеку

1
-import * as React from 'react';
2
-import * as PropTypes from 'prop-types';
3
-import { requireNativeComponent } from 'react-native';
4
-
5
-class Element extends React.Component {
6
-  render() {
7
-    return <RNNElement {...this.props} />;
8
-  }
9
-}
10
-
11
-Element.propTypes = {
12
-  elementId: PropTypes.string.isRequired,
13
-  resizeMode: PropTypes.string
14
-};
15
-Element.defaultProps = {
16
-  resizeMode: ''
17
-};
18
-const RNNElement = requireNativeComponent('RNNElement', Element);
19
-
20
-module.exports = Element;

+ 28
- 0
lib/src/adapters/Element.tsx Прегледај датотеку

1
+import * as React from 'react';
2
+import * as PropTypes from 'prop-types';
3
+import { requireNativeComponent } from 'react-native';
4
+
5
+interface ElementProps {
6
+  elementId: any;
7
+  resizeMode: any;
8
+}
9
+
10
+let RNNElement: React.ComponentClass;
11
+
12
+export class Element extends React.Component<ElementProps, object> {
13
+  static propTypes = {
14
+    elementId: PropTypes.string.isRequired,
15
+    resizeMode: PropTypes.string
16
+  }
17
+  static defaultProps = {
18
+    resizeMode: ''
19
+  }
20
+
21
+  render() {
22
+    return (
23
+      <RNNElement {...this.props} />
24
+    );
25
+  }
26
+}
27
+
28
+RNNElement = requireNativeComponent('RNNElement', Element);

+ 5
- 5
package.json Прегледај датотеку

49
   },
49
   },
50
   "dependencies": {
50
   "dependencies": {
51
     "lodash": "4.x.x",
51
     "lodash": "4.x.x",
52
-    "prop-types": "15.x.x"
52
+    "prop-types": "15.x.x",
53
+    "tslib": "1.x.x"
53
   },
54
   },
54
   "devDependencies": {
55
   "devDependencies": {
55
     "detox": "6.x.x",
56
     "detox": "6.x.x",
57
     "eslint-config-xo-react": "0.13.x",
58
     "eslint-config-xo-react": "0.13.x",
58
     "eslint-plugin-react": "7.x.x",
59
     "eslint-plugin-react": "7.x.x",
59
     "jest": "22.x.x",
60
     "jest": "22.x.x",
60
-    "jsdoc": "3.x.x",
61
-    "jsdoc-to-markdown": "3.x.x",
62
     "mocha": "4.x.x",
61
     "mocha": "4.x.x",
63
     "react": "16.0.0-beta.5",
62
     "react": "16.0.0-beta.5",
64
     "react-native": "0.49.x",
63
     "react-native": "0.49.x",
72
     "typescript": "2.x.x",
71
     "typescript": "2.x.x",
73
     "@types/react": "16.0.0",
72
     "@types/react": "16.0.0",
74
     "@types/react-native": "0.49.x",
73
     "@types/react-native": "0.49.x",
75
-    "@types/jest": "22.x.x",
74
+    "@types/lodash": "4.x.x",
76
     "@types/prop-types": "15.x.x",
75
     "@types/prop-types": "15.x.x",
77
-    "@types/react-test-renderer": "16.0.0"
76
+    "@types/react-test-renderer": "16.0.0",
77
+    "@types/jest": "22.x.x"
78
   },
78
   },
79
   "babel": {
79
   "babel": {
80
     "env": {
80
     "env": {

+ 22
- 0
tsconfig-strict.json Прегледај датотеку

1
+{
2
+  "$schema": "http://json.schemastore.org/tsconfig",
3
+  "compilerOptions": {
4
+    "allowSyntheticDefaultImports": false,
5
+    "allowUnreachableCode": false,
6
+    "allowUnusedLabels": false,
7
+    "alwaysStrict": true,
8
+    "diagnostics": true,
9
+    "forceConsistentCasingInFileNames": true,
10
+    "importHelpers": true,
11
+    "noEmitOnError": true,
12
+    "noFallthroughCasesInSwitch": true,
13
+    "noImplicitAny": true,
14
+    "noImplicitReturns": true,
15
+    "noImplicitThis": true,
16
+    "noUnusedLocals": true,
17
+    "noUnusedParameters": true,
18
+    "pretty": true,
19
+    "strictFunctionTypes": false,
20
+    "strictNullChecks": true
21
+  }
22
+}

+ 5
- 6
tsconfig.json Прегледај датотеку

1
 {
1
 {
2
+  "extends": "./tsconfig-strict",
2
   "compilerOptions": {
3
   "compilerOptions": {
3
     "outDir": "./lib/dist",
4
     "outDir": "./lib/dist",
4
     "allowJs": true,
5
     "allowJs": true,
5
     "target": "esnext",
6
     "target": "esnext",
6
     "module": "commonjs",
7
     "module": "commonjs",
7
-    "jsx": "preserve",
8
-    "noEmitOnError": true,
9
-    "noImplicitReturns": true,
10
-    "noFallthroughCasesInSwitch": true,
11
-    "alwaysStrict": true,
12
-    "strictNullChecks": true,
8
+    "jsx": "react-native",
13
     "types": [
9
     "types": [
10
+      "lodash",
14
       "react",
11
       "react",
15
       "react-native",
12
       "react-native",
13
+      "prop-types",
14
+      "react-test-renderer",
16
       "jest"
15
       "jest"
17
     ]
16
     ]
18
   },
17
   },