A tool for switching between react and react-native components.
yarn add react-native-code-switch
npm install react-native-code-switch
then in your
package.json file add this to the "scripts" block.
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"
yarn switch web to activate the
// @switch web code.
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.