Socket
Socket
Sign inDemoInstall

react-native-clipboard

Package Overview
Dependencies
0
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    react-native-clipboard

React Native component for getting or setting clipboard content


Version published
Weekly downloads
210
decreased by-18.29%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

react-native-clipboard

React Native component for getting or setting clipboard content

Usage

npm install react-native-clipboard --save

iOS

In XCode, in the project navigator, right click Libraries ➜ Add Files to [your project's name], Go to node_modules ➜ react-native-clipboard and add the RNClipboard.xcodeproj file

In XCode, in the project navigator, select your project. Add the lib*.a from the RNClipboard project to your project's Build Phases ➜ Link Binary With Libraries Click RNClipboard.xcodeproj file you added before in the project navigator and go the Build Settings tab. Make sure 'All' is toggled on (instead of 'Basic'). Look for Header Search Paths and make sure it contains both $(SRCROOT)/../react-native/React and $(SRCROOT)/../../React - mark both as recursive.

Run your project (Cmd+R)

Android

  • In android/setting.gradle
...
include ':react-native-clipboard'
project(':react-native-clipboard').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-clipboard/RNClipboardAndroid/app')
  • In android/app/build.gradle
...
dependencies {
    ...
    compile project(':react-native-clipboard')
}
  • register module (in MainActivity.java)

import com.davidsandor.rnclipboardandroid.RNClipboardAndroidPackage;;  // <--- import

public class MainActivity extends Activity implements DefaultHardwareBackBtnHandler {
  ......

  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mReactRootView = new ReactRootView(this);

    mReactInstanceManager = ReactInstanceManager.builder()
      .setApplication(getApplication())
      .setBundleAssetName("index.android.bundle")
      .setJSMainModuleName("index.android")
      .addPackage(new MainReactPackage())
      .addPackage(new RNClipboardAndroidPackage())              // <------ add here
      .setUseDeveloperSupport(BuildConfig.DEBUG)
      .setInitialLifecycleState(LifecycleState.RESUMED)
      .build();

    mReactRootView.startReactApplication(mReactInstanceManager, "example", null);

    setContentView(mReactRootView);
  }

  ......

}

Examples


var Clipboard = require('react-native-clipboard');

Clipboard.get(content => {
  console.log(content);
});

Clipboard.set('abc');

Keywords

FAQs

Last updated on 13 Dec 2015

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc