{"action":"opened","issue":{"url":"https://api.github.com/repos/facebook/react-native/issues/8510","repository_url":"https://api.github.com/repos/facebook/react-native","labels_url":"https://api.github.com/repos/facebook/react-native/issues/8510/labels{/name}","comments_url":"https://api.github.com/repos/facebook/react-native/issues/8510/comments","events_url":"https://api.github.com/repos/facebook/react-native/issues/8510/events","html_url":"https://github.com/facebook/react-native/issues/8510","id":163199330,"number":8510,"title":"[Android] Copy button in the redbox should also support Windows and Linux platforms","user":{"login":"lebronJ","id":19341200,"avatar_url":"https://avatars.githubusercontent.com/u/19341200?v=3","gravatar_id":"","url":"https://api.github.com/users/lebronJ","html_url":"https://github.com/lebronJ","followers_url":"https://api.github.com/users/lebronJ/followers","following_url":"https://api.github.com/users/lebronJ/following{/other_user}","gists_url":"https://api.github.com/users/lebronJ/gists{/gist_id}","starred_url":"https://api.github.com/users/lebronJ/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lebronJ/subscriptions","organizations_url":"https://api.github.com/users/lebronJ/orgs","repos_url":"https://api.github.com/users/lebronJ/repos","events_url":"https://api.github.com/users/lebronJ/events{/privacy}","received_events_url":"https://api.github.com/users/lebronJ/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-06-30T15:47:36Z","updated_at":"2016-06-30T15:47:36Z","closed_at":null,"body":"This is not a bug report but **Help Wanted**!\r\n\r\nI have added a new feature of adding copy button in the redbox for RN Android, which copies the error message and stack trace to the host (your laptop's) clipboard. Please see [Add Copy and Dismiss Button in RN Android Red Box](https://github.com/facebook/react-native/commit/dc3fce06ea6db48285d31d8d00889c942d4b8aee) and have a try on it!\r\n\r\nHowever it's only supported on Mac OS for now. The reason is just that I don't have available Windows or Linux computers to test this feature on. So I appreciate anyone's help to add this feature on these two platforms.\r\n\r\nActually I already have the codes for you, which I think should work.\r\nPlease see https://github.com/facebook/react-native/blob/master/local-cli/server/util/copyToClipBoard.js\r\n\r\n```\r\n/**\r\n * Copyright (c) 2015-present, Facebook, Inc.\r\n * All rights reserved.\r\n *\r\n * This source code is licensed under the BSD-style license found in the\r\n * LICENSE file in the root directory of this source tree. An additional grant\r\n * of patent rights can be found in the PATENTS file in the same directory.\r\n */\r\n'use strict';\r\n\r\nvar child_process = require('child_process');\r\nvar spawn = child_process.spawn;\r\n\r\n/**\r\n * Copy the content to host system clipboard.\r\n * This is only supported on Mac for now.\r\n */\r\nfunction copyToClipBoard(content) {\r\n  switch (process.platform) {\r\n  case 'darwin':\r\n    var child = spawn('pbcopy', []);\r\n    child.stdin.end(new Buffer(content, 'utf8'));\r\n    return true;\r\n  // Changes begin.\r\n  case 'linux':\r\n    var child = spawn('xclip', ['-selection', 'clipboard']);\r\n    child.stdin.end(new Buffer(content, 'utf8'));\r\n    return true;\r\n  case 'win32':\r\n    var child = spawn('clip', []);\r\n    child.stdin.end(iconv.encode(content, 'utf16le'));\r\n    return true;\r\n  // Changes end.\r\n  default:\r\n    return false;\r\n  }\r\n}\r\n\r\nmodule.exports = copyToClipBoard;\r\n```\r\n\r\nThe codes between `// Changes begin.` and `// Changes end.` are the only things to be added by you. Hope this will work on Windows and Linux!\r\n\r\nIf anyone needs more information on this, feel free to tell me.\r\n\r\n\r\n "}}
{"actor":{"display_login":"lebronJ"}}