Merge pull request #26070 from fsubal/fix/react-rnd

[react-rnd] Mistakenly typed react-rnd enableResizing, & added disableDragging
This commit is contained in:
Benjamin Lichtman
2018-05-31 15:42:29 -07:00
committed by GitHub
2 changed files with 22 additions and 3 deletions
+15 -2
View File
@@ -1,6 +1,7 @@
// Type definitions for react-rnd 7.3
// Type definitions for react-rnd 7.4
// Project: https://github.com/bokuweb/react-rnd
// Definitions by: Ragg <https://github.com/Ragg->
// fsubal <https://github.com/fsubal>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.6
import React = require('react');
@@ -18,6 +19,17 @@ declare namespace Rnd {
| 'topLeft'
| 'topRight';
interface Enable {
bottom?: boolean;
bottomLeft?: boolean;
bottomRight?: boolean;
left?: boolean;
right?: boolean;
top?: boolean;
topLeft?: boolean;
topRight?: boolean;
}
interface HandleClasses {
bottom?: string;
bottomLeft?: string;
@@ -90,7 +102,8 @@ declare namespace Rnd {
resizeHandleStyles: HandleStyles;
lockAspectRatio: boolean;
enableResizing: boolean;
enableResizing?: Enable;
disableDragging?: boolean;
onResizeStart: () => void;
onResize: () => void;
+7 -1
View File
@@ -13,7 +13,13 @@ const onResize: Rnd.ResizeHandler = (e, direction, ref, delta, position) => {
className="class"
lockAspectRatio
maxWidth={100}
enableResizing={false}
enableResizing={{
bottom: true,
bottomLeft: true,
bottomRight: false,
left: false
}}
disableDragging={false}
resizeHandleStyles={{
top: { background: '#000' }
}}