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..856c5f1 100644 --- a/package.json +++ b/package.json @@ -72,9 +72,9 @@ "@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", "jest": "^20.0.4", "enzyme": "^2.9.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