How to use the react-resizable.Resizable function in react-resizable

To help you get started, we’ve selected a few react-resizable examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github STRML / react-grid-layout / build / GridItem.js View on Github external
"use strict";
var React = require("react");
var cloneWithProps = require("react/lib/cloneWithProps");
var utils = require("./utils");
var Draggable = require("react-draggable");
var Resizable = require("react-resizable").Resizable;
var PureDeepRenderMixin = require("./mixins/PureDeepRenderMixin");

/**
 * An individual item within a ReactGridLayout.
 */
var GridItem = React.createClass({
  displayName: "GridItem",
  mixins: [PureDeepRenderMixin],

  propTypes: {
    // General grid attributes
    cols: React.PropTypes.number.isRequired,
    containerWidth: React.PropTypes.number.isRequired,
    rowHeight: React.PropTypes.number.isRequired,
    margin: React.PropTypes.array.isRequired,
github ucscXena / ucsc-xena-client / js / views / ResizeOverlay.js View on Github external
'use strict';

var React = require('react');
var Resizable = require('react-resizable').Resizable;
var _ = require('../underscore_ext');

// Styles
require('./ResizeOverlay.css');

var max = (x, y) => x > y ? x : y;
var minWidthSize = (minWidth, {width, height}) => ({width: max(minWidth, width), height});

class ResizeOverlay extends React.Component {
	state = {zooming: false};

	onResizeStart = () => {
		var {width, height} = this.props,
			minWidth = this.props.minWidth();
		this.setState({zooming: true, zoomSize: {width, height}, minWidth});
	};
github deranjer / goTorrent / goTorrentWebUI / node_modules / react-grid-layout / build / GridItem.js View on Github external
minW = _props6.minW,
        minH = _props6.minH,
        maxW = _props6.maxW,
        maxH = _props6.maxH;

    // This is the max possible width - doesn't go to infinity because of the width of the window

    var maxWidth = this.calcPosition(0, 0, cols - x, 0).width;

    // Calculate min/max constraints using our min & maxes
    var mins = this.calcPosition(0, 0, minW, minH);
    var maxes = this.calcPosition(0, 0, maxW, maxH);
    var minConstraints = [mins.width, mins.height];
    var maxConstraints = [Math.min(maxes.width, maxWidth), Math.min(maxes.height, Infinity)];
    return _react2.default.createElement(
      _reactResizable.Resizable,
      {
        width: position.width,
        height: position.height,
        minConstraints: minConstraints,
        maxConstraints: maxConstraints,
        onResizeStop: this.onResizeHandler("onResizeStop"),
        onResizeStart: this.onResizeHandler("onResizeStart"),
        onResize: this.onResizeHandler("onResize")
      },
      child
    );
  };

react-resizable

A component that is resizable with handles.

MIT
Latest version published 2 years ago

Package Health Score

76 / 100
Full package analysis

Popular react-resizable functions