Skip to content

The selection box does not appear when you drag the mouse? #26

@HsienW

Description

@HsienW

When the mouse is dragged selection box does not appear but the console.log will appear normally

Here is my test code:

import React from 'react';
import {SelectableGroup} from 'react-selectable-fast';
import MenuExampluItem from './MenuExampluItem';

const array = [
    {
        name: '123',
        key: 1
    },
    {
        name: '456',
        key: 2
    },
    {
        name: '888',
        key: 3
    },
    {
        name: '777',
        key: 4
    }
];
export default class MenuExampleNested extends React.Component {
    constructor() {
        super();
        this.state = {
            isGlobal: true
        };
    }

    handleSelecting() {
        console.log('Drag');
    }

    handleSelectionClear() {
        console.log('Clear');
    }

    handleSelectionFinish() {
        console.log('Finish');
    }

    render() {

        return (
            <SelectableGroup
                allowClickWithoutSelected={false}
                duringSelection={this.handleSelecting}
                onSelectionClear={this.handleSelectionClear}
                onSelectionFinish={this.handleSelectionFinish}
                className="app-test"
                clickClassName="tick"
                globalMouse={true}
            >
                {
                    array.map((Obj) => {
                        return (
                            <MenuExampluItem
                                key={Obj.key}
                                name={Obj.name}
                            />
                        );
                    })
                }
            </SelectableGroup>
        );
    }
}

import React from 'react';
import Paper from 'material-ui/Paper';
import Menu from 'material-ui/Menu';
import MenuItem from 'material-ui/MenuItem';
import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider';
import {createSelectable} from 'react-selectable-fast';

const MenuExampluItem = ({selectableRef, name}) => {
    return (
        <div ref={selectableRef}>
            <MuiThemeProvider>
                <Paper style={{width: '300px'}}>
                    <Menu>
                        <MenuItem primaryText={name} disabled={true}/>
                    </Menu>
                </Paper>
            </MuiThemeProvider>
        </div>
    );
};

export default createSelectable(MenuExampluItem)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions