React-sortable-hoc: When I drag an element, the list disappears (JSFiddle included)

Created on 24 Aug 2017  路  2Comments  路  Source: clauderic/react-sortable-hoc

Hi there. No matter what I do, once I drag an element from the list, the rest of the list seems to disappear. I googled a solution and there are some issues if it's on a Modal, but my code is not in a modal. I did try setting the z-index really high but that didn't work either.

Is this a known issue? The rest of the list disappears not after I mouse down click the element, but the second i drag it, the rest of the list disappears.

FIDDLE: https://jsfiddle.net/40vpaLj5/

import React from 'react';
import PlaylistPages from './PlaylistPages';

class PlaylistSortableComponent extends React.Component {
  constructor(props, context) {
    super(props, context);

    this.state = {
      test: [
        '1','2', '3', '4'
      ]
    }
  }

  render() {
    return (
      <PlaylistPages pages={this.state.test} style={{zIndex: 999999}} />
    );
  }
}

export default PlaylistSortableComponent;


const PlaylistPages = SortableContainer(({pages}) => {
  return (
    <div>
      {
        pages.map((page, index) =>
          <PlaylistPage key={index} page={page} style={{zIndex: 99999999}} />
      )}
    </div>
  );
});

export default PlaylistPages;

const PlaylistPage = SortableElement(({page}) => {
  return (
    <div style={{zIndex: 99999999}} >{page}</div>
  );
});

Most helpful comment

Make sure that you have the index prop specified.
<Stage key={item-${index}} index={index}/>

All 2 comments

What was the solution to this?

Make sure that you have the index prop specified.
<Stage key={item-${index}} index={index}/>

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Sir4ur0n picture Sir4ur0n  路  3Comments

ashishtechuz picture ashishtechuz  路  4Comments

zaygraveyard picture zaygraveyard  路  3Comments

ccharliemagne picture ccharliemagne  路  3Comments

suhaotian picture suhaotian  路  3Comments