react-native-code-switch

1.0.2 • Public • Published

react-native-switch

A tool for switching between react and react-native components.

Getting Started

Install

yarn add react-native-code-switch or npm install react-native-code-switch

then in your package.json file add this to the "scripts" block. "switch":"node ./node_modules/react-native-code-switch/index.js"

How to use

Add a comment above the import you would like to toggle between web and mobile.

The following example will activate code for web:

// @switch web
import "styles.css"

And this code will activate code for mobile devices:

// @switch mobile
import "react-native-component-that-will-break-on-web"

Run yarn switch web to activate the // @switch web code. Run yarn switch mobile to activate the // @switch mobile code.

The import line of code will be commented out when switch is not on it's platform.

Dependencies (1)

Dev Dependencies (0)

    Package Sidebar

    Install

    npm i react-native-code-switch

    Weekly Downloads

    1

    Version

    1.0.2

    License

    ISC

    Unpacked Size

    3.48 kB

    Total Files

    3

    Last publish

    Collaborators

    • daniel-coyle