Skip to content

Copy button is not working in android emulator, linux #13165

Closed
hixio-mh/react-native
#19
@saigrandhi

Description

@saigrandhi

Description

The copy button in the android emulator is not working on the Linux platform.

Reproduction Steps and Sample Code

In order to reproduce this, just create a new react-native app and add a syntax error in index.android.js. Run this app and the error screen will show up but you would not be able to copy the error.
CopyToClipboard.js has no case for linux

Solution

The following solution worked for me:

  • add xsel binary in a vendor folder inside the util where copyToClipBoard.js is located
  • access it by var xsel = path.join(__dirname, './vendor/xsel');
  • give the binary permissions using fs library: fs.chmodSync(xsel, '0755');
  • update copyToClipBoard.js with a linux platform option.
    case 'linux':
          var child = spawn('xsel', ['--clipboard', '--input']);
          child.stdin.end(new Buffer(content, 'utf8'));
          return true;

I can make a pull request but I am not sure what tests should be implemented and where to implement them.

Additional Information

  • React Native version: 0.43
  • Platform: Android
  • Development Operating System: Linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions