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:
Saviio
2017-03-10 14:07:33 +08:00
committed by Mohamed Hegazy
parent 8d1b4a6eb1
commit 123ff1c182
2 changed files with 7 additions and 3 deletions

View File

@@ -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;

View File

@@ -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} />;
}
}