Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

react-split-pane cannot resize

I just installed react-split-pane in my application, but it does not seem to work.

I'm using react-split-pane version 0.1.68 but I tested it with 0.1.66 and 0.1.64 as well.

This is my component:

import React, { Component } from 'react';
import SplitPane from 'react-split-pane';

class Edit extends Component {
  render() {
    return (
        <SplitPane split="vertical">
            <div style={{backgroundColor: 'red'}}>LEFT</div>
            <div style={{backgroundColor: 'blue'}}>RIGHT</div>
        </SplitPane>
    );
  }
}

export default Edit;

I end up with a component that looks like I how styled it, but dragging between the elements to resize the width of the elements does not work.

enter image description here

What am I missing here?

Ps this issue might be related to it, but I tried previous versions and they don't seem to work either.

like image 772
Sventies Avatar asked Nov 09 '17 13:11

Sventies


People also ask

How to use splitpane React component?

Split-Pane React component, can be nested or split vertically or horizontally! By dragging 'draggable' surface you can change size of the first pane. The first pane keeps then its size while the second pane is resized by browser window. By default it is the left pane for 'vertical' SplitPane and the top pane for 'horizontal' SplitPane.

How to sortable and resizable pane component for react?

Sortable and resizable pane component for react. The className property is used to set the css classname of a component. The style property is used to set the style of a component. The direction property is used to set the direction of a component. If omitted the default direction is 'horizontal'.

How to change the size of the split-pane?

By dragging 'draggable' surface you can change size of the first pane. The first pane keeps then its size while the second pane is resized by browser window. By default it is the left pane for 'vertical' SplitPane and the top pane for 'horizontal' SplitPane.

What are resizable split panels in CodePen?

That's a lot to fit on one screen, but I knew CodePen was already solving a similar design challenge with resizable split panels in their online code editor. The resizable panels are a simple concept that allows users to create more space for themselves by increasing or decreasing the size of panels using a draggable gutter.


1 Answers

I had a similar problem. The reason why divider doesn't work is: missing CSS

Add CSS from tutorial: https://github.com/tomkp/react-split-pane#example-styling to your react component. For example:

import './edit.css';

Your dragging element will work. enter image description here

like image 193
35 revs, 24 users 34% Avatar answered Oct 06 '22 07:10

35 revs, 24 users 34%