MrBlenny / react-flow-chart

🌊 A flexible, stateless, declarative flow chart library for react.
https://mrblenny.github.io/react-flow-chart/index.html
MIT License
1.46k stars 307 forks source link

event callbacks dont work with .jsx... #70

Closed mrkchang closed 4 years ago

mrkchang commented 4 years ago

Here's the code... export default class FlowChart extends Component { render() { // const stateActions = mapValues(actions, (func: any) => // (...args: any) => this.setState(func(...args))) // as typeof actions

    const callbacks = {
        onDragCanvas: (event, data) => { console.log("onDragCanvas", event, data)},
        onDrop: (event, data) => { console.log("onDrop", event, data)},
        onCanvasDrop: (event, data) => { console.log("onCanvasDrop", event, data)},
    }

    return (
        <FlowChartWithState 
            initialValue={chartSimple}
            callbacks={callbacks}
            // Components={ { Port: PortCustom, }}

        />
    )
}

}

elbrodelche commented 4 years ago

Im having the same prolblem It seems that <FlowChartWithState> doest accept callbacks. The callbacks are taken from an actions file, but i dont see how to manage that. Can anybody give some advice?. I just want to put a click listener on every node.

v4irajvimu commented 4 years ago

@elbrodelche @mrkchang can you have a look on this closed issue, please? it may solve the problem. https://github.com/MrBlenny/react-flow-chart/issues/30