mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-12-04 12:11:47 +00:00
Test typings for 0.6.3 update
This commit is contained in:
@@ -35,21 +35,38 @@ const SortableList = ReactSortableHOC.SortableContainer((props: SortableListProp
|
||||
class SortableComponent extends React.Component<{}, SortableComponentState> {
|
||||
private _onSortEnd: ReactSortableHOC.SortEndHandler;
|
||||
|
||||
private _handleSotEnd(sort: ReactSortableHOC.SortEnd, event: ReactSortableHOC.SortEvent): void {
|
||||
private _handleSortEnd(sort: ReactSortableHOC.SortEnd, event: ReactSortableHOC.SortEvent): void {
|
||||
this.setState({items: ReactSortableHOC.arrayMove(this.state.items, sort.oldIndex, sort.newIndex)});
|
||||
}
|
||||
|
||||
private _getHelperDimensions(sort: ReactSortableHOC.SortStart): ReactSortableHOC.Dimensions {
|
||||
if (sort.node instanceof HTMLElement) {
|
||||
return ({
|
||||
width: sort.node.offsetWidth,
|
||||
height: sort.node.offsetHeight
|
||||
});
|
||||
}
|
||||
return {width: 0, height: 0};
|
||||
}
|
||||
|
||||
public constructor() {
|
||||
super();
|
||||
this.state = {
|
||||
items: ['Item 1', 'Item 2', 'Item 3', 'Item 4', 'Item 5', 'Item 6'],
|
||||
axis: 'x'
|
||||
};
|
||||
this._onSortEnd = this._handleSotEnd.bind(this);
|
||||
this._onSortEnd = this._handleSortEnd.bind(this);
|
||||
}
|
||||
|
||||
public render(): JSX.Element {
|
||||
return <SortableList items={this.state.items} axis={this.state.axis} onSortEnd={this._onSortEnd} />;
|
||||
return <SortableList
|
||||
items={this.state.items}
|
||||
axis={this.state.axis}
|
||||
pressThreshold={5}
|
||||
distance={100}
|
||||
onSortEnd={this._onSortEnd}
|
||||
getHelperDimensions={this._getHelperDimensions}
|
||||
/>;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user