Code Monkey home page Code Monkey logo

react-native-dev-menu's Introduction

📳 react-native-dev-menu

npm version npm Platform - Android and iOS MIT styled with prettier

Add custom items to the React Native dev menu.

The native part of this module is a variation of react-native-async-storage-dev-menu-item.

It currently supports React Native 0.48+.

Usage

if (__DEV__) {
  const DevMenu = require('react-native-dev-menu');
  DevMenu.addItem('Say Hello', () => alert('Hello!'));
}

Setup

npm install --save react-native-dev-menu
# --- or ---
yarn add react-native-dev-menu
react-native link react-native-dev-menu

iOS specific setup

CocoaPods linking

After installing the npm package, add the following line to your Podfile :

pod 'RNDevMenu', :path => '../node_modules/react-native-dev-menu'

Manual linking

  1. In the XCode's "Project navigator", right click on your project's Libraries folder ➜ Add Files to <...>
  2. Go to node_modulesreact-native-dev-menu ➜ select RNDevMenu.xcodeproj
  3. Add libRNDevMenu.a to Build Phases -> Link Binary With Libraries

Android specific setup

Manual linking

After installing the package, add the following line to the ./android/settings.gradle file :

include ':app', ':react-native-dev-menu'
project(':react-native-dev-menu').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-dev-menu/android')

Include it as dependency in the ./android/app/build.gradle file :

dependencies {
    compile project(':react-native-dev-menu')
    // ...
}

Finally, you need to link the package to the ./android/app/src/main/java/…/MainApplication.java file :

import com.zoontek.rndevmenu.RNDevMenuPackage;

// ...

@Override
protected List<ReactPackage> getPackages() {
    return Arrays.<ReactPackage>asList(
        new MainReactPackage(),
        // ...
        new RNDevMenuPackage(), // <-- Add it to the packages list
    );
}

// ...

react-native-dev-menu's People

Contributors

zoontek avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.