mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-23 21:00:01 +08:00
fix type Axis (#14973)
Now `SortableContainer` allow to receive Axis with 'xy', Please see https://github.com/clauderic/react-sortable-hoc/blob/master/src/SortableContainer/index.js#L53.
This commit is contained in:
2
react-sortable-hoc/index.d.ts
vendored
2
react-sortable-hoc/index.d.ts
vendored
@@ -7,7 +7,7 @@
|
||||
declare module 'react-sortable-hoc' {
|
||||
import React = require('react');
|
||||
|
||||
export type Axis = 'x' | 'y';
|
||||
export type Axis = 'x' | 'y' | 'xy';
|
||||
|
||||
export type Offset = number | string;
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ interface SortableItemProps {
|
||||
|
||||
interface SortableListProps {
|
||||
items: Array<string>;
|
||||
axis: 'x' | 'y' | 'xy'
|
||||
}
|
||||
|
||||
type SortableComponentState = SortableListProps;
|
||||
@@ -40,12 +41,15 @@ class SortableComponent extends React.Component<void, SortableComponentState> {
|
||||
|
||||
public constructor() {
|
||||
super();
|
||||
this.state = { items: ['Item 1', 'Item 2', 'Item 3', 'Item 4', 'Item 5', 'Item 6'] };
|
||||
this.state = {
|
||||
items: ['Item 1', 'Item 2', 'Item 3', 'Item 4', 'Item 5', 'Item 6'],
|
||||
axis: 'x'
|
||||
};
|
||||
this._onSortEnd = this._handleSotEnd.bind(this);
|
||||
}
|
||||
|
||||
public render(): JSX.Element {
|
||||
return <SortableList items={this.state.items} onSortEnd={this._onSortEnd} />;
|
||||
return <SortableList items={this.state.items} axis={this.state.axis} onSortEnd={this._onSortEnd} />;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user