mirror of
https://github.com/facebook/react-native.git
synced 2026-11-18 20:19:07 +00:00
Reviewed By: bnham Differential Revision: D4250937 fbshipit-source-id: b5f2cfdeb06c04399670e463b8b2498e2fe0074b
27 lines
478 B
React
27 lines
478 B
React
// @flow
|
|
|
|
import React from 'react';
|
|
|
|
type Props = {
|
|
id: string,
|
|
children?: any,
|
|
}
|
|
|
|
export default class Draggable extends React.Component {
|
|
props: Props;
|
|
|
|
_handleDragStart = (e: SyntheticDragEvent) => {
|
|
e.dataTransfer.setData('text', this.props.id);
|
|
}
|
|
|
|
render(): React.Element<*> {
|
|
return React.cloneElement(
|
|
React.Children.only(this.props.children),
|
|
{
|
|
draggable: 'true',
|
|
onDragStart: this._handleDragStart,
|
|
}
|
|
);
|
|
}
|
|
}
|