Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: IPopupPickerProps path error #108

Merged
merged 2 commits into from
Apr 3, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ coverage
*.js
*.jsx
*.map
!tests/index.js
!tests/*.js
!/index*.js
ios/
android/
Expand Down
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ notifications:
- hust2012jiangkai@gmail.com

node_js:
- 6.9.1
- 10

before_install:
- |
Expand All @@ -34,4 +34,4 @@ env:

matrix:
allow_failures:
- env: "TEST_TYPE=saucelabs"
- env: "TEST_TYPE=saucelabs"
62 changes: 40 additions & 22 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,36 +43,54 @@
"prepublishOnly": "rc-tools run guard",
"pub": "rc-tools run pub --babel-runtime",
"lint": "rc-tools run lint --no-js-lint",
"karma": "rc-test run karma",
"saucelabs": "rc-test run saucelabs",
"test": "rc-test run test",
"chrome-test": "rc-test run chrome-test",
"coverage": "rc-test run coverage",
"test": "jest",
"coverage": "npm run test -- --coverage",
"rn-start": "node node_modules/react-native/local-cli/cli.js start",
"rn-init": "rc-tools run react-native-init"
"rn-init": "rc-tools run react-native-init",
"tsc": "tsc -d"
},
"jest": {
"setupFiles": [
"./tests/setup.js"
],
"testMatch": [
"**/?(*.)(spec|test).ts?(x)"
],
"coverageDirectory": "./coverage/",
"moduleFileExtensions": [
"ts",
"tsx",
"js"
],
"collectCoverageFrom": [
"src/**/*"
],
"transform": {
"\\.tsx?$": "./node_modules/rc-tools/scripts/jestPreprocessor.js",
"\\.jsx?$": "./node_modules/rc-tools/scripts/jestPreprocessor.js"
}
},
"dependencies": {
"babel-runtime": "6.x",
"classnames": "^2.2.0",
"classnames": "^2.2.6",
"rmc-feedback": "^2.0.0",
"rmc-dialog": "^1.0.1"
"rmc-dialog": "^1.1.1"
},
"devDependencies": {
"@types/classnames": "^2.2.3",
"@types/mocha": "~2.2.32",
"@types/react": "^16.0.0",
"@types/react-dom": "^16.0.5",
"@types/react-native": "^0.55.12",
"array-tree-filter": "1.x",
"expect.js": "0.3.x",
"fastclick": "^1.0.6",
"@types/classnames": "^2.2.7",
"@types/enzyme": "^3.9.1",
"@types/react": "^16.8.10",
"@types/react-dom": "^16.8.3",
"@types/react-native": "^0.57.42",
"enzyme": "^3.9.0",
"enzyme-adapter-react-16": "^1.11.2",
"jest": "^24.5.0",
"pre-commit": "1.x",
"rc-test": "6.x",
"rc-tools": "6.x",
"react": "15.5.x",
"react-dom": "15.5.x",
"react-native": "~0.42.0",
"react-native-index-page": "~0.2.1"
"rc-tools": "9.x",
"react": "16.x",
"react-dom": "16.x",
"react-native": "~0.59.3",
"react-native-index-page": "~2.0.0"
},
"typings": "./lib/index.d.ts",
"pre-commit": [
Expand Down
2 changes: 1 addition & 1 deletion src/MultiPicker.native.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import MultiPickerProps from './MultiPickerProps';
import MultiPickerMixin from './MultiPickerMixin';

export interface IMultiPickerProp {
getValue: Function;
getValue: () => any;
}

const MultiPicker = (props: IMultiPickerProp & MultiPickerProps) => {
Expand Down
4 changes: 2 additions & 2 deletions src/MultiPicker.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import * as React from 'react';
import * as classnames from 'classnames';
import classnames from 'classnames';
import MultiPickerProps from './MultiPickerProps';
import MultiPickerMixin from './MultiPickerMixin';

export interface IMultiPickerProp {
getValue: Function;
getValue: () => any;
}

const MultiPicker = (props: IMultiPickerProp & MultiPickerProps) => {
Expand Down
4 changes: 2 additions & 2 deletions src/NativePicker.android.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ const styles = StyleSheet.create({
});

export interface IPickerProp {
select: Function;
doScrollingComplete: Function;
select: (...arg) => void;
doScrollingComplete: (...arg) => void;
}

class Picker extends React.Component<IPickerProp & IPickerProps, any> {
Expand Down
10 changes: 5 additions & 5 deletions src/Picker.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import * as React from 'react';
import * as classNames from 'classnames';
import classNames from 'classnames';
import { IPickerProps } from './PickerTypes';
import PickerMixin from './PickerMixin';

type IPickerProp = {
select: Function;
doScrollingComplete: Function;
computeChildIndex: Function;
export interface IPickerProp {
select: (...arg) => void;
doScrollingComplete: (...arg) => void;
computeChildIndex: (...arg) => number;
};

class Picker extends React.Component<IPickerProp & IPickerProps, any> {
Expand Down
3 changes: 2 additions & 1 deletion src/PickerMixin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
import * as React from 'react';
import { IPickerProps } from './PickerTypes';

type IItemProps = {
export interface IItemProps {
className?: string;
value: any;
children?: React.ReactNode;
};

const Item = (_props: IItemProps) => null;
Expand Down
2 changes: 1 addition & 1 deletion src/PickerTypes.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export type IPickerProps = {
export interface IPickerProps {
disabled?: boolean;
selectedValue?: any;
onValueChange?: (value: any) => void;
Expand Down
1 change: 0 additions & 1 deletion src/Popup.native.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import * as React from 'react';
import { View, TouchableHighlight, Text } from 'react-native';
import PopupMixin from './PopupMixin';
import { IPopupPickerProps } from './PopupPickerTypes';
import Modal from 'rmc-dialog/lib/Modal';

const getModal = (props, visible, { getContent, hide, onDismiss, onOk }) => {
Expand Down
4 changes: 2 additions & 2 deletions src/Popup.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import * as React from 'react';
import Modal from 'rmc-dialog';
import PopupMixin from './PopupMixin';
import { IPopupPickerProps } from './PopupPickerTypes';
import Touchable from 'rmc-feedback';
// import { IPopupPickerProps } from './PopupPickerTypes';

const getModal = (props, visible, { getContent, hide, onDismiss, onOk }) => {
if (!visible) {
Expand All @@ -13,7 +13,7 @@ const getModal = (props, visible, { getContent, hide, onDismiss, onOk }) => {
<Modal
prefixCls={`${prefixCls}`}
className={props.className || ''}
visible
visible={true}
closable={false}
transitionName={props.transitionName || props.popupTransitionName}
maskTransitionName={props.maskTransitionName}
Expand Down
2 changes: 1 addition & 1 deletion src/PopupPickerTypes.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react';

export type IPopupPickerProps = {
export interface IPopupPickerProps {
picker?: any;
value?: any;
triggerType?: string;
Expand Down
3 changes: 3 additions & 0 deletions tests/__snapshots__/basic.test.tsx.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`basic classnames 1`] = `"<div class=\\"rmc-picker\\"><div class=\\"rmc-picker-mask\\"></div><div class=\\"rmc-picker-indicator \\"></div><div class=\\"rmc-picker-content\\"><div class=\\"rmc-picker-item rmc-picker-item-selected \\">a</div><div class=\\"rmc-picker-item \\">b</div></div></div>"`;
19 changes: 19 additions & 0 deletions tests/basic.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { render } from 'enzyme';
import { html } from 'cheerio'
import * as React from 'react';
import Picker from '../src';

describe('basic', () => {
it('classnames', () => {
const wrapper = render(
<Picker noAnimate={true}>
<Picker.Item value="1">a</Picker.Item>
<Picker.Item value="2">b</Picker.Item>
</Picker>
);

expect(html(wrapper)).toMatchSnapshot();

expect(wrapper.hasClass('rmc-picker')).toBeTruthy();
})
});
1 change: 0 additions & 1 deletion tests/index.js

This file was deleted.

4 changes: 4 additions & 0 deletions tests/setup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
const Enzyme = require('enzyme');
const Adapter = require('enzyme-adapter-react-16');

Enzyme.configure({ adapter: new Adapter() });
53 changes: 0 additions & 53 deletions tests/usage.tsx

This file was deleted.

10 changes: 7 additions & 3 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
{
"compilerOptions": {
"strictNullChecks": true,
"strictNullChecks": false,
"moduleResolution": "node",
"jsx": "preserve",
"target": "es6",
"skipLibCheck": true
"noImplicitAny": false,
"noUnusedLocals": true,
"baseUrl": "src",
"skipLibCheck": true,
"allowSyntheticDefaultImports": true
}
}
}
10 changes: 10 additions & 0 deletions tslint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": "rc-tools/config/tslint.json",
"rules": {
"member-access": [true, "no-public"],
"variable-name": [false],
"ordered-imports": [false],
"no-this-assignment": [false],
"no-empty": [false]
}
}
Empty file removed typings/custom.d.ts
Empty file.
1 change: 0 additions & 1 deletion typings/index.d.ts

This file was deleted.