{"action":"created","issue":{"url":"https://api.github.com/repos/sarink/react-file-drop/issues/23","repository_url":"https://api.github.com/repos/sarink/react-file-drop","labels_url":"https://api.github.com/repos/sarink/react-file-drop/issues/23/labels{/name}","comments_url":"https://api.github.com/repos/sarink/react-file-drop/issues/23/comments","events_url":"https://api.github.com/repos/sarink/react-file-drop/issues/23/events","html_url":"https://github.com/sarink/react-file-drop/issues/23","id":287837900,"number":23,"title":"V2 is on the way","user":{"login":"sarink","id":1881761,"avatar_url":"https://avatars2.githubusercontent.com/u/1881761?v=4","gravatar_id":"","url":"https://api.github.com/users/sarink","html_url":"https://github.com/sarink","followers_url":"https://api.github.com/users/sarink/followers","following_url":"https://api.github.com/users/sarink/following{/other_user}","gists_url":"https://api.github.com/users/sarink/gists{/gist_id}","starred_url":"https://api.github.com/users/sarink/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sarink/subscriptions","organizations_url":"https://api.github.com/users/sarink/orgs","repos_url":"https://api.github.com/users/sarink/repos","events_url":"https://api.github.com/users/sarink/events{/privacy}","received_events_url":"https://api.github.com/users/sarink/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-01-11T16:15:20Z","updated_at":"2018-02-04T21:02:31Z","closed_at":null,"author_association":"OWNER","body":"Hey guys, I am working on a v2 of this library which will fix all issues, and work with the latest React. Please stay tuned the next couple of weeks!\r\nUntil then, happy to accept PRs that would contain a temporary fix for any problems (maybe through a flag or some option, as to not break backwards compatibility)\r\nThanks!"},"comment":{"url":"https://api.github.com/repos/sarink/react-file-drop/issues/comments/362939356","html_url":"https://github.com/sarink/react-file-drop/issues/23#issuecomment-362939356","issue_url":"https://api.github.com/repos/sarink/react-file-drop/issues/23","id":362939356,"user":{"login":"nbcnc","id":27741514,"avatar_url":"https://avatars1.githubusercontent.com/u/27741514?v=4","gravatar_id":"","url":"https://api.github.com/users/nbcnc","html_url":"https://github.com/nbcnc","followers_url":"https://api.github.com/users/nbcnc/followers","following_url":"https://api.github.com/users/nbcnc/following{/other_user}","gists_url":"https://api.github.com/users/nbcnc/gists{/gist_id}","starred_url":"https://api.github.com/users/nbcnc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nbcnc/subscriptions","organizations_url":"https://api.github.com/users/nbcnc/orgs","repos_url":"https://api.github.com/users/nbcnc/repos","events_url":"https://api.github.com/users/nbcnc/events{/privacy}","received_events_url":"https://api.github.com/users/nbcnc/received_events","type":"User","site_admin":false},"created_at":"2018-02-04T21:02:31Z","updated_at":"2018-02-04T21:02:31Z","author_association":"NONE","body":"@sarink, it's great to hear you're working on V2.  I really like your file-drop component.  It's been great to use in my project.   Thank you!! \r\n\r\nIf I can make one suggestion --\r\n\r\nIn the current version of `react-file-drop`, the `onDrop` callback is triggering twice for me.  After doing some debugging, I realized that your `onDrop` prop is receiving **two** events for every drop -- 1) a Native onDrop Event and 2) a Proxy Event from React (I'm using V15.6.1).  \r\n\r\nSo whenever I drop a file into the drop area, two events were firing, causing my upload script to the fire twice, too.\r\n\r\n```\r\n<FileDrop frame={document}\r\n      onDrop={this.onFileDrop}\r\n      onFrameDragEnter={this.onDragEnter}\r\n      onFrameDragLeave={this.onDragLeave}\r\n      targetAlwaysVisible={true}/>\r\n```\r\n\r\nFor my purposes, I fixed this by testing whether the `event` passed by `onDrop` also contains a `nativeEvent` object.  If `event.nativeEvent` does not return `undefined` then I know it's React's Proxy Event (which is sufficient for the onDrop event) and I can ignore the superfluous Native DOM onDrop Event and prevent the double-firing.\r\n\r\n```\r\n  onFileDrop = (files, event) => {\r\n\r\n    // Disables Native Event -- relying on Proxy Event -- prevents double firing\r\n    if (!event.nativeEvent) {\r\n      return;\r\n    }\r\n\r\n    _.forEach(files, file => {\r\n      this.data.set(file.name, file);\r\n    });\r\n\r\n    this.onUpload();\r\n\r\n}\r\n```\r\n\r\nThis fix was easy, but I'm not sure if there's a way your V2 component can be aware that, under some circumstances, both Native Events and Proxy Events could be triggered with each onDrop event and then somehow filter out one or the other so that they both don't fire at once in your code.\r\n\r\nThanks,\r\nmarc\r\n\r\n\r\n"}}
{"actor":{"display_login":"nbcnc"}}