From 832742747081630c3f69ace499e3323a34941eeb Mon Sep 17 00:00:00 2001 From: duxiaodong Date: Thu, 21 Jun 2018 17:35:09 +0800 Subject: [PATCH 1/2] feat: remove allowSyntheticDefaultImports --- .npmrc | 1 + examples/basic.tsx | 4 ++-- examples/react-native/basic.tsx | 2 +- examples/react-native/scrolltabbar.tsx | 2 +- examples/scroll-tab.tsx | 4 ++-- examples/single-content.tsx | 4 ++-- examples/sticky.tsx | 4 ++-- examples/vertical.tsx | 4 ++-- package.json | 8 ++++---- src/DefaultTabBar.native.tsx | 4 ++-- src/DefaultTabBar.tsx | 2 +- src/TabPane.native.tsx | 5 +++-- src/TabPane.tsx | 2 +- src/Tabs.base.tsx | 2 +- src/Tabs.native.tsx | 6 +++--- src/Tabs.tsx | 2 +- tests/Tabs.spec.tsx | 2 +- tsconfig.json | 4 ++-- 18 files changed, 32 insertions(+), 30 deletions(-) create mode 100644 .npmrc diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000..43c97e7 --- /dev/null +++ b/.npmrc @@ -0,0 +1 @@ +package-lock=false diff --git a/examples/basic.tsx b/examples/basic.tsx index fbff88e..a7afee4 100644 --- a/examples/basic.tsx +++ b/examples/basic.tsx @@ -2,8 +2,8 @@ import 'rmc-tabs/assets/index.less'; -import React from 'react'; -import ReactDOM from 'react-dom'; +import * as React from 'react'; +import * as ReactDOM from 'react-dom'; import { Models, Tabs, DefaultTabBar } from '../src'; class BasicDemo extends React.Component<{}, any> { diff --git a/examples/react-native/basic.tsx b/examples/react-native/basic.tsx index 540e870..2ae87a2 100644 --- a/examples/react-native/basic.tsx +++ b/examples/react-native/basic.tsx @@ -2,7 +2,7 @@ /* tslint:disable:no-console */ import { View, ScrollView, Text } from 'react-native'; import { Tabs, Models } from '../../src'; -import React from 'react'; +import * as React from 'react'; const renderContent = (tab: Models.TabData, index: number) => diff --git a/examples/react-native/scrolltabbar.tsx b/examples/react-native/scrolltabbar.tsx index d110241..99bea7c 100644 --- a/examples/react-native/scrolltabbar.tsx +++ b/examples/react-native/scrolltabbar.tsx @@ -2,7 +2,7 @@ /* tslint:disable:no-console */ import { View, ScrollView, Text } from 'react-native'; import { Tabs, Models } from '../../src'; -import React from 'react'; +import * as React from 'react'; const renderContent = (tab: Models.TabData, index: number) => diff --git a/examples/scroll-tab.tsx b/examples/scroll-tab.tsx index 2fa3e86..ef00611 100644 --- a/examples/scroll-tab.tsx +++ b/examples/scroll-tab.tsx @@ -2,8 +2,8 @@ import 'rmc-tabs/assets/index.less'; -import React from 'react'; -import ReactDOM from 'react-dom'; +import * as React from 'react'; +import * as ReactDOM from 'react-dom'; import { Tabs, DefaultTabBar } from '../src'; const tabData = [ diff --git a/examples/single-content.tsx b/examples/single-content.tsx index 9c7c39b..f1d2fca 100644 --- a/examples/single-content.tsx +++ b/examples/single-content.tsx @@ -2,8 +2,8 @@ import 'rmc-tabs/assets/index.less'; -import React from 'react'; -import ReactDOM from 'react-dom'; +import * as React from 'react'; +import * as ReactDOM from 'react-dom'; import { Models, Tabs } from '../src'; const tabData = [ diff --git a/examples/sticky.tsx b/examples/sticky.tsx index 196abbb..6fa0487 100644 --- a/examples/sticky.tsx +++ b/examples/sticky.tsx @@ -2,8 +2,8 @@ import 'rmc-tabs/assets/index.less'; -import React from 'react'; -import ReactDOM from 'react-dom'; +import * as React from 'react'; +import * as ReactDOM from 'react-dom'; import { StickyContainer, Sticky } from 'react-sticky'; import { Tabs, DefaultTabBar } from '../src'; diff --git a/examples/vertical.tsx b/examples/vertical.tsx index 92504bc..32ecb72 100644 --- a/examples/vertical.tsx +++ b/examples/vertical.tsx @@ -2,8 +2,8 @@ import 'rmc-tabs/assets/index.less'; -import React from 'react'; -import ReactDOM from 'react-dom'; +import * as React from 'react'; +import * as ReactDOM from 'react-dom'; import { Tabs } from '../src'; class BasicDemo extends React.Component<{}, { diff --git a/package.json b/package.json index 579300e..6e0261a 100644 --- a/package.json +++ b/package.json @@ -65,17 +65,17 @@ } }, "dependencies": { - "babel-runtime": "6.x", "rc-gesture": "~0.0.18" }, "devDependencies": { "@types/enzyme": "^2.8.6", "@types/enzyme-to-json": "^1.5.0", "@types/jest": "^20.0.7", - "@types/react": "^15.5.0", - "@types/react-dom": "^15.5.0", - "@types/react-native": "^0.46.9", + "@types/react": "^16.0.0", + "@types/react-dom": "^16.0.0", + "@types/react-native": "^0.55.0", "@types/react-sticky": "^6.0.0", + "babel-runtime": "6.x", "jest": "^20.0.4", "enzyme": "^2.9.1", "enzyme-to-json": "^1.5.1", diff --git a/src/DefaultTabBar.native.tsx b/src/DefaultTabBar.native.tsx index 405cdd1..8562d86 100644 --- a/src/DefaultTabBar.native.tsx +++ b/src/DefaultTabBar.native.tsx @@ -1,6 +1,6 @@ -import React from 'react'; +import * as React from 'react'; +import * as RN from 'react-native'; import { - default as RN, Animated, Dimensions, Platform, diff --git a/src/DefaultTabBar.tsx b/src/DefaultTabBar.tsx index abe6e6a..fb4b12f 100644 --- a/src/DefaultTabBar.tsx +++ b/src/DefaultTabBar.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import * as React from 'react'; import Gesture, { IGestureStatus } from 'rc-gesture'; import { Models } from './Models'; import { TabBarPropsType } from './PropsType'; diff --git a/src/TabPane.native.tsx b/src/TabPane.native.tsx index 92dad02..3383d3b 100644 --- a/src/TabPane.native.tsx +++ b/src/TabPane.native.tsx @@ -1,5 +1,6 @@ -import React from 'react'; -import { default as RN, View } from 'react-native'; +import * as React from 'react'; +import * as RN from 'react-native'; +import { View } from 'react-native'; export interface PropsType { key?: string; diff --git a/src/TabPane.tsx b/src/TabPane.tsx index 458f410..c5921b4 100644 --- a/src/TabPane.tsx +++ b/src/TabPane.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import * as React from 'react'; import { getPxStyle, getTransformPropValue } from './util'; export interface PropsType { diff --git a/src/Tabs.base.tsx b/src/Tabs.base.tsx index ce17cf2..3380d79 100644 --- a/src/Tabs.base.tsx +++ b/src/Tabs.base.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import * as React from 'react'; import { PropsType } from './PropsType'; import { Models } from './Models'; diff --git a/src/Tabs.native.tsx b/src/Tabs.native.tsx index c0a5b80..42cae85 100644 --- a/src/Tabs.native.tsx +++ b/src/Tabs.native.tsx @@ -1,6 +1,6 @@ -import React from 'react'; +import * as React from 'react'; +import * as RN from 'react-native'; import { - default as RN, Dimensions, View, Animated, @@ -31,7 +31,7 @@ export class Tabs extends Component { style: {}, } as PropsType; - AnimatedScrollView: ScrollView = Animated.createAnimatedComponent(ScrollView); + AnimatedScrollView: typeof ScrollView = Animated.createAnimatedComponent(ScrollView); scrollView: { _component: ScrollView }; constructor(props: PropsType) { diff --git a/src/Tabs.tsx b/src/Tabs.tsx index 25f05b1..a71ee6b 100644 --- a/src/Tabs.tsx +++ b/src/Tabs.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import * as React from 'react'; import Gesture, { IGestureStatus } from 'rc-gesture'; import { PropsType as BasePropsType, TabBarPropsType } from './PropsType'; import { TabPane } from './TabPane'; diff --git a/tests/Tabs.spec.tsx b/tests/Tabs.spec.tsx index 5b88ef7..31aac58 100644 --- a/tests/Tabs.spec.tsx +++ b/tests/Tabs.spec.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import * as React from 'react'; import { render } from 'enzyme'; import renderToJson from 'enzyme-to-json'; import { Tabs, Models } from '../src'; diff --git a/tsconfig.json b/tsconfig.json index 464e229..bab8c44 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -3,9 +3,9 @@ "strictNullChecks": true, "moduleResolution": "node", "jsx": "preserve", - "allowSyntheticDefaultImports": true, "target": "es6", "noImplicitAny": true, - "noUnusedLocals": true + "noUnusedLocals": true, + "skipLibCheck": true } } \ No newline at end of file From 7f61ee6cd9b21f4f804ea8aab7efd72ee2c75fd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AF=92=E6=9E=AD=E4=B8=9C?= Date: Wed, 27 Jun 2018 10:48:24 +0800 Subject: [PATCH 2/2] Update package.json --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 6e0261a..856c5f1 100644 --- a/package.json +++ b/package.json @@ -65,6 +65,7 @@ } }, "dependencies": { + "babel-runtime": "6.x", "rc-gesture": "~0.0.18" }, "devDependencies": { @@ -75,7 +76,6 @@ "@types/react-dom": "^16.0.0", "@types/react-native": "^0.55.0", "@types/react-sticky": "^6.0.0", - "babel-runtime": "6.x", "jest": "^20.0.4", "enzyme": "^2.9.1", "enzyme-to-json": "^1.5.1",